From fe37f7d0b2a9deb88d2e8a968306b5cd08dd9396 Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Tue, 5 Sep 2023 17:13:29 +0200 Subject: [PATCH] Emscripten fixes --- CMakeLists.txt | 2 +- cmake/SuperBuild.cmake | 3 +++ libsrc/core/CMakeLists.txt | 1 + libsrc/meshing/delaunay.cpp | 2 ++ libsrc/meshing/meshfunc.cpp | 2 ++ 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 14512beb..d8963c2a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -319,7 +319,7 @@ if (USE_PYTHON) target_include_directories(netgen_python INTERFACE ${pybind11_INCLUDE_DIR} ${Python3_INCLUDE_DIRS}) target_include_directories(nglib PRIVATE ${pybind11_INCLUDE_DIR} ${Python3_INCLUDE_DIRS}) - if(Python3_LIBRARIES) + if(Python3_LIBRARIES AND NOT BUILD_FOR_CONDA) target_link_libraries(netgen_python INTERFACE ${Python3_LIBRARIES}) endif() diff --git a/cmake/SuperBuild.cmake b/cmake/SuperBuild.cmake index d0b70930..03ae3907 100644 --- a/cmake/SuperBuild.cmake +++ b/cmake/SuperBuild.cmake @@ -230,10 +230,13 @@ endif(USE_MPI) ####################################################################### # propagate cmake variables to Netgen subproject set_vars( NETGEN_CMAKE_ARGS + CMAKE_MODULE_LINKER_FLAGS + CMAKE_MODULE_LINKER_FLAGS_RELEASE CMAKE_SHARED_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS_RELEASE CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE + CMAKE_STRIP USE_GUI USE_PYTHON diff --git a/libsrc/core/CMakeLists.txt b/libsrc/core/CMakeLists.txt index e7403725..0bb6b522 100644 --- a/libsrc/core/CMakeLists.txt +++ b/libsrc/core/CMakeLists.txt @@ -18,6 +18,7 @@ string(REPLACE "|" ";" ng_compile_flags_replace_sep "${NG_COMPILE_FLAGS}") target_compile_options(ngcore PUBLIC ${ng_compile_flags_replace_sep}) if(EMSCRIPTEN) + set(PYTHON_MODULE_EXTENSION ".so") target_link_options(ngcore PUBLIC -sALLOW_MEMORY_GROWTH -sENVIRONMENT=web) target_compile_options(ngcore PUBLIC -sNO_DISABLE_EXCEPTION_CATCHING) endif() diff --git a/libsrc/meshing/delaunay.cpp b/libsrc/meshing/delaunay.cpp index 349a021e..51b594b4 100644 --- a/libsrc/meshing/delaunay.cpp +++ b/libsrc/meshing/delaunay.cpp @@ -1628,7 +1628,9 @@ namespace netgen MeshOptimize3d meshopt(mp); tempmesh.Compress(); tempmesh.FindOpenElements (); + #ifndef EMSCRIPTEN RegionTaskManager rtm(mp.parallel_meshing ? mp.nthreads : 0); + #endif // EMSCRIPTEN for (auto i : Range(10)) { PrintMessage (5, "Num open: ", tempmesh.GetNOpenElements()); diff --git a/libsrc/meshing/meshfunc.cpp b/libsrc/meshing/meshfunc.cpp index 849b2ef7..4ddc2844 100644 --- a/libsrc/meshing/meshfunc.cpp +++ b/libsrc/meshing/meshfunc.cpp @@ -631,7 +631,9 @@ namespace netgen // const CSGeometry * geometry) { static Timer t("OptimizeVolume"); RegionTimer reg(t); + #ifndef EMSCRIPTEN RegionTaskManager rtm(mp.parallel_meshing ? mp.nthreads : 0); + #endif // EMSCRIPTEN const char* savetask = multithread.task; multithread.task = "Optimize Volume";