From 78cad0bcac29843c00384295b3e3b9acdabad219 Mon Sep 17 00:00:00 2001 From: Anil Madhavapeddy Date: Fri, 17 May 2019 20:21:30 +0100 Subject: [PATCH] add a common place for cflags for tests --- tests/config/dune | 10 ++++++++++ tests/config/test_config.ml | 13 +++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 tests/config/dune create mode 100644 tests/config/test_config.ml diff --git a/tests/config/dune b/tests/config/dune new file mode 100644 index 00000000..8d91f277 --- /dev/null +++ b/tests/config/dune @@ -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}))) diff --git a/tests/config/test_config.ml b/tests/config/test_config.ml new file mode 100644 index 00000000..e8fc2582 --- /dev/null +++ b/tests/config/test_config.ml @@ -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) + )