forked from dsheets/ocaml-sodium
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from apeschar/pkg-config
Use pkg-config to discover libsodium
- Loading branch information
Showing
4 changed files
with
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module C = Configurator.V1 | ||
|
||
let () = | ||
C.main ~name:"sodium" (fun c -> | ||
let default : C.Pkg_config.package_conf = | ||
{ libs = [ "-lsodium" ]; cflags = [] } | ||
in | ||
let conf = | ||
match C.Pkg_config.get c with | ||
| None -> default | ||
| Some pc -> ( | ||
match C.Pkg_config.query pc ~package:"libsodium" with | ||
| None -> default | ||
| Some deps -> deps) | ||
in | ||
C.Flags.write_sexp "c_flags.sexp" conf.cflags; | ||
C.Flags.write_sexp "c_library_flags.sexp" 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 discover) | ||
(libraries dune-configurator)) | ||
|
||
(rule | ||
(targets c_flags.sexp c_library_flags.sexp) | ||
(action (run ./discover.exe))) |
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