mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-27 18:00:34 +05:00
try SWIG wrappers approach to bypass CORBA infrastructure
- do not link OCCT TKXMesh because of duplicate symbols
This commit is contained in:
parent
9ae5c9d8d8
commit
a053c039d5
@ -27,6 +27,7 @@ PROJECT(SalomeSMESH C CXX)
|
|||||||
STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
|
STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
|
||||||
|
|
||||||
if (DEFINED EMSCRIPTEN)
|
if (DEFINED EMSCRIPTEN)
|
||||||
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
list(APPEND CMAKE_FIND_ROOT_PATH "/")
|
list(APPEND CMAKE_FIND_ROOT_PATH "/")
|
||||||
message("Using Emscripten")
|
message("Using Emscripten")
|
||||||
add_compile_options(-sUSE_BOOST_HEADERS=1 -pthread)
|
add_compile_options(-sUSE_BOOST_HEADERS=1 -pthread)
|
||||||
@ -67,7 +68,7 @@ ENDIF(EXISTS ${KERNEL_ROOT_DIR})
|
|||||||
# ==============
|
# ==============
|
||||||
INCLUDE(SalomeSetupPlatform) # From KERNEL
|
INCLUDE(SalomeSetupPlatform) # From KERNEL
|
||||||
# Always build libraries as shared objects:
|
# Always build libraries as shared objects:
|
||||||
SET(BUILD_SHARED_LIBS TRUE)
|
SET(BUILD_SHARED_LIBS FALSE)
|
||||||
|
|
||||||
# User options
|
# User options
|
||||||
# ============
|
# ============
|
||||||
@ -131,10 +132,11 @@ FIND_PACKAGE(SalomeSWIG REQUIRED)
|
|||||||
# Boost
|
# Boost
|
||||||
# CORBA
|
# CORBA
|
||||||
FIND_PACKAGE(SalomeOmniORB REQUIRED)
|
FIND_PACKAGE(SalomeOmniORB REQUIRED)
|
||||||
|
IF(DEFINED EMSCRIPTEN)
|
||||||
|
LIST(TRANSFORM OMNIORB_LIBRARIES REPLACE "\.so$" "\.a")
|
||||||
|
ELSE()
|
||||||
FIND_PACKAGE(SalomeOmniORBPy REQUIRED)
|
FIND_PACKAGE(SalomeOmniORBPy REQUIRED)
|
||||||
# IF(DEFINED EMSCRIPTEN)
|
ENDIF()
|
||||||
# LIST(TRANSFORM OMNIORB_LIBRARIES REPLACE "\.so$" "\.a")
|
|
||||||
# ENDIF()
|
|
||||||
|
|
||||||
# LibXml2
|
# LibXml2
|
||||||
FIND_PACKAGE(SalomeLibXml2 REQUIRED)
|
FIND_PACKAGE(SalomeLibXml2 REQUIRED)
|
||||||
|
@ -38,7 +38,8 @@ ADD_DEFINITIONS(
|
|||||||
SET(_link_LIBRARIES
|
SET(_link_LIBRARIES
|
||||||
${OpenCASCADE_FoundationClasses_LIBRARIES}
|
${OpenCASCADE_FoundationClasses_LIBRARIES}
|
||||||
${OpenCASCADE_ModelingData_LIBRARIES}
|
${OpenCASCADE_ModelingData_LIBRARIES}
|
||||||
${OpenCASCADE_ModelingAlgorithms_LIBRARIES}
|
# ${OpenCASCADE_ModelingAlgorithms_LIBRARIES}
|
||||||
|
TKGeomAlgo TKTopAlgo TKPrim TKBO TKShHealing TKBool TKHLR TKFillet TKOffset TKFeat TKMesh
|
||||||
${GEOM_GEOMUtils}
|
${GEOM_GEOMUtils}
|
||||||
SMDS
|
SMDS
|
||||||
SMESHDS
|
SMESHDS
|
||||||
|
@ -38,7 +38,8 @@ ADD_DEFINITIONS(
|
|||||||
SET(_link_LIBRARIES
|
SET(_link_LIBRARIES
|
||||||
${KERNEL_OpUtil}
|
${KERNEL_OpUtil}
|
||||||
${OpenCASCADE_FoundationClasses_LIBRARIES}
|
${OpenCASCADE_FoundationClasses_LIBRARIES}
|
||||||
${OpenCASCADE_ModelingAlgorithms_LIBRARIES}
|
# ${OpenCASCADE_ModelingAlgorithms_LIBRARIES}
|
||||||
|
TKGeomAlgo TKTopAlgo TKPrim TKBO TKShHealing TKBool TKHLR TKFillet TKOffset TKFeat TKMesh
|
||||||
SMESHDS
|
SMESHDS
|
||||||
SMESHUtils
|
SMESHUtils
|
||||||
)
|
)
|
||||||
|
@ -39,7 +39,8 @@ ADD_DEFINITIONS(
|
|||||||
SET(_link_LIBRARIES
|
SET(_link_LIBRARIES
|
||||||
${OpenCASCADE_FoundationClasses_LIBRARIES}
|
${OpenCASCADE_FoundationClasses_LIBRARIES}
|
||||||
${OpenCASCADE_DataExchange_LIBRARIES}
|
${OpenCASCADE_DataExchange_LIBRARIES}
|
||||||
${OpenCASCADE_ModelingAlgorithms_LIBRARIES}
|
# ${OpenCASCADE_ModelingAlgorithms_LIBRARIES}
|
||||||
|
TKGeomAlgo TKTopAlgo TKPrim TKBO TKShHealing TKBool TKHLR TKFillet TKOffset TKFeat TKMesh
|
||||||
${KERNEL_SALOMEBasics}
|
${KERNEL_SALOMEBasics}
|
||||||
MeshDriver
|
MeshDriver
|
||||||
SMDS
|
SMDS
|
||||||
@ -53,7 +54,8 @@ SET(_link_LIBRARIES_bin
|
|||||||
${KERNEL_SalomeIDLKERNEL}
|
${KERNEL_SalomeIDLKERNEL}
|
||||||
${OpenCASCADE_FoundationClasses_LIBRARIES}
|
${OpenCASCADE_FoundationClasses_LIBRARIES}
|
||||||
${OpenCASCADE_DataExchange_LIBRARIES}
|
${OpenCASCADE_DataExchange_LIBRARIES}
|
||||||
${OpenCASCADE_ModelingAlgorithms_LIBRARIES}
|
# ${OpenCASCADE_ModelingAlgorithms_LIBRARIES}
|
||||||
|
TKGeomAlgo TKTopAlgo TKPrim TKBO TKShHealing TKBool TKHLR TKFillet TKOffset TKFeat TKMesh
|
||||||
MeshDriver
|
MeshDriver
|
||||||
SMDS
|
SMDS
|
||||||
)
|
)
|
||||||
|
@ -55,7 +55,8 @@ ENDIF(SALOME_SMESH_USE_CGNS)
|
|||||||
|
|
||||||
# libraries to link to
|
# libraries to link to
|
||||||
SET(_link_LIBRARIES
|
SET(_link_LIBRARIES
|
||||||
${OpenCASCADE_ModelingAlgorithms_LIBRARIES}
|
# ${OpenCASCADE_ModelingAlgorithms_LIBRARIES}
|
||||||
|
TKGeomAlgo TKTopAlgo TKPrim TKBO TKShHealing TKBool TKHLR TKFillet TKOffset TKFeat TKMesh
|
||||||
${OpenCASCADE_ModelingData_LIBRARIES}
|
${OpenCASCADE_ModelingData_LIBRARIES}
|
||||||
${OpenCASCADE_ApplicationFramework_LIBRARIES}
|
${OpenCASCADE_ApplicationFramework_LIBRARIES}
|
||||||
${GEOM_NMTTools}
|
${GEOM_NMTTools}
|
||||||
|
@ -34,7 +34,8 @@ ADD_DEFINITIONS(
|
|||||||
|
|
||||||
# libraries to link to
|
# libraries to link to
|
||||||
SET(_link_LIBRARIES
|
SET(_link_LIBRARIES
|
||||||
${OpenCASCADE_ModelingAlgorithms_LIBRARIES}
|
# ${OpenCASCADE_ModelingAlgorithms_LIBRARIES}
|
||||||
|
TKGeomAlgo TKTopAlgo TKPrim TKBO TKShHealing TKBool TKHLR TKFillet TKOffset TKFeat TKMesh
|
||||||
${OpenCASCADE_FoundationClasses_LIBRARIES}
|
${OpenCASCADE_FoundationClasses_LIBRARIES}
|
||||||
${OpenCASCADE_ModelingData_LIBRARIES}
|
${OpenCASCADE_ModelingData_LIBRARIES}
|
||||||
${Boost_LIBRARIES}
|
${Boost_LIBRARIES}
|
||||||
|
@ -75,9 +75,10 @@ SET(_link_LIBRARIES
|
|||||||
${KERNEL_SalomeKernelHelpers}
|
${KERNEL_SalomeKernelHelpers}
|
||||||
${KERNEL_SalomeDS}
|
${KERNEL_SalomeDS}
|
||||||
${KERNEL_SalomeCatalog}
|
${KERNEL_SalomeCatalog}
|
||||||
${PYTHON_LIBRARIES}
|
# ${PYTHON_LIBRARIES}
|
||||||
${OpenCASCADE_ApplicationFramework_LIBRARIES}
|
${OpenCASCADE_ApplicationFramework_LIBRARIES}
|
||||||
${OpenCASCADE_ModelingAlgorithms_LIBRARIES}
|
# ${OpenCASCADE_ModelingAlgorithms_LIBRARIES}
|
||||||
|
TKGeomAlgo TKTopAlgo TKPrim TKBO TKShHealing TKBool TKHLR TKFillet TKOffset TKFeat TKMesh
|
||||||
${GEOM_GEOMClient}
|
${GEOM_GEOMClient}
|
||||||
${GEOM_SalomeIDLGEOM}
|
${GEOM_SalomeIDLGEOM}
|
||||||
VTK::IOLegacy
|
VTK::IOLegacy
|
||||||
|
@ -52,7 +52,9 @@ ENDIF(SALOME_SMESH_USE_TBB)
|
|||||||
SET(_link_LIBRARIES
|
SET(_link_LIBRARIES
|
||||||
${KERNEL_SALOMELocalTrace}
|
${KERNEL_SALOMELocalTrace}
|
||||||
${KERNEL_OpUtil}
|
${KERNEL_OpUtil}
|
||||||
${OpenCASCADE_ModelingAlgorithms_LIBRARIES}
|
# ${OpenCASCADE_ModelingAlgorithms_LIBRARIES}
|
||||||
|
TKGeomAlgo TKTopAlgo TKPrim TKBO TKShHealing TKBool TKHLR TKFillet TKOffset TKFeat TKMesh
|
||||||
|
|
||||||
${OpenCASCADE_ModelingData_LIBRARIES}
|
${OpenCASCADE_ModelingData_LIBRARIES}
|
||||||
${GEOM_GEOMUtils}
|
${GEOM_GEOMUtils}
|
||||||
SMESHimpl
|
SMESHimpl
|
||||||
|
@ -57,7 +57,8 @@ ADD_DEFINITIONS(
|
|||||||
# libraries to link to
|
# libraries to link to
|
||||||
SET(_link_LIBRARIES
|
SET(_link_LIBRARIES
|
||||||
${OpenCASCADE_FoundationClasses_LIBRARIES}
|
${OpenCASCADE_FoundationClasses_LIBRARIES}
|
||||||
${OpenCASCADE_ModelingAlgorithms_LIBRARIES}
|
# ${OpenCASCADE_ModelingAlgorithms_LIBRARIES}
|
||||||
|
TKGeomAlgo TKTopAlgo TKPrim TKBO TKShHealing TKBool TKHLR TKFillet TKOffset TKFeat TKMesh
|
||||||
${QWT_LIBRARY}
|
${QWT_LIBRARY}
|
||||||
SalomeIDLSMESH
|
SalomeIDLSMESH
|
||||||
SMESHFiltersSelection
|
SMESHFiltersSelection
|
||||||
|
@ -1,14 +1,43 @@
|
|||||||
add_executable(smeshjs Bindings.cxx)
|
INCLUDE(${SWIG_USE_FILE})
|
||||||
|
|
||||||
set_target_properties(smeshjs PROPERTIES
|
# add_executable(smeshjs Bindings.cxx)
|
||||||
|
|
||||||
|
set_source_files_properties(smeshpy.i PROPERTIES CPLUSPLUS ON)
|
||||||
|
|
||||||
|
SWIG_ADD_LIBRARY(smeshpy TYPE MODULE LANGUAGE python SOURCES smeshpy.i)
|
||||||
|
|
||||||
|
target_compile_options(${SWIG_MODULE_smeshpy_REAL_NAME} PRIVATE "-sSIDE_MODULE=2")
|
||||||
|
target_link_options(${SWIG_MODULE_smeshpy_REAL_NAME} PRIVATE "-sSIDE_MODULE=2")
|
||||||
|
|
||||||
|
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
|
OUTPUT_NAME smesh
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(smeshjs PRIVATE SalomeIDLKernel GEOMImpl SMESHDS SMESHimpl StdMeshers SMESHEngine)
|
# target_link_libraries(smeshjs PRIVATE SalomeIDLKernel GEOMImpl SMESHDS SMESHimpl StdMeshers SMESHEngine)
|
||||||
target_include_directories(smeshjs PRIVATE
|
# target_include_directories(smeshjs PRIVATE
|
||||||
|
# ${OpenCASCADE_INCLUDE_DIR}
|
||||||
|
# ${KERNEL_INCLUDE_DIRS}
|
||||||
|
# ${KERNEL_INCLUDE_DIRS}
|
||||||
|
# ${MEDFILE_INCLUDE_DIRS}
|
||||||
|
# ${MEDCOUPLING_INCLUDE_DIRS}
|
||||||
|
# ${PROJECT_SOURCE_DIR}/src/Controls
|
||||||
|
# ${PROJECT_SOURCE_DIR}/src/SMDS
|
||||||
|
# ${PROJECT_SOURCE_DIR}/src/SMESH
|
||||||
|
# ${PROJECT_SOURCE_DIR}/src/SMESHDS
|
||||||
|
# ${PROJECT_SOURCE_DIR}/src/StdMeshers
|
||||||
|
# ${PROJECT_SOURCE_DIR}/src/SMESHUtils
|
||||||
|
# )
|
||||||
|
|
||||||
|
target_include_directories(${SWIG_MODULE_smeshpy_REAL_NAME} PRIVATE
|
||||||
${OpenCASCADE_INCLUDE_DIR}
|
${OpenCASCADE_INCLUDE_DIR}
|
||||||
${KERNEL_INCLUDE_DIRS}
|
${KERNEL_INCLUDE_DIRS}
|
||||||
${KERNEL_INCLUDE_DIRS}
|
|
||||||
${MEDFILE_INCLUDE_DIRS}
|
${MEDFILE_INCLUDE_DIRS}
|
||||||
${MEDCOUPLING_INCLUDE_DIRS}
|
${MEDCOUPLING_INCLUDE_DIRS}
|
||||||
${PROJECT_SOURCE_DIR}/src/Controls
|
${PROJECT_SOURCE_DIR}/src/Controls
|
||||||
@ -17,42 +46,49 @@ target_include_directories(smeshjs PRIVATE
|
|||||||
${PROJECT_SOURCE_DIR}/src/SMESHDS
|
${PROJECT_SOURCE_DIR}/src/SMESHDS
|
||||||
${PROJECT_SOURCE_DIR}/src/StdMeshers
|
${PROJECT_SOURCE_DIR}/src/StdMeshers
|
||||||
${PROJECT_SOURCE_DIR}/src/SMESHUtils
|
${PROJECT_SOURCE_DIR}/src/SMESHUtils
|
||||||
|
${PYTHONWASM_INCLUDE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_options(smeshjs PRIVATE
|
|
||||||
"-O0"
|
|
||||||
"--bind"
|
|
||||||
"--closure 1"
|
|
||||||
"SHELL:-sEXPORT_NAME=smesh"
|
|
||||||
"SHELL:-sALLOW_MEMORY_GROWTH=1"
|
|
||||||
"SHELL:-sEMULATE_FUNCTION_POINTER_CASTS=0"
|
|
||||||
"SHELL:-sMODULARIZE=1"
|
|
||||||
"SHELL:-sWASM=1"
|
|
||||||
"SHELL:-sFORCE_FILESYSTEM"
|
|
||||||
"SHELL:-sEXPORTED_RUNTIME_METHODS=FS"
|
|
||||||
"SHELL:-sWASM_BIGINT"
|
|
||||||
"SHELL:-sNO_DISABLE_EXCEPTION_CATCHING"
|
|
||||||
)
|
|
||||||
|
|
||||||
target_compile_options(smeshjs PRIVATE
|
|
||||||
"-Oz" "-flto"
|
|
||||||
)
|
|
||||||
|
|
||||||
configure_file(
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/app.html"
|
|
||||||
"${CMAKE_BINARY_DIR}/webassembly/index.html"
|
|
||||||
COPYONLY)
|
|
||||||
|
|
||||||
configure_file(
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/server.py"
|
|
||||||
"${CMAKE_BINARY_DIR}/webassembly/server.py"
|
|
||||||
COPYONLY)
|
|
||||||
|
|
||||||
install(FILES
|
install(FILES
|
||||||
${CMAKE_BINARY_DIR}/webassembly/index.html
|
${CMAKE_BINARY_DIR}/src/webassembly/smesh.so
|
||||||
${CMAKE_BINARY_DIR}/webassembly/server.py
|
${CMAKE_BINARY_DIR}/src/webassembly/smeshpy.py
|
||||||
${CMAKE_BINARY_DIR}/webassembly/server.py
|
DESTINATION smeshpywheel
|
||||||
${CMAKE_BINARY_DIR}/src/webassembly/smesh.wasm
|
)
|
||||||
${CMAKE_BINARY_DIR}/src/webassembly/smesh.js
|
|
||||||
|
|
||||||
DESTINATION webassembly)
|
# target_link_options(smeshjs PRIVATE
|
||||||
|
# "-O0"
|
||||||
|
# "--bind"
|
||||||
|
# "--closure 1"
|
||||||
|
# "SHELL:-sEXPORT_NAME=smesh"
|
||||||
|
# "SHELL:-sALLOW_MEMORY_GROWTH=1"
|
||||||
|
# "SHELL:-sEMULATE_FUNCTION_POINTER_CASTS=0"
|
||||||
|
# "SHELL:-sMODULARIZE=1"
|
||||||
|
# "SHELL:-sWASM=1"
|
||||||
|
# "SHELL:-sFORCE_FILESYSTEM"
|
||||||
|
# "SHELL:-sEXPORTED_RUNTIME_METHODS=FS"
|
||||||
|
# "SHELL:-sWASM_BIGINT"
|
||||||
|
# "SHELL:-sNO_DISABLE_EXCEPTION_CATCHING"
|
||||||
|
# )
|
||||||
|
|
||||||
|
# target_compile_options(smeshjs PRIVATE
|
||||||
|
# "-Oz" "-flto"
|
||||||
|
# )
|
||||||
|
|
||||||
|
# configure_file(
|
||||||
|
# "${CMAKE_CURRENT_SOURCE_DIR}/app.html"
|
||||||
|
# "${CMAKE_BINARY_DIR}/webassembly/index.html"
|
||||||
|
# COPYONLY)
|
||||||
|
|
||||||
|
# configure_file(
|
||||||
|
# "${CMAKE_CURRENT_SOURCE_DIR}/server.py"
|
||||||
|
# "${CMAKE_BINARY_DIR}/webassembly/server.py"
|
||||||
|
# COPYONLY)
|
||||||
|
|
||||||
|
# install(FILES
|
||||||
|
# ${CMAKE_BINARY_DIR}/webassembly/index.html
|
||||||
|
# ${CMAKE_BINARY_DIR}/webassembly/server.py
|
||||||
|
# ${CMAKE_BINARY_DIR}/webassembly/server.py
|
||||||
|
# ${CMAKE_BINARY_DIR}/src/webassembly/smesh.wasm
|
||||||
|
# ${CMAKE_BINARY_DIR}/src/webassembly/smesh.js
|
||||||
|
|
||||||
|
# DESTINATION webassembly)
|
||||||
|
12
src/webassembly/smeshpy.i
Normal file
12
src/webassembly/smeshpy.i
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
%module "smeshpy"%{
|
||||||
|
#include "GEOMImpl_Gen.hxx"
|
||||||
|
#include "SMESHDS_Mesh.hxx"
|
||||||
|
#include "SMESH_ControlsDef.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"
|
||||||
|
%}
|
||||||
|
%include "GEOMImpl_Gen.hxx"
|
Loading…
Reference in New Issue
Block a user