Skip to content

Commit 226581f

Browse files
committed
build-all.py - provide exported functions to target explicitly
Otherwise it broke compilation in some cases when cmake would try to test that linker is working.
1 parent e833d0c commit 226581f

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

nix/build-all.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,7 @@ def get_cmake_args_prefix_path(additional_paths: "Sequence[str]" = ()) -> "list[
14091409
ADDITIONAL_ARGS = "-Wl,-flat_namespace,-undefined,suppress"
14101410

14111411
if "wasm" in flags:
1412-
ADDITIONAL_ARGS = f"-Wl,-undefined,suppress -sSIDE_MODULE=2 -sEXPORTED_FUNCTIONS=_PyInit__ifcopenshell_wrapper"
1412+
ADDITIONAL_ARGS = "-Wl,-undefined,suppress -sSIDE_MODULE=2"
14131413

14141414
# NOTE: We don't use `CXXFLAGS` for wrappers, so wrapper is compiled with different flags
14151415
# (e.g. ` -fdata-sections` is missing, which is set by default for executables)

src/ifcwrap/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ set(SWIG_MODULE_ifcopenshell_wrapper_EXTRA_FLAGS "-interface" "_ifcopenshell_wra
8888

8989
swig_add_library(ifcopenshell_wrapper LANGUAGE python SOURCES IfcPython.i)
9090
SET_PROPERTY(TARGET ${SWIG_MODULE_ifcopenshell_wrapper_REAL_NAME} PROPERTY SWIG_DEPENDS ${IFCOPENSHELL_LIBRARIES})
91+
if (WASM_BUILD)
92+
target_link_options(${SWIG_MODULE_ifcopenshell_wrapper_REAL_NAME} PRIVATE "-sEXPORTED_FUNCTIONS=_PyInit__ifcopenshell_wrapper")
93+
endif()
9194
if("$ENV{LDFLAGS}" MATCHES ".undefined.suppress")
9295
# On osx there is some state in the python dylib. With `-Wl,undefined,suppress` we can ignore the missing symbols at compile time.
9396
SWIG_LINK_LIBRARIES(ifcopenshell_wrapper ${IFCOPENSHELL_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${Boost_LIBRARIES} ${LIBSVGFILL})

0 commit comments

Comments
 (0)