diff --git a/CMakeLists.txt b/CMakeLists.txt index 7027af5c1..c08124dfe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/src/webassembly/CMakeLists.txt b/src/webassembly/CMakeLists.txt index 446fac5b5..6ea984e97 100644 --- a/src/webassembly/CMakeLists.txt +++ b/src/webassembly/CMakeLists.txt @@ -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) diff --git a/src/webassembly/smeshpy.i b/src/webassembly/smeshpy.i index f577ac90e..81df31d79 100644 --- a/src/webassembly/smeshpy.i +++ b/src/webassembly/smeshpy.i @@ -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"