lambda.xy.x
lambda.xy.x

Reputation: 4998

Oasis build configuration with subdirectories

I am using oasis to build my ocaml project, with the source code present in a directory called src. The oasis build file looks like that:

OASISFormat: 0.4
Name:        Test
Version:     0.1
Synopsis:    no
Authors:     Me
License:     BSD-3-clause
Plugins:     META (0.4)

Executable abc
  Path:        src
  BuildTools:  ocamlbuild
  MainIs:      main.ml

Now I would like to organize the files into subfolders, putting a.mli and a.ml into src/util. After doing this, the module becomes invisible to ocamlbuild/ocamlc, resulting in an 'unbound module A' error. If I would call ocamlc by hand, I can add the -I src/util flag to make a.mli visible again.

How can I add the additional paths to the oasis configuration without making the files full libraries?

Upvotes: 4

Views: 345

Answers (2)

ivg
ivg

Reputation: 35210

It is impossible with oasis, you need to modify your _tags file, but I wouldn't advice you to do this. The general approach is to create Library entries in your oasis file. This helps to keep your project structure clean. And if you wouldn't like to create a library from utils, then why bother and move it into a subfolder.

Upvotes: 5

PatJ
PatJ

Reputation: 6144

You may try to add <src/utils>: include to your _tags file (this file is generated by oasis, you cannot edit it anyware: do it outside the scope of the generated part.

This will directly tell ocamlbuild to add a -I src/utils to its arguments, I don't think it's possible to tell oasis to do this himself without making a library.

Upvotes: 3

Related Questions