From 291a5e4aa6cc42d47b4fa593c9b6dbc3d45f619e Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Thu, 14 Sep 2023 10:49:25 +0200 Subject: [PATCH] Emscripten support --- CMakeLists.txt | 8 +++++--- cmake/SuperBuild.cmake | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 61edb577..41ba8eab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,14 +86,16 @@ set(NG_INSTALL_SUFFIX netgen CACHE STRING "Suffix appended to install directorie if(USE_PYTHON) if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.18) - find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module) + find_package(Python3 REQUIRED COMPONENTS Development.Module) find_package(Python3 COMPONENTS Interpreter Development.Embed) else() find_package(Python3 REQUIRED COMPONENTS Interpreter Development) endif() - execute_process(COMMAND ${Python3_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1,0,''))" OUTPUT_VARIABLE PYTHON_PACKAGES_INSTALL_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) - file(TO_CMAKE_PATH ${PYTHON_PACKAGES_INSTALL_DIR} PYTHON_PACKAGES_INSTALL_DIR) + if(NOT CMAKE_CROSSCOMPILING) + execute_process(COMMAND ${Python3_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1,0,''))" OUTPUT_VARIABLE PYTHON_PACKAGES_INSTALL_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) + file(TO_CMAKE_PATH ${PYTHON_PACKAGES_INSTALL_DIR} PYTHON_PACKAGES_INSTALL_DIR) + endif(NOT CMAKE_CROSSCOMPILING) endif(USE_PYTHON) if(APPLE AND NOT EMSCRIPTEN) diff --git a/cmake/SuperBuild.cmake b/cmake/SuperBuild.cmake index dfd9adda..92f6a17b 100644 --- a/cmake/SuperBuild.cmake +++ b/cmake/SuperBuild.cmake @@ -183,7 +183,7 @@ if (USE_PYTHON) message(FATAL_ERROR "Could NOT find pybind11!") endif( PYBIND_INCLUDE_DIR ) if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.18) - find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module) + find_package(Python3 COMPONENTS Interpreter Development.Module) find_package(Python3 COMPONENTS Interpreter Development.Embed) else() find_package(Python3 REQUIRED COMPONENTS Interpreter Development)