Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[build] [wip] Support for the dune build system. #73

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ depend
z.ml
z.mli
z_features.h
_build
.merlin
22 changes: 22 additions & 0 deletions dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
(library
(name zarith)
(wrapped false)
(flags -w -6)
(library_flags -cclib -lgmp)
Copy link
Member

@kit-ty-kate kit-ty-kate Feb 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to use dune-configurator here instead, having -lgmp as a fallback.
See ocaml/opam-repository#18131 & ocaml/opam-repository#18128

(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)))
2 changes: 2 additions & 0 deletions dune-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(lang dune 2.7)
(name zarith)
25 changes: 25 additions & 0 deletions tests/dune
Original file line number Diff line number Diff line change
@@ -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)))