From 8e3da756846548eab4884f959b9f32f3b1864766 Mon Sep 17 00:00:00 2001 From: Emilio Jesus Gallego Arias Date: Thu, 17 Sep 2020 15:28:33 +0200 Subject: [PATCH] [build] Support for the dune build system. TODO: - configuration - fix warnings - run tests - opam generation? - CI? --- .gitignore | 2 ++ dune | 22 ++++++++++++++++++++++ dune-project | 2 ++ tests/dune | 25 +++++++++++++++++++++++++ 4 files changed, 51 insertions(+) create mode 100644 dune create mode 100644 dune-project create mode 100644 tests/dune diff --git a/.gitignore b/.gitignore index 1a82586..678b7d3 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ depend z.ml z.mli z_features.h +_build +.merlin diff --git a/dune b/dune new file mode 100644 index 0000000..a938ecb --- /dev/null +++ b/dune @@ -0,0 +1,22 @@ +(library + (name zarith) + (wrapped false) + (flags -w -6) + (library_flags -cclib -lgmp) + (modules q z big_int_Z) + (foreign_archives caml_z_x86_64) + (foreign_stubs + (language c) + (names caml_z) + (flags :standard -O3 -Wall -Wextra -DZ_OCAML_HASH -DZ_OCAML_COMPARE_EXT -DHAS_GMP -DZ_ELF -DZ_DOT_LABEL_PREFIX))) + +(rule + (targets libcaml_z_x86_64.a) + (action + (run gcc -DZ_OCAML_HASH -DZ_OCAML_COMPARE_EXT -DHAS_GMP -DZ_ELF -DZ_DOT_LABEL_PREFIX -c caml_z_x86_64.S -o %{targets}))) + +(rule + (targets z.ml z.mli z_features.h) + (deps z.mlp z.mlip caml_z_x86_64.S z_pp.pl) + (action + (run ./z_pp.pl x86_64))) diff --git a/dune-project b/dune-project new file mode 100644 index 0000000..73e5e94 --- /dev/null +++ b/dune-project @@ -0,0 +1,2 @@ +(lang dune 2.7) +(name zarith) diff --git a/tests/dune b/tests/dune new file mode 100644 index 0000000..e7aa126 --- /dev/null +++ b/tests/dune @@ -0,0 +1,25 @@ +(executables + (names fact ofstring pi zq) + (modules fact ofstring pi zq) + (flags -w -27) + (libraries zarith)) + +(executables + (names bi fib tak) + (modules bi fib tak) + (flags -w -35) + (libraries num zarith)) + +(executable + (name tofloat) + (modules tofloat) + (flags -w -35) + (foreign_stubs + (language c) + (names setround)) + (libraries zarith)) + +(rule + (alias runtest) + (action + (run ./tofloat.exe)))