caml-list - the Caml user's mailing list
 help / color / Atom feed
* [Caml-list] make -> dune: recommended structure
@ 2019-01-13 13:31 Robert Muller
  2019-01-13 14:07 ` Nicolás Ojeda Bär
  0 siblings, 1 reply; 5+ messages in thread
From: Robert Muller @ 2019-01-13 13:31 UTC (permalink / raw)
  To: Ocaml Mailing List

[-- Attachment #1: Type: text/plain, Size: 930 bytes --]

Greetings. I have a toy compiler made up of ~20 modules:

ast.mli ast.ml symbol.mli symbol.ml ...

and a top-level in compile.ml. These sources are compiled and linked using
a Makefile which invokes ocamlc. I'll call the resulting compiler
"translate".

At present I have *all* of these files resident in a single src/ directory.
I'm considering converting the build to dune for the semester. What would
the recommended directory structure be and what would the dune file(s?) and
stanzas look like? I assume this is in the middle of dune's wheelhouse but
I wasn't able to find anything on it in the examples or documents. I
assume/hope I don't have to put the modules in a library.
Thank you,
Bob Muller

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list https://inbox.ocaml.org/caml-list
Forum: https://discuss.ocaml.org/
Bug reports: http://caml.inria.fr/bin/caml-bugs

[-- Attachment #2: Type: text/html, Size: 936 bytes --]

<div dir="ltr">Greetings. I have a toy compiler made up of ~20 modules:<div><br><div>ast.mli <a href="http://ast.ml">ast.ml</a> symbol.mli <a href="http://symbol.ml">symbol.ml</a> ... </div><div><br></div><div>and a top-level in <a href="http://compile.ml">compile.ml</a>. These sources are compiled and linked using a Makefile which invokes ocamlc. I&#39;ll call the resulting compiler &quot;translate&quot;.</div><div><br></div><div>At present I have *all* of these files resident in a single src/ directory. I&#39;m considering converting the build to dune for the semester. What would the recommended directory structure be and what would the dune file(s?) and stanzas look like? I assume this is in the middle of dune&#39;s wheelhouse but I wasn&#39;t able to find anything on it in the examples or documents. I assume/hope I don&#39;t have to put the modules in a library.</div></div><div>Thank you,<br>Bob Muller </div></div>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] make -> dune: recommended structure
  2019-01-13 13:31 [Caml-list] make -> dune: recommended structure Robert Muller
@ 2019-01-13 14:07 ` Nicolás Ojeda Bär
  2019-01-13 14:22   ` Robert Muller
  2020-01-12 22:24   ` Robert Muller
  0 siblings, 2 replies; 5+ messages in thread
From: Nicolás Ojeda Bär @ 2019-01-13 14:07 UTC (permalink / raw)
  To: Robert Muller; +Cc: Ocaml Mailing List

