fix link time issues

This commit is contained in:
Jules BOURDAIS 2024-12-03 01:50:09 +01:00
parent a053c039d5
commit bedb532f34
3 changed files with 31 additions and 12 deletions

View File

@ -28,6 +28,7 @@ STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
if (DEFINED EMSCRIPTEN)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_link_options("-sWARN_ON_UNDEFINED_SYMBOLS=1" "-sWASM_BIGINT=1")
list(APPEND CMAKE_FIND_ROOT_PATH "/")
message("Using Emscripten")
add_compile_options(-sUSE_BOOST_HEADERS=1 -pthread)

View File

@ -3,21 +3,22 @@ INCLUDE(${SWIG_USE_FILE})
# add_executable(smeshjs Bindings.cxx)
set_source_files_properties(smeshpy.i PROPERTIES CPLUSPLUS ON)
SWIG_ADD_LIBRARY(smeshpy LANGUAGE python SOURCES smeshpy.i)
SWIG_ADD_LIBRARY(smeshpy TYPE MODULE LANGUAGE python SOURCES smeshpy.i)
target_compile_options(${SWIG_MODULE_smeshpy_REAL_NAME} PRIVATE "-sSIDE_MODULE=2" "-Oz")
target_link_options(${SWIG_MODULE_smeshpy_REAL_NAME} PRIVATE "-sSIDE_MODULE=2" "-sEXPORTED_FUNCTIONS=_PyInit_smesh" "-sWARN_UNALIGNED=1" "-Oz")
target_compile_options(${SWIG_MODULE_smeshpy_REAL_NAME} PRIVATE "-sSIDE_MODULE=2")
target_link_options(${SWIG_MODULE_smeshpy_REAL_NAME} PRIVATE "-sSIDE_MODULE=2")
# set(CMAKE_CXX_VISIBILITY_PRESET hidden)
target_link_libraries(${SWIG_MODULE_smeshpy_REAL_NAME} PRIVATE GEOMImpl SMESHEngine)
# set_target_properties(smeshjs PROPERTIES
# OUTPUT_NAME smesh
# )
set_target_properties(${SWIG_MODULE_smeshpy_REAL_NAME} PROPERTIES
OUTPUT_NAME smesh
SWIG_USE_TARGET_INCLUDE_DIRECTORIES TRUE
)
# target_link_libraries(smeshjs PRIVATE SalomeIDLKernel GEOMImpl SMESHDS SMESHimpl StdMeshers SMESHEngine)

View File

@ -1,12 +1,29 @@
%module "smeshpy"%{
%module "smeshpy"
%{
#include "GEOMImpl_Gen.hxx"
#include "SMESHDS_Mesh.hxx"
#include "SMESH_ControlsDef.hxx"
// #include "SMESHDS_Hypothesis.hxx"
// #include "SMESH_Hypothesis.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_Mesh.hxx"
#include "StdMeshers_Hexa_3D.hxx"
#include "StdMeshers_NumberOfSegments.hxx"
#include "StdMeshers_Quadrangle_2D.hxx"
#include "StdMeshers_Regular_1D.hxx"
%}
%import "GEOM_GEOMImpl.hxx"
%import "Standard_Macro.hxx"
%import "Standard_DefineAlloc.hxx"
%import "Standard_Transient.hxx"
%import "Standard_Handle.hxx"
%import "Standard_Type.hxx"
%include "GEOMImpl_Gen.hxx"
%include "GEOM_Object.hxx"
%include "GEOMImpl_I3DPrimOperations.hxx"
%import "SMESH_SMESH.hxx"
// %import "SMESH_SMESHDS.hxx"
// %ignore SMESH_Gen::CreateParallelMesh;
// %ignore SMESH_Gen::parallelComputeSubMeshes;
// %include "SMESHDS_Hypothesis.hxx"
// %include "SMESH_Hypothesis.hxx"
%include "SMESH_Gen.hxx"