From b8b239c644223f16b3c69e15f40abfaeacc0df93 Mon Sep 17 00:00:00 2001 From: caleb Date: Sat, 2 Dec 2023 22:53:46 +0300 Subject: [PATCH] crates/capi: Add Linux build instructions --- crates/zune-capi/README.md | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/crates/zune-capi/README.md b/crates/zune-capi/README.md index 05b439cb..0f647130 100644 --- a/crates/zune-capi/README.md +++ b/crates/zune-capi/README.md @@ -14,8 +14,6 @@ simply copy the dlls and add `-lzil_c` to your linker to link the libraries, aft `*.dll` files to run - - ### API Details All api callings are prefixed by `zil_` and all structs are prefixed by `Z` so to read @@ -55,9 +53,13 @@ that was ## Building +To generate the header file, you need `cbindgen` -### Windows +First `cd` into the directory + +Then Run `cargo install cbindgen` and then run `cbindgenn . -o ./include/zil.h` +### Windows To build the library on windows, it is recommended to use `stable-x86_64-pc-windows-gnu` and not `stable-x86_64-pc-windows-msvc` due to linker errors that may occur when trying to link the dll @@ -82,6 +84,22 @@ note: native-static-libs: -lkernel32 -ladvapi32 -lbcrypt -lkernel32 -lntdll -lus You are to add the linker options to the linker you will be using for linking the dll. +### Linux + +We follow the same steps from windows but now change the linker arguments + +1. `cd ` into the directory +2. Run `RUSTFLAGS="--print native-static-libs" cargo build --release` + +The current output (as of December 2023) is + +```text +note: Link against the following native artifacts when linking against this static library. The order and any duplication can be significant on some platforms. + +note: native-static-libs: -lgcc_s -lutil -lrt -lpthread -lm -ldl -lc +``` + +Add those to the linker options for the library you are using ## Running