[-- Attachment #1: Type: text/plain, Size: 2201 bytes --]

Dear Bob,

Your present directory structure is just fine. A single `dune` file at `src/dune` with the contents

    (executable
     (name compile)
     (public_name translate))

should be enough. Here I am assuming that all modules in `src/` are part of the compiler. If this is not the case you need to specify the modules you want to include as follows:

    (executable
     (name compile)
     (public_name translate)
     (modules compile ast symbol ...))

Note: if you have a file `parser.mly` in your project that needs to be processed with `ocamlyacc` then you need to declare this in its own stanza:

    (ocamlyacc parser)

Similarly an `ocamllex` file `lexer.mll` needs to be declared with

    (ocamllex lexer)

Finally, you need to make sure there is a `<foo>.opam` file at the root of your project. This file can be be empty if you do not actually use `opam` but the name `foo` is used by `dune` to identify the "package" your executable belongs to. Once these files are in place, you can build your project with

    dune build

Best wishes,
Nicolás

On Sun, 13 Jan 2019 at 14:31, Robert Muller <robert.muller2@gmail.com<mailto:robert.muller2@gmail.com>> wrote:
Greetings. I have a toy compiler made up of ~20 modules:

ast.mli ast.ml<http://ast.ml> symbol.mli symbol.ml<http://symbol.ml> ...

and a top-level in compile.ml<http://compile.ml>. These sources are compiled and linked using a Makefile which invokes ocamlc. I'll call the resulting compiler "translate".

At present I have *all* of these files resident in a single src/ directory. I'm considering converting the build to dune for the semester. What would the recommended directory structure be and what would the dune file(s?) and stanzas look like? I assume this is in the middle of dune's wheelhouse but I wasn't able to find anything on it in the examples or documents. I assume/hope I don't have to put the modules in a library.
Thank you,
Bob Muller

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list https://inbox.ocaml.org/caml-list
Forum: https://discuss.ocaml.org/
Bug reports: http://caml.inria.fr/bin/caml-bugs

[-- Attachment #2: Type: text/html, Size: 3317 bytes --]

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div>
<div dir="auto">Dear Bob,</div>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">Your present directory structure is just fine. A single `dune` file at `src/dune` with the contents</div>
</div>
<div><br>
</div>
<div>&nbsp; &nbsp; (executable</div>
<div>&nbsp; &nbsp; &nbsp;(name compile)</div>
<div>&nbsp; &nbsp; &nbsp;(public_name translate))</div>
<div><br>
</div>
<div>should be enough. Here I am assuming that all modules in `src/` are part of the compiler. If this is not the case you need to specify the modules you want to include as follows:</div>
<div><br>
</div>
<div>
<div>&nbsp; &nbsp; (executable</div>
<div>&nbsp; &nbsp; &nbsp;(name compile)</div>
<div>&nbsp; &nbsp; &nbsp;(public_name translate)</div>
</div>
<div>&nbsp; &nbsp; &nbsp;(modules compile ast symbol ...))</div>
<div><br>
</div>
<div>Note: if you have a file `parser.mly` in your project that needs to be processed with `ocamlyacc` then you need to declare this in its own stanza:</div>
<div><br>
</div>
<div>&nbsp; &nbsp; (ocamlyacc parser)<br>
</div>
<div><br>
</div>
<div>Similarly an `ocamllex` file `lexer.mll` needs to be declared with</div>
<div><br>
</div>
<div>&nbsp; &nbsp; (ocamllex lexer)</div>
<div><br>
</div>
<div>Finally, you need to make sure there is a `&lt;foo&gt;.opam` file at the root of your project. This file can be be empty if you do not actually use `opam` but the name `foo` is used by `dune` to identify the &quot;package&quot; your executable belongs to. Once these files
 are in place, you can build your project with</div>
<div><br>
</div>
<div>&nbsp; &nbsp; dune build</div>
<div><br>
</div>
<div>Best wishes,</div>
<div>Nicolás<br>
</div>
<div><br>
</div>
<div>
<div class="gmail_quote">
<div dir="ltr">On Sun, 13 Jan 2019 at 14:31, Robert Muller &lt;<a href="mailto:robert.muller2@gmail.com" target="_blank">robert.muller2@gmail.com</a>&gt; wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<div dir="ltr">Greetings. I have a toy compiler made up of ~20 modules:
<div><br>
<div>ast.mli <a href="http://ast.ml" target="_blank">ast.ml</a> symbol.mli <a href="http://symbol.ml" target="_blank">
symbol.ml</a> ...&nbsp;</div>
<div><br>
</div>
<div>and a top-level in <a href="http://compile.ml" target="_blank">compile.ml</a>. These sources are compiled and linked using a Makefile which invokes ocamlc. I'll call the resulting compiler &quot;translate&quot;.</div>
<div><br>
</div>
<div>At present I have *all* of these files resident in a single src/ directory. I'm considering converting the build to dune for the semester. What would the recommended directory structure be and what would the dune file(s?) and stanzas look like? I assume
 this is in the middle of dune's wheelhouse but I wasn't able to find anything on it in the examples or documents. I assume/hope I don't have to put the modules in a library.</div>
</div>
<div>Thank you,<br>
Bob Muller&nbsp;</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</body>
</html>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] make -> dune: recommended structure
  2019-01-13 14:07 ` Nicolás Ojeda Bär
@ 2019-01-13 14:22   ` Robert Muller
  2020-01-12 22:24   ` Robert Muller
  1 sibling, 0 replies; 5+ messages in thread
From: Robert Muller @ 2019-01-13 14:22 UTC (permalink / raw)
  To: Nicolás Ojeda Bär; +Cc: Ocaml Mailing List

[-- Attachment #1: Type: text/plain, Size: 2704 bytes --]

This is fantastic, thank you. I could be wrong but I think my setup is
common enough that it would probably be helpful to have some variation of
your answer as an example in the dune documentation and possibly in the
quick-start guide. I suppose I could submit a PR to
https://github.com/ocaml/dune/tree/master/example.
Thanks again,
Bob


On Sun, Jan 13, 2019 at 9:07 AM Nicolás Ojeda Bär <
nicolas.ojeda.bar@lexifi.com> wrote:

> Dear Bob,
>
> Your present directory structure is just fine. A single `dune` file at
> `src/dune` with the contents
>
>     (executable
>      (name compile)
>      (public_name translate))
>
> should be enough. Here I am assuming that all modules in `src/` are part
> of the compiler. If this is not the case you need to specify the modules
> you want to include as follows:
>
>     (executable
>      (name compile)
>      (public_name translate)
>      (modules compile ast symbol ...))
>
> Note: if you have a file `parser.mly` in your project that needs to be
> processed with `ocamlyacc` then you need to declare this in its own stanza:
>
>     (ocamlyacc parser)
>
> Similarly an `ocamllex` file `lexer.mll` needs to be declared with
>
>     (ocamllex lexer)
>
> Finally, you need to make sure there is a `<foo>.opam` file at the root of
> your project. This file can be be empty if you do not actually use `opam`
> but the name `foo` is used by `dune` to identify the "package" your
> executable belongs to. Once these files are in place, you can build your
> project with
>
>     dune build
>
> Best wishes,
> Nicolás
>
> On Sun, 13 Jan 2019 at 14:31, Robert Muller <robert.muller2@gmail.com>
> wrote:
>
>> Greetings. I have a toy compiler made up of ~20 modules:
>>
>> ast.mli ast.ml symbol.mli symbol.ml ...
>>
>> and a top-level in compile.ml. These sources are compiled and linked
>> using a Makefile which invokes ocamlc. I'll call the resulting compiler
>> "translate".
>>
>> At present I have *all* of these files resident in a single src/
>> directory. I'm considering converting the build to dune for the semester.
>> What would the recommended directory structure be and what would the dune
>> file(s?) and stanzas look like? I assume this is in the middle of dune's
>> wheelhouse but I wasn't able to find anything on it in the examples or
>> documents. I assume/hope I don't have to put the modules in a library.
>> Thank you,
>> Bob Muller
>>
>

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list https://inbox.ocaml.org/caml-list
Forum: https://discuss.ocaml.org/
Bug reports: http://caml.inria.fr/bin/caml-bugs

[-- Attachment #2: Type: text/html, Size: 3948 bytes --]

<div dir="ltr"><div dir="ltr">This is fantastic, thank you. I could be wrong but I think my setup is common enough that it would probably be helpful to have some variation of your answer as an example in the dune documentation and possibly in the quick-start guide. I suppose I could submit a PR to <a href="https://github.com/ocaml/dune/tree/master/example" target="_blank">https://github.com/ocaml/dune/tree/master/example</a>.</div><div>Thanks again,<br></div><div>Bob</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Sun, Jan 13, 2019 at 9:07 AM Nicolás Ojeda Bär &lt;<a href="mailto:nicolas.ojeda.bar@lexifi.com" target="_blank">nicolas.ojeda.bar@lexifi.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">



<div>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div>
<div dir="auto">Dear Bob,</div>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">Your present directory structure is just fine. A single `dune` file at `src/dune` with the contents</div>
</div>
<div><br>
</div>
<div>    (executable</div>
<div>     (name compile)</div>
<div>     (public_name translate))</div>
<div><br>
</div>
<div>should be enough. Here I am assuming that all modules in `src/` are part of the compiler. If this is not the case you need to specify the modules you want to include as follows:</div>
<div><br>
</div>
<div>
<div>    (executable</div>
<div>     (name compile)</div>
<div>     (public_name translate)</div>
</div>
<div>     (modules compile ast symbol ...))</div>
<div><br>
</div>
<div>Note: if you have a file `parser.mly` in your project that needs to be processed with `ocamlyacc` then you need to declare this in its own stanza:</div>
<div><br>
</div>
<div>    (ocamlyacc parser)<br>
</div>
<div><br>
</div>
<div>Similarly an `ocamllex` file `lexer.mll` needs to be declared with</div>
<div><br>
</div>
<div>    (ocamllex lexer)</div>
<div><br>
</div>
<div>Finally, you need to make sure there is a `&lt;foo&gt;.opam` file at the root of your project. This file can be be empty if you do not actually use `opam` but the name `foo` is used by `dune` to identify the &quot;package&quot; your executable belongs to. Once these files
 are in place, you can build your project with</div>
<div><br>
</div>
<div>    dune build</div>
<div><br>
</div>
<div>Best wishes,</div>
<div>Nicolás<br>
</div>
<div><br>
</div>
<div>
<div class="gmail_quote">
<div dir="ltr">On Sun, 13 Jan 2019 at 14:31, Robert Muller &lt;<a href="mailto:robert.muller2@gmail.com" target="_blank">robert.muller2@gmail.com</a>&gt; wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">Greetings. I have a toy compiler made up of ~20 modules:
<div><br>
<div>ast.mli <a href="http://ast.ml" target="_blank">ast.ml</a> symbol.mli <a href="http://symbol.ml" target="_blank">
symbol.ml</a> ... </div>
<div><br>
</div>
<div>and a top-level in <a href="http://compile.ml" target="_blank">compile.ml</a>. These sources are compiled and linked using a Makefile which invokes ocamlc. I&#39;ll call the resulting compiler &quot;translate&quot;.</div>
<div><br>
</div>
<div>At present I have *all* of these files resident in a single src/ directory. I&#39;m considering converting the build to dune for the semester. What would the recommended directory structure be and what would the dune file(s?) and stanzas look like? I assume
 this is in the middle of dune&#39;s wheelhouse but I wasn&#39;t able to find anything on it in the examples or documents. I assume/hope I don&#39;t have to put the modules in a library.</div>
</div>
<div>Thank you,<br>
Bob Muller </div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>

</blockquote></div>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] make -> dune: recommended structure
  2019-01-13 14:07 ` Nicolás Ojeda Bär
  2019-01-13 14:22   ` Robert Muller
@ 2020-01-12 22:24   ` Robert Muller
  2020-01-13  0:20     ` Yawar Amin
  1 sibling, 1 reply; 5+ messages in thread
From: Robert Muller @ 2020-01-12 22:24 UTC (permalink / raw)
  To: Nicolás Ojeda Bär; +Cc: Ocaml Mailing List

[-- Attachment #1: Type: text/plain, Size: 4270 bytes --]

One year later, take-two on transitioning from make to dune for an
OCaml-based PL course. We have a course library, say, code.cma, stored in a
folder outside the dune workspace, say /Users/studentX/lib/, several course
projects use the definitions in this course library.
As I understand it, the singular "library" in a dune stanza refers to the
artifact created by a build (the output) while the plural "libraries"
refers to -inputs- to the current build. How to inform dune about the path
to look for non-local .cma files? (As in the include switch > ocamlc -I
path ...)? I found the following in the dune documentation:

Finding external libraries
> When a library is not available in the workspace, dune will look it up in
> the installed world, and expect it to be already compiled.
>
> It looks up external libraries using a specific list of search paths. A
> list of search paths is specific to a given build context and is determined
> as follow:
>
> if the ocamlfind is present in the PATH of the context, use each line in
> the output of ocamlfind printconf path as a search path
> otherwise, if opam is present in the PATH, use the output of opam config
> var lib
> otherwise, take the directory where ocamlc was found, and append ../lib to
> it. For instance if ocamlc is found in /usr/bin, use /usr/lib
>

I didn't know what "A list of search paths is specific to a given build
context..." meant but ocamlfind -is- present in the PATH and the command

> ocamlfind printconf path


shows

/Users/muller/.opam/default/lib

seems reasonable (though I suppose I should go sort out exactly the
difference between a package and a library). Anyway, I couldn't find a more
civilized way to extend ocamlfind's search path so I edited
/Users/muller/.opam/default/lib/findlib.conf
by hand to include the path to our course library. Dune still cannot find
our course library.

I could be wrong, but it seems this setup (with a standard site library
code.cma) is pretty common, so I'm sure I'm missing something super-obvious
in the documentation. Any leads would be appreciated.

Bob Muller



On Sun, Jan 13, 2019 at 9:07 AM Nicolás Ojeda Bär <
nicolas.ojeda.bar@lexifi.com> wrote:

> Dear Bob,
>
> Your present directory structure is just fine. A single `dune` file at
> `src/dune` with the contents
>
>     (executable
>      (name compile)
>      (public_name translate))
>
> should be enough. Here I am assuming that all modules in `src/` are part
> of the compiler. If this is not the case you need to specify the modules
> you want to include as follows:
>
>     (executable
>      (name compile)
>      (public_name translate)
>      (modules compile ast symbol ...))
>
> Note: if you have a file `parser.mly` in your project that needs to be
> processed with `ocamlyacc` then you need to declare this in its own stanza:
>
>     (ocamlyacc parser)
>
> Similarly an `ocamllex` file `lexer.mll` needs to be declared with
>
>     (ocamllex lexer)
>
> Finally, you need to make sure there is a `<foo>.opam` file at the root of
> your project. This file can be be empty if you do not actually use `opam`
> but the name `foo` is used by `dune` to identify the "package" your
> executable belongs to. Once these files are in place, you can build your
> project with
>
>     dune build
>
> Best wishes,
> Nicolás
>
> On Sun, 13 Jan 2019 at 14:31, Robert Muller <robert.muller2@gmail.com>
> wrote:
>
>> Greetings. I have a toy compiler made up of ~20 modules:
>>
>> ast.mli ast.ml symbol.mli symbol.ml ...
>>
>> and a top-level in compile.ml. These sources are compiled and linked
>> using a Makefile which invokes ocamlc. I'll call the resulting compiler
>> "translate".
>>
>> At present I have *all* of these files resident in a single src/
>> directory. I'm considering converting the build to dune for the semester.
>> What would the recommended directory structure be and what would the dune
>> file(s?) and stanzas look like? I assume this is in the middle of dune's
>> wheelhouse but I wasn't able to find anything on it in the examples or
>> documents. I assume/hope I don't have to put the modules in a library.
>> Thank you,
>> Bob Muller
>>
>

[-- Attachment #2: Type: text/html, Size: 6117 bytes --]

<div dir="ltr">One year later, take-two on transitioning from make to dune for an OCaml-based PL course. We have a course library, say, code.cma, stored in a folder outside the dune workspace, say /Users/studentX/lib/, several course projects use the definitions in this course library. <div>As I understand it, the singular &quot;library&quot; in a dune stanza refers to the artifact created by a build (the output) while the plural &quot;libraries&quot; refers to -inputs- to the current build. How to inform dune about the path to look for non-local .cma files? (As in the include switch &gt; ocamlc -I path ...)? I found the following in the dune documentation:<div><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Finding external libraries<br>When a library is not available in the workspace, dune will look it up in the installed world, and expect it to be already compiled.<br><br>It looks up external libraries using a specific list of search paths. A list of search paths is specific to a given build context and is determined as follow:<br><br>if the ocamlfind is present in the PATH of the context, use each line in the output of ocamlfind printconf path as a search path<br>otherwise, if opam is present in the PATH, use the output of opam config var lib<br>otherwise, take the directory where ocamlc was found, and append ../lib to it. For instance if ocamlc is found in /usr/bin, use /usr/lib<br></blockquote><div><br></div><div>I didn&#39;t know what &quot;A list of search paths is specific to a given build context...&quot; meant but ocamlfind -is- present in the PATH and the command</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">&gt; ocamlfind printconf path</blockquote><div><br></div><div>shows </div><div><br></div><div>/Users/muller/.opam/default/lib<br></div><div><br></div><div>seems reasonable (though I suppose I should go sort out exactly the difference between a package and a library). Anyway, I couldn&#39;t find a more civilized way to extend ocamlfind&#39;s search path so I edited /Users/muller/.opam/default/lib/findlib.conf</div></div><div>by hand to include the path to our course library. Dune still cannot find our course library.</div><div><br></div><div>I could be wrong, but it seems this setup (with a standard site library code.cma) is pretty common, so I&#39;m sure I&#39;m missing something super-obvious in the documentation. Any leads would be appreciated.</div><div><br></div><div>Bob Muller</div><div><br></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jan 13, 2019 at 9:07 AM Nicolás Ojeda Bär &lt;<a href="mailto:nicolas.ojeda.bar@lexifi.com">nicolas.ojeda.bar@lexifi.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">



<div>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div>
<div dir="auto">Dear Bob,</div>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">Your present directory structure is just fine. A single `dune` file at `src/dune` with the contents</div>
</div>
<div><br>
</div>
<div>    (executable</div>
<div>     (name compile)</div>
<div>     (public_name translate))</div>
<div><br>
</div>
<div>should be enough. Here I am assuming that all modules in `src/` are part of the compiler. If this is not the case you need to specify the modules you want to include as follows:</div>
<div><br>
</div>
<div>
<div>    (executable</div>
<div>     (name compile)</div>
<div>     (public_name translate)</div>
</div>
<div>     (modules compile ast symbol ...))</div>
<div><br>
</div>
<div>Note: if you have a file `parser.mly` in your project that needs to be processed with `ocamlyacc` then you need to declare this in its own stanza:</div>
<div><br>
</div>
<div>    (ocamlyacc parser)<br>
</div>
<div><br>
</div>
<div>Similarly an `ocamllex` file `lexer.mll` needs to be declared with</div>
<div><br>
</div>
<div>    (ocamllex lexer)</div>
<div><br>
</div>
<div>Finally, you need to make sure there is a `&lt;foo&gt;.opam` file at the root of your project. This file can be be empty if you do not actually use `opam` but the name `foo` is used by `dune` to identify the &quot;package&quot; your executable belongs to. Once these files
 are in place, you can build your project with</div>
<div><br>
</div>
<div>    dune build</div>
<div><br>
</div>
<div>Best wishes,</div>
<div>Nicolás<br>
</div>
<div><br>
</div>
<div>
<div class="gmail_quote">
<div dir="ltr">On Sun, 13 Jan 2019 at 14:31, Robert Muller &lt;<a href="mailto:robert.muller2@gmail.com" target="_blank">robert.muller2@gmail.com</a>&gt; wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">Greetings. I have a toy compiler made up of ~20 modules:
<div><br>
<div>ast.mli <a href="http://ast.ml" target="_blank">ast.ml</a> symbol.mli <a href="http://symbol.ml" target="_blank">
symbol.ml</a> ... </div>
<div><br>
</div>
<div>and a top-level in <a href="http://compile.ml" target="_blank">compile.ml</a>. These sources are compiled and linked using a Makefile which invokes ocamlc. I&#39;ll call the resulting compiler &quot;translate&quot;.</div>
<div><br>
</div>
<div>At present I have *all* of these files resident in a single src/ directory. I&#39;m considering converting the build to dune for the semester. What would the recommended directory structure be and what would the dune file(s?) and stanzas look like? I assume
 this is in the middle of dune&#39;s wheelhouse but I wasn&#39;t able to find anything on it in the examples or documents. I assume/hope I don&#39;t have to put the modules in a library.</div>
</div>
<div>Thank you,<br>
Bob Muller </div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>

</blockquote></div>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] make -> dune: recommended structure
  2020-01-12 22:24   ` Robert Muller
@ 2020-01-13  0:20     ` Yawar Amin
  0 siblings, 0 replies; 5+ messages in thread
From: Yawar Amin @ 2020-01-13  0:20 UTC (permalink / raw)
  To: Robert Muller; +Cc: Nicolás Ojeda Bär, Ocaml Mailing List

[-- Attachment #1: Type: text/plain, Size: 886 bytes --]

Hi,

On Sun, Jan 12, 2020 at 6:07 PM Robert Muller <robert.muller2@gmail.com>
wrote:

> One year later, take-two on transitioning from make to dune for an
> OCaml-based PL course. We have a course library, say, code.cma, stored in a
> folder outside the dune workspace, say /Users/studentX/lib/, several course
> projects use the definitions in this course library.
>

Instead of trying to share a code.cma file, perhaps you could distribute an
opam/dune project skeleton with the library source code, code.ml? Then the
problem of trying to tell dune where code.cma is goes away :-)


> I could be wrong, but it seems this setup (with a standard site library
> code.cma) is pretty common,
>

I've never heard of it. From what I understand, OCaml, opam, and dune all
heavily encourage compiling projects from source because of potential
system/architecture differences.

Regards,

Yawar

[-- Attachment #2: Type: text/html, Size: 1560 bytes --]

<div dir="ltr"><div>Hi,</div><div><br></div><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jan 12, 2020 at 6:07 PM Robert Muller &lt;<a href="mailto:robert.muller2@gmail.com">robert.muller2@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">One year later, take-two on transitioning from make to dune for an OCaml-based PL course. We have a course library, say, code.cma, stored in a folder outside the dune workspace, say /Users/studentX/lib/, several course projects use the definitions in this course library. </div></blockquote><div><br></div><div><div dir="ltr">Instead of trying to share a code.cma file, perhaps you could distribute an opam/dune project skeleton with the library source code, <a href="http://code.ml">code.ml</a>? Then the problem of trying to tell dune where code.cma is goes away :-)<br></div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div>I could be wrong, but it seems this setup (with a standard site library code.cma) is pretty common,</div></div></div></blockquote><div><br></div><div>I&#39;ve never heard of it. From what I understand, OCaml, opam, and dune all heavily encourage compiling projects from source because of potential system/architecture differences.<br></div><div><br></div><div>Regards,</div><div><br></div><div>Yawar<br></div></div></div></div>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-13 13:31 [Caml-list] make -> dune: recommended structure Robert Muller
2019-01-13 14:07 ` Nicolás Ojeda Bär
2019-01-13 14:22   ` Robert Muller
2020-01-12 22:24   ` Robert Muller
2020-01-13  0:20     ` Yawar Amin

caml-list - the Caml user's mailing list

Archives are clonable:
	git clone --mirror http://inbox.vuxu.org/caml-list
	git clone --mirror https://inbox.ocaml.org/caml-list

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.caml-list


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git