-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use dune-configurator to set C flags (#216)
* Use dune-configurator to set C flags * Upgrade to dune language version 3.0 This automatically has the `(use_standard_c_and_cxx_flags true)` set. * add dune-configurator * dune-configurator in dune-project * wip * fmt --------- Co-authored-by: Antonio Nuno Monteiro <[email protected]>
- Loading branch information
1 parent
5b2f446
commit 6c310f3
Showing
7 changed files
with
50 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module C = Configurator.V1 | ||
|
||
let directory_exists fsp = Sys.file_exists fsp && Sys.is_directory fsp | ||
|
||
let default c : C.Pkg_config.package_conf = | ||
if C.ocaml_config_var_exn c "system" = "macosx" | ||
then | ||
if directory_exists "/usr/local/opt/openssl" | ||
then | ||
{ libs = [ "-L/usr/local/opt/openssl/lib" ] | ||
; cflags = [ "-I/usr/local/opt/openssl/include" ] | ||
} | ||
else { libs = [ "-L/opt/local/lib" ]; cflags = [ "-I/opt/local/include" ] } | ||
else { libs = [ "-lssl"; "-lcrypto" ]; cflags = [] } | ||
|
||
let () = | ||
C.main ~name:"ssl" (fun c -> | ||
let default = default c in | ||
let conf = | ||
match C.Pkg_config.get c with | ||
| None -> default | ||
| Some pc -> | ||
(match C.Pkg_config.query pc ~package:"openssl" with | ||
| Some s -> s | ||
| None -> default) | ||
in | ||
C.Flags.write_sexp "c_library_flags.sexp" conf.libs; | ||
C.Flags.write_sexp "c_flags.sexp" conf.cflags) |
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,3 @@ | ||
(executable | ||
(name cflags) | ||
(libraries dune-configurator)) |
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 |
---|---|---|
|
@@ -94,6 +94,7 @@ let | |
dune | ||
findlib | ||
ocamlformat | ||
dune-configurator | ||
]); | ||
doCheck = true; | ||
checkPhase = '' | ||
|
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