Skip to content

Commit

Permalink
add a common place for cflags for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
avsm committed May 17, 2019
1 parent 12dcf2e commit 78cad0b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/config/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(executable
(name test_config)
(libraries dune.configurator))

(rule
(targets test-cflags)
(deps test_config.exe)
(action (run %{exe:test_config.exe}
-integers-dir %{lib:integers:ocaml_integers.h}
-ctypes-dir %{lib:ctypes:ctypes_cstubs_internals.h})))
13 changes: 13 additions & 0 deletions tests/config/test_config.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module C = Configurator.V1

let () =
let ifile = ref "" in
let cfile = ref "" in
let args = [
"-integers-dir", Arg.Set_string ifile, "location of ocaml_integers.h";
"-ctypes-dir", Arg.Set_string cfile, "location of ctypes_cstubs_internals.h"] in
C.main ~args ~name:"ctypes-tests" (fun _c ->
let idir = ["-I";Filename.dirname !ifile] in
let cdir = ["-I";Filename.dirname !cfile] in
C.Flags.write_lines "test-cflags" (idir @ cdir)
)

0 comments on commit 78cad0b

Please sign in to comment.