4

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?

lambda.xy.x
  • 4,918
  • 24
  • 35

2 Answers2

5

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.

ivg
  • 34,431
  • 2
  • 35
  • 63
  • 3
    To me, a library is for code reuse - i.e. it is general enough to be needed in a different project. But it is still useful to divide different parts of a project by clean interfaces even if the parts are not to be used on their own. Making them a library (in the sense of its own .cma file) seems overkill to me. – lambda.xy.x Feb 05 '15 at 08:45
3

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.

PatJ
  • 5,996
  • 1
  • 31
  • 37