From 8ad253f0d3ae29a0dd5c4d98ece5728957c0ae56 Mon Sep 17 00:00:00 2001 From: Thorsten Beier Date: Mon, 24 Jun 2024 10:44:06 +0200 Subject: [PATCH] documentation --- docs/development/adding_packages.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/development/adding_packages.md b/docs/development/adding_packages.md index 0e77e821a..270d0ffbd 100644 --- a/docs/development/adding_packages.md +++ b/docs/development/adding_packages.md @@ -10,6 +10,16 @@ The recipe format is described in the [rattler-build recipe format](https://gith Adding cmake based packages is easy. Usually it is enough to replace the `cmake` command with the `emcmake` command and `make` with `emmake` (see the [emscripten documentation](https://emscripten.org/docs/compiling/Building-Projects.html#integrating-with-a-build-system) for more details). +To build a shared library with CMake, one needs these additional flags: +```CMake +set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) # does not need to be global :) +set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-s SIDE_MODULE=1") +set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-s SIDE_MODULE=1") +set(CMAKE_STRIP FALSE) # used by default in pybind11 on .so modules # only for needed when using pybind11 +``` + + + **Example recipes**: * [xeus](https://github.com/emscripten-forge/recipes/tree/main/recipes/recipes_emscripten/xeus)