Quantcast
Channel: OCaml - Topics tagged dune
Viewing all articles
Browse latest Browse all 521

Make a binary depend on non-code files in Dune

$
0
0

I have an OCaml binary that I’m building and installing through Dune. The binary depends on non-code files that are also being generated and installed by dune. Currently I’m using the sites mechanism for this, but I’m also open to other options.

The problem now is that when I run dune exec my-binary, the dependencies of the binary are not propagated to the _build/install folder, and can therefore not be found by the sites mechanism. I’m aware of this (hacky) solution, but I cannot get it to work in my situation because my dependencies are within the same project as the binary.

This is how far I came:

(install
 (files dependency.txt) ; the non-code dependency of my binary
 (section (site (my-package data)))
 (package my-package)
)
(executable
 (names my_binary)
 (modules ("my_binary"))
)
(install
 (section bin)
 (package my-package)
 (files (my-binary-copy.exe as my-binary)))
(rule
  (target my-binary-copy.exe)
; Here I want to express a dependency on the installation file of dependency.txt.
; Instead I get a dependency on the source file
  (deps dependency.txt) 
  (action (copy my-binary.exe my-binary-copy.exe)))

I experimented with using something like (deps %{lib:my-package:dependency.txt}), but that also does not work, because dependency.txt does not seem to be part of a library.

Any solutions are welcome!

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 521

Trending Articles