mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-15 18:14:08 +00:00
Fixes for WASM build (some temporary)
This commit is contained in:
@@ -4,12 +4,18 @@ set(geometry_serializer_plugin_runtime_dir "${CMAKE_BINARY_DIR}/serializers/$<CO
|
||||
file(GLOB SERIALIZERS_H_FILES *.h)
|
||||
file(GLOB SERIALIZERS_S_H_FILES schema_dependent/*.h)
|
||||
|
||||
if (NOT WASM_BUILD)
|
||||
# wasm-ld (?) trips up on multiple defined symbols. IfcParse already brings
|
||||
# in plugin so we skip it here.
|
||||
set(plugin_when_not_wasm plugin)
|
||||
endif()
|
||||
|
||||
function(add_document_serializer_plugin target output_name)
|
||||
cmake_parse_arguments(PLUGIN "" "" "SOURCES;LIBRARIES;DEFINITIONS" ${ARGN})
|
||||
|
||||
add_library(${target} SHARED ${PLUGIN_SOURCES})
|
||||
target_compile_definitions(${target} PRIVATE SERIALIZERS_EXPORTS BOOST_DLL_USE_STD_FS ${PLUGIN_DEFINITIONS})
|
||||
target_link_libraries(${target} PRIVATE plugin IfcGeom IfcParse ${PLUGIN_LIBRARIES})
|
||||
target_link_libraries(${target} PRIVATE ${plugin_when_not_wasm} IfcGeom IfcParse ${PLUGIN_LIBRARIES})
|
||||
set_target_properties(${target} PROPERTIES
|
||||
OUTPUT_NAME "${output_name}"
|
||||
RUNTIME_OUTPUT_DIRECTORY "${document_serializer_plugin_runtime_dir}"
|
||||
@@ -18,6 +24,13 @@ function(add_document_serializer_plugin target output_name)
|
||||
|
||||
list(APPEND document_serializer_libraries ${target})
|
||||
set(document_serializer_libraries ${document_serializer_libraries} PARENT_SCOPE)
|
||||
|
||||
if (WASM_BUILD)
|
||||
target_link_options(
|
||||
${target}
|
||||
PRIVATE "SHELL:-s -s SIDE_MODULE=1"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(add_geometry_serializer_plugin target output_name)
|
||||
@@ -25,7 +38,7 @@ function(add_geometry_serializer_plugin target output_name)
|
||||
|
||||
add_library(${target} SHARED ${PLUGIN_SOURCES})
|
||||
target_compile_definitions(${target} PRIVATE SERIALIZERS_EXPORTS BOOST_DLL_USE_STD_FS ${PLUGIN_DEFINITIONS})
|
||||
target_link_libraries(${target} PRIVATE plugin IfcGeom IfcParse ${PLUGIN_LIBRARIES})
|
||||
target_link_libraries(${target} PRIVATE ${plugin_when_not_wasm} IfcGeom IfcParse ${PLUGIN_LIBRARIES})
|
||||
if(WITH_PROJ)
|
||||
find_package(proj REQUIRED)
|
||||
target_compile_definitions(${target} PRIVATE "WITH_PROJ")
|
||||
@@ -42,6 +55,14 @@ function(add_geometry_serializer_plugin target output_name)
|
||||
|
||||
list(APPEND geometry_serializer_libraries ${target})
|
||||
set(geometry_serializer_libraries ${geometry_serializer_libraries} PARENT_SCOPE)
|
||||
|
||||
if (WASM_BUILD)
|
||||
target_link_options(
|
||||
${target}
|
||||
PRIVATE "SHELL:-s -s SIDE_MODULE=1"
|
||||
)
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
if(WITH_ROCKSDB)
|
||||
@@ -50,13 +71,15 @@ endif()
|
||||
|
||||
add_subdirectory(schema_dependent)
|
||||
|
||||
if (NOT WASM_BUILD)
|
||||
set(ttl_geometry_serializer_libraries)
|
||||
if(WITH_OPENCASCADE)
|
||||
set(ttl_geometry_serializer_libraries geometry_kernel_opencascade ${OpenCASCADE_LIBRARIES})
|
||||
endif()
|
||||
add_geometry_serializer_plugin(geometry_serializer_ttl "geometry.ttl" SOURCES geometry_ttl_plugin.cpp TtlWktSerializer.cpp LIBRARIES ${ttl_geometry_serializer_libraries})
|
||||
endif()
|
||||
|
||||
add_geometry_serializer_plugin(geometry_serializer_obj "geometry.obj" SOURCES geometry_obj_plugin.cpp WavefrontObjSerializer.cpp)
|
||||
add_geometry_serializer_plugin(geometry_serializer_ttl "geometry.ttl" SOURCES geometry_ttl_plugin.cpp TtlWktSerializer.cpp LIBRARIES ${ttl_geometry_serializer_libraries})
|
||||
|
||||
if(OPENCOLLADA_FOUND)
|
||||
add_geometry_serializer_plugin(geometry_serializer_dae "geometry.dae" SOURCES geometry_dae_plugin.cpp ColladaSerializer.cpp LIBRARIES OpenCOLLADA::OpenCOLLADA DEFINITIONS WITH_OPENCOLLADA)
|
||||
@@ -70,7 +93,7 @@ if(USD_SUPPORT)
|
||||
add_geometry_serializer_plugin(geometry_serializer_usd "geometry.usd" SOURCES geometry_usd_plugin.cpp USDSerializer.cpp LIBRARIES pxr::USD)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENCASCADE)
|
||||
if(WITH_OPENCASCADE AND NOT WASM_BUILD)
|
||||
set(opencascade_geometry_serializer_libraries geometry_kernel_opencascade ${OpenCASCADE_LIBRARIES})
|
||||
add_geometry_serializer_plugin(geometry_serializer_stp "geometry.stp" SOURCES geometry_stp_plugin.cpp OpenCascadeBasedSerializer.cpp LIBRARIES ${opencascade_geometry_serializer_libraries})
|
||||
add_geometry_serializer_plugin(geometry_serializer_igs "geometry.igs" SOURCES geometry_igs_plugin.cpp OpenCascadeBasedSerializer.cpp LIBRARIES ${opencascade_geometry_serializer_libraries})
|
||||
|
||||
Reference in New Issue
Block a user