Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add configuration file for aeos module and update Dockerfiles (#336)
* add configuration file to aeo * update dockerfiles
- Loading branch information
1 parent
ed281a5
commit 965294c
Showing
7 changed files
with
133 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
(* | ||
* OWL - OCaml Scientific and Engineering Computing | ||
* Copyright (c) 2016-2018 Liang Wang <liang.wang@cl.cam.ac.uk> | ||
*) | ||
|
||
module C = Configurator.V1 | ||
|
||
|
||
let write_sexp fn sexp = | ||
Stdio.Out_channel.write_all fn ~data:(Sexplib.Sexp.to_string sexp) | ||
|
||
|
||
let get_os_type c = | ||
let sys = C.ocaml_config_var c "system" in | ||
match sys with Some s -> s | None -> "" | ||
|
||
|
||
let get_default_cflags _c = [ | ||
"-g"; "-O3"; "-Ofast"; | ||
"-march=native"; "-funroll-loops"; "-ffast-math"; | ||
"-DSFMT_MEXP=19937"; "-fno-strict-aliasing"; | ||
] | ||
|
||
|
||
let get_openmp_cflags c = | ||
match get_os_type c with | ||
| "linux" -> [ "-fopenmp" ] | ||
| "linux_elf" -> [ "-fopenmp" ] | ||
| "macosx" -> [ "-Xpreprocessor"; "-fopenmp" ] | ||
| "mingw64" -> [ "-fopenmp" ] | ||
| _ -> [] | ||
|
||
|
||
let get_default_libs () = ["-lm";] | ||
|
||
|
||
let get_openmp_libs c = | ||
match get_os_type c with | ||
| "linux" -> [ "-lgomp" ] | ||
| "linux_elf" -> [ "-lgomp" ] | ||
| "macosx" -> [ "-lomp" ] | ||
| "mingw64" -> [ "-lgomp" ] | ||
| _ -> [] | ||
|
||
|
||
let () = | ||
C.main ~name:"aeos" (fun c -> | ||
|
||
(* configure link options *) | ||
let libs = [] | ||
@ get_default_libs () | ||
@ get_openmp_libs c | ||
in | ||
|
||
(* configure compile options *) | ||
let cflags = [] | ||
@ get_default_cflags c | ||
@ get_openmp_cflags c | ||
in | ||
|
||
(* assemble default config *) | ||
let conf : C.Pkg_config.package_conf = { cflags; libs } in | ||
|
||
write_sexp "aeos_c_flags.sexp" Sexplib.Std.(sexp_of_list sexp_of_string conf.cflags); | ||
write_sexp "aeos_c_library_flags.sexp" Sexplib.Std.(sexp_of_list sexp_of_string conf.libs); | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
(executable | ||
(name configure) | ||
(libraries | ||
dune.configurator | ||
sexplib | ||
stdio | ||
)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters