chore: update dune to use dune-config

This commit is contained in:
Simon Cruanes 2018-08-15 13:38:58 -05:00
parent 5f521f6fa2
commit 13fe66c968
3 changed files with 23 additions and 15 deletions

View file

@ -4,6 +4,6 @@
(public_name containers)
(wrapped false)
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string -nolabels -open CCMonomorphic))
(ocamlopt_flags (:standard (:include ../flambda.flags)))
(ocamlopt_flags ((:include ../flambda.flags)))
(libraries (result uchar containers.monomorphic))
))

View file

@ -1,10 +1,12 @@
(executable
((name mkflags)
(libraries (dune.configurator))))
(rule
((targets (flambda.flags))
(deps ((file mkflags.ml)))
(fallback)
(action
(run ocaml ./mkflags.ml))
(run ./mkflags.exe))
))

View file

@ -1,13 +1,19 @@
module C = Configurator.V1
let () =
let major, minor =
Scanf.sscanf Sys.ocaml_version "%u.%u"
(fun major minor -> major, minor)
in
let after_4_3 = (major, minor) >= (4, 3) in
let flags_file = open_out "flambda.flags" in
if after_4_3 then (
output_string flags_file "(-O3 -unbox-closures -unbox-closures-factor 20 -color always)\n";
) else (
output_string flags_file "()\n";
);
close_out flags_file
C.main ~name:"mkflags" (fun c ->
let version = C.ocaml_config_var_exn c "version" in
let major, minor =
Scanf.sscanf version "%u.%u"
(fun major minor -> major, minor)
in
let after_4_3 = (major, minor) >= (4, 3) in
let sexp =
if after_4_3 then (
["-O3"; "-unbox-closures"; "-unbox-closures-factor"; "20"; "-color"; "always"]
) else (
[]
) in
C.Flags.write_sexp "flambda.flags" sexp
)