SIDE_MODULE=2 for plug-ins

This commit is contained in:
Thomas Krijnen
2026-05-05 21:42:39 +02:00
parent 3b3ed47e89
commit ea4747ccb1
10 changed files with 48 additions and 62 deletions
@@ -9,6 +9,10 @@ foreach(schema ${SCHEMA_VERSIONS})
RUNTIME_OUTPUT_DIRECTORY "${geometry_serialization_plugin_runtime_dir}"
LIBRARY_OUTPUT_DIRECTORY "${geometry_serialization_plugin_runtime_dir}"
)
ifcopenshell_wasm_plugin_link_options(
geometry_serializer_ifc${schema}
ifcopenshell_register_opencascade_geometry_ifc_writer_plugin_v1
)
list(APPEND geometry_serializer_libraries geometry_serializer_ifc${schema})
endforeach()
set(geometry_serializer_libraries ${geometry_serializer_libraries} PARENT_SCOPE)
+6 -31
View File
@@ -23,11 +23,10 @@ foreach(kernel ${GEOMETRY_KERNELS})
set(KERNEL_TARGET "geometry_kernel_${kernel}")
add_library(${KERNEL_TARGET} SHARED ${IFCGEOM_FILES})
if (WASM_BUILD)
target_link_options(
${KERNEL_TARGET}
PRIVATE "SHELL:-s -s SIDE_MODULE=1"
)
if(${kernel} STREQUAL "opencascade")
ifcopenshell_wasm_plugin_link_options(${KERNEL_TARGET} ifcopenshell_register_kernel_plugin_v1 OPTIMIZATION -O0)
else()
ifcopenshell_wasm_plugin_link_options(${KERNEL_TARGET} ifcopenshell_register_kernel_plugin_v1)
endif()
set_target_properties(${KERNEL_TARGET} PROPERTIES
@@ -39,26 +38,6 @@ foreach(kernel ${GEOMETRY_KERNELS})
list(APPEND kernel_libraries ${KERNEL_TARGET})
target_link_libraries(${KERNEL_TARGET} PRIVATE ${plugin_when_not_wasm} IfcGeom ${${KERNEL_UPPER}_LIBRARIES} Eigen3::Eigen)
if (WASM_BUILD AND ${kernel} STREQUAL "opencascade")
# Try to disable wasm-opt:
#
# 2026-04-25T09:53:53.3073297Z [parse exception: popping from empty stack (at
# 0:32668981)] 2026-04-25T09:53:53.3073431Z Fatal: error parsing wasm (try
# --debug for more info) 2026-04-25T09:53:53.3075545Z em++: error:
# '/home/runner/.cache/.pyodide-xbuildenv-0.33.0/0.29.3/emsdk/upstream/bin/wasm-opt
# --strip-target-features --post-emscripten
# --pass-arg=post-emscripten-side-module -O3 --low-memory-unused
# --pass-arg=directize-initial-contents-immutable --no-stack-ir
# ../Release/libgeometry.kernel.opencascade.so -o
# ../Release/libgeometry.kernel.opencascade.so --mvp-features
# --enable-bulk-memory --enable-bulk-memory-opt --enable-call-indirect-overlong
# --enable-exception-handling --enable-multivalue --enable-mutable-globals
# --enable-nontrapping-float-to-int --enable-reference-types --enable-sign-ext'
# failed (returned 1)
target_link_options(${KERNEL_TARGET} PRIVATE -O0)
endif()
install(TARGETS ${KERNEL_TARGET})
if(${kernel} STREQUAL "cgal")
@@ -67,12 +46,7 @@ foreach(kernel ${GEOMETRY_KERNELS})
set(KERNEL_TARGET_SIMPLE "${KERNEL_TARGET}_simple")
add_library(${KERNEL_TARGET_SIMPLE} SHARED ${IFCGEOM_FILES})
if (WASM_BUILD)
target_link_options(
${KERNEL_TARGET_SIMPLE}
PRIVATE "SHELL:-s -s SIDE_MODULE=1"
)
endif()
ifcopenshell_wasm_plugin_link_options(${KERNEL_TARGET_SIMPLE} ifcopenshell_register_kernel_plugin_v1)
set_target_properties(${KERNEL_TARGET_SIMPLE} PROPERTIES
COMPILE_FLAGS "-DIFC_GEOMLIBRARY_EXPORTS -DIFOPSH_SIMPLE_KERNEL -DCGAL_HAS_THREADS"
@@ -108,6 +82,7 @@ foreach(kernel ${GEOMETRY_KERNELS})
)
list(APPEND tree_libraries ${TREE_TARGET})
target_link_libraries(${TREE_TARGET} PRIVATE plugin IfcGeom geometry_kernel_opencascade ${OpenCASCADE_LIBRARIES} Eigen3::Eigen)
ifcopenshell_wasm_plugin_link_options(${TREE_TARGET} ifcopenshell_register_tree_plugin_v1)
install(TARGETS ${TREE_TARGET})
endforeach()
endif()
+1 -6
View File
@@ -22,12 +22,7 @@ foreach(schema ${SCHEMA_VERSIONS})
LIBRARY_OUTPUT_DIRECTORY "${mapping_plugin_runtime_dir}"
)
if (WASM_BUILD)
target_link_options(
geometry_mapping_ifc${schema}
PRIVATE "SHELL:-s -s SIDE_MODULE=1"
)
endif()
ifcopenshell_wasm_plugin_link_options(geometry_mapping_ifc${schema} ifcopenshell_register_mapping_plugin_v1)
target_link_libraries(geometry_mapping_ifc${schema} PRIVATE ${plugin_when_not_wasm} IfcGeom IfcParse Eigen3::Eigen)