diff --git a/Makefile b/Makefile index 4ec12fb5..2920e93a 100644 --- a/Makefile +++ b/Makefile @@ -266,7 +266,7 @@ else ifeq ($(detected_OS),Windows) $(ENV_SCRIPT) nim libcodexDynamic $(NIM_PARAMS) -d:LeopardCmakeFlags="\"-G \\\"MSYS Makefiles\\\" -DCMAKE_BUILD_TYPE=Release\"" codex.nims else ifeq ($(detected_OS),macOS) echo -e $(BUILD_MSG) "build/$@.dylib" && \ - $(ENV_SCRIPT) nim libcodexDynamic $(NIM_PARAMS) -d:LeopardCmakeFlags="\"-DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release\"" codex.nims + $(ENV_SCRIPT) nim libcodexDynamic $(NIM_PARAMS) -d:LeopardCmakeFlags="\"-DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release\"" --passL:"-install_name @rpath/libs/libcodex.dylib" codex.nims else echo -e $(BUILD_MSG) "build/$@.so" && \ $(ENV_SCRIPT) nim libcodexDynamic $(NIM_PARAMS) -d:LeopardCmakeFlags="\"-DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release\"" codex.nims diff --git a/README.md b/README.md index 97139bee..ae831276 100644 --- a/README.md +++ b/README.md @@ -91,10 +91,6 @@ Run the example: By default, Codex builds a dynamic library (`libcodex.so`), which you can load at runtime. If you prefer a static library (`libcodex.a`), set the `STATIC` flag: -### Limitation - -Callbacks must be fast and non-blocking; otherwise, the working thread will hang and prevent other requests from being processed. - ```bash # Build dynamic (default) make libcodex @@ -103,6 +99,25 @@ make libcodex make STATIC=1 libcodex ``` +### Limitation + +Callbacks must be fast and non-blocking; otherwise, the working thread will hang and prevent other requests from being processed. + +### Platform specific + +On macOS, the library is built with `-install_name @rpath/libs/libcodex.dylib` to have the `libs` folder as default +path for the artifacts. This can be updates by the application consuming the library using: + +```sh +install_name_tool -id @rpath/libcodex.dylib $(CUSTOM_FOLDER)/libcodex.dylib +``` + +Or when running the executable: + +```sh +DYLD_LIBRARY_PATH=$(CUSTOM_FOLDER) ./app +``` + ## Contributing and development Feel free to dive in, contributions are welcomed! Open an issue or submit PRs.