aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2024-10-16 21:18:15 -0300
committerMarcos Magueta <maguetamarcos@gmail.com>2024-10-16 21:18:15 -0300
commit547460e087336f1fbe52d64b77ddee9fdb26abc4 (patch)
tree0b634110738ca433f101d32e465328a3bf4179d5
parente339fa975e21c1b589a8dfc6ac083aba2b0a6394 (diff)
downloadSakura-547460e087336f1fbe52d64b77ddee9fdb26abc4.tar.gz
Sakura-547460e087336f1fbe52d64b77ddee9fdb26abc4.zip
dune build with foreign stubs
Diffstat (limited to '')
-rw-r--r--dune-project2
-rw-r--r--flake.nix9
-rw-r--r--lib/dune37
3 files changed, 38 insertions, 10 deletions
diff --git a/dune-project b/dune-project
index 14a604b..3e80424 100644
--- a/dune-project
+++ b/dune-project
@@ -1,5 +1,7 @@
(lang dune 3.16)
+;; (using ctypes 0.3)
+
(name relational_engine)
(generate_opam_files true)
diff --git a/flake.nix b/flake.nix
index d48082d..b6f2165 100644
--- a/flake.nix
+++ b/flake.nix
@@ -29,8 +29,6 @@
ocamlPackages = legacyPackages.ocamlPackages;
# Library functions from nixpkgs
lib = legacyPackages.lib;
- systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
- forAllSystems = f: builtins.listToAttrs (map (name: { inherit name; value = f name; }) systems);
merklecpp = legacyPackages.callPackage ./deps/merklecpp.nix {};
libressl = legacyPackages.callPackage ./deps/libressl.nix {};
@@ -199,6 +197,13 @@
#
devShells = {
default = legacyPackages.mkShell {
+
+ env = {
+ MERKLECPP_INCLUDE_PATH="${merklecpp}/include";
+ LIBRESSL_INCLUDE_PATH="${libressl}/include";
+ LIBRESSL_LIB_PATH="${libressl}/lib";
+ };
+
# Development tools
packages = [
# Source file formatting
diff --git a/lib/dune b/lib/dune
index 3bc492f..bdde443 100644
--- a/lib/dune
+++ b/lib/dune
@@ -1,10 +1,31 @@
(library
(name relational_engine)
- (foreign_stubs
- (language cxx)
- (names merklecpp_stubs)
- (flags
- (:standard -lssl -lcrypto)
- (-L %{env:LIBRESSL_LIB_PATH=})
- (-I %{env:LIBRESSL_INCLUDE_PATH=})
- (-I %{env:MERKLECPP_INCLUDE_PATH=}))))
+ (libraries ctypes ctypes-foreign)
+ (modes native)
+ (foreign_stubs
+ (language cxx)
+ (names merklecpp_stubs)
+ (flags
+ (:standard -lssl -lcrypto)
+ (-L %{env:LIBRESSL_LIB_PATH=})
+ (-I %{env:LIBRESSL_INCLUDE_PATH=})
+ (-I %{env:MERKLECPP_INCLUDE_PATH=})))
+
+ ;; (ctypes
+ ;; (external_library_name merklecpp_stub)
+ ;; (headers (include "/Users/mmagueta/CLionProjects/merklecpp_stub/library.h"))
+ ;; (build_flags_resolver
+ ;; (vendored
+ ;; (c_flags
+ ;; -L %{env:MERKLECPP_LIB_PATH=})))
+ ;; (type_description
+ ;; (instance Types)
+ ;; (functor Type_description))
+ ;; (function_description
+ ;; (concurrency unlocked)
+ ;; (instance Functions)
+ ;; (functor Function_description))
+ ;; (generated_types Types_generated)
+ ;; (generated_entry_point C))
+
+ )