From d069f57422ba86800705085f805396b3d16eff8f Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Sat, 16 Sep 2023 19:25:43 +0200 Subject: [PATCH] Pyodide fixes --- CMakeLists.txt | 21 ++++----------------- libsrc/meshing/meshclass.hpp | 2 +- ng/CMakeLists.txt | 4 ++-- nglib/CMakeLists.txt | 3 +-- 4 files changed, 8 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 483a5f5a..3d287e6e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -394,16 +394,9 @@ if (USE_OCC) TKXSBase TKernel ) - foreach(LIB_NAME ${OCC_LIBRARIES}) - set(LIB_VAR "LIB_${LIB_NAME}") - find_library(${LIB_VAR} ${LIB_NAME} NO_DEFAULT_PATH HINTS ${OpenCASCADE_LIBRARY_DIR}) - target_link_libraries(occ_libs INTERFACE ${${LIB_VAR}}) - endforeach() + target_link_libraries(occ_libs INTERFACE ${OCC_LIBRARIES}) include_directories(${OpenCASCADE_INCLUDE_DIR}) if(NOT OpenCASCADE_BUILD_SHARED_LIBS) - if(UNIX AND NOT APPLE AND NOT EMSCRIPTEN) - target_link_libraries(occ_libs INTERFACE -Wl,--start-group) - endif() if(OpenCASCADE_WITH_FREETYPE) find_library( FREETYPE NAMES freetype HINTS ${OpenCASCADE_LIBRARY_DIR}) list(APPEND OCC_LIBRARIES ${FREETYPE}) @@ -413,15 +406,9 @@ if (USE_OCC) target_link_libraries(occ_libs INTERFACE ${Fontconfig_LIBRARIES}) endif() endif(OpenCASCADE_WITH_FREETYPE) - if(UNIX AND NOT APPLE AND NOT EMSCRIPTEN) - set(THREADS_PREFER_PTHREAD_FLAG ON) - find_package(Threads REQUIRED) - target_link_libraries(occ_libs INTERFACE Threads::Threads) - target_link_libraries(occ_libs INTERFACE -Wl,--end-group) - endif() - if(WIN32) - target_link_libraries(occ_libs INTERFACE Threads::Threads) - endif() + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads REQUIRED) + target_link_libraries(occ_libs INTERFACE Threads::Threads) endif() message(STATUS "OCC DIRS ${OpenCASCADE_INCLUDE_DIR}") if(WIN32 AND USE_GUI) diff --git a/libsrc/meshing/meshclass.hpp b/libsrc/meshing/meshclass.hpp index a57de88f..a1adf171 100644 --- a/libsrc/meshing/meshclass.hpp +++ b/libsrc/meshing/meshclass.hpp @@ -235,7 +235,7 @@ namespace netgen /// DLL_HEADER ~Mesh(); - Mesh & operator= (const Mesh & mesh2); + DLL_HEADER Mesh & operator= (const Mesh & mesh2); /// DLL_HEADER void DeleteMesh(); diff --git a/ng/CMakeLists.txt b/ng/CMakeLists.txt index 710a780c..42335a8b 100644 --- a/ng/CMakeLists.txt +++ b/ng/CMakeLists.txt @@ -44,7 +44,7 @@ if(USE_PYTHON) set_target_properties( ngpy PROPERTIES OUTPUT_NAME "libngpy") endif() set_target_properties(ngpy PROPERTIES INSTALL_RPATH "${NG_RPATH_TOKEN}/../${NETGEN_PYTHON_RPATH}") - install(TARGETS ngpy DESTINATION ${NG_INSTALL_DIR_PYTHON}/${NG_INSTALL_SUFFIX} COMPONENT netgen) + install(TARGETS ngpy DESTINATION ${NG_INSTALL_DIR_PYTHON}/${NG_INSTALL_SUFFIX} COMPONENT netgen EXPORT netgen-targets) if(USE_GUI) add_library(ngguipy SHARED ngguipy.cpp) @@ -56,7 +56,7 @@ if(USE_PYTHON) set_target_properties( ngguipy PROPERTIES OUTPUT_NAME "libngguipy") endif() set_target_properties(ngguipy PROPERTIES INSTALL_RPATH "${NG_RPATH_TOKEN}/../${NETGEN_PYTHON_RPATH}") - install(TARGETS ngguipy DESTINATION ${NG_INSTALL_DIR_PYTHON}/${NG_INSTALL_SUFFIX} COMPONENT netgen) + install(TARGETS ngguipy DESTINATION ${NG_INSTALL_DIR_PYTHON}/${NG_INSTALL_SUFFIX} COMPONENT netgen EXPORT netgen-targets) endif(USE_GUI) endif(USE_PYTHON) diff --git a/nglib/CMakeLists.txt b/nglib/CMakeLists.txt index 9a9a5d1f..66844709 100644 --- a/nglib/CMakeLists.txt +++ b/nglib/CMakeLists.txt @@ -11,9 +11,8 @@ if(EMSCRIPTEN) target_include_directories(nglib PUBLIC $) else(EMSCRIPTEN) target_link_libraries(nglib PUBLIC ngcore) + target_link_libraries( nglib PRIVATE ${MPI_CXX_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${JPEG_LIBRARIES} ${MKL_LIBRARIES} ${ZLIB_LIBRARIES} occ_libs netgen_cgns ) endif(EMSCRIPTEN) -target_link_libraries( nglib PRIVATE ${MPI_CXX_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${JPEG_LIBRARIES} ${MKL_LIBRARIES} ${ZLIB_LIBRARIES} occ_libs netgen_cgns ) - install(TARGETS nglib netgen_cgns ${NG_INSTALL_DIR}) install(FILES nglib.h DESTINATION ${NG_INSTALL_DIR_INCLUDE} COMPONENT netgen_devel)