mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-20 20:22:09 +00:00
ifcwrap cmake - provide correct suffix for wasm python extension
This commit is contained in:
@@ -53,6 +53,9 @@ IF(NOT Python_Development_FOUND)
|
|||||||
MESSAGE(FATAL_ERROR "BUILD_IFCPYTHON enabled, but unable to find Python lib or header. Disable BUILD_IFCPYTHON or fix Python paths to proceed.")
|
MESSAGE(FATAL_ERROR "BUILD_IFCPYTHON enabled, but unable to find Python lib or header. Disable BUILD_IFCPYTHON or fix Python paths to proceed.")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
# Ensure version is saved here, from wasm libraries,
|
||||||
|
# not from Python interpreter that might be unrelated to pyodide Python version.
|
||||||
|
set(_python_libs_version "${Python_VERSION_MAJOR}${Python_VERSION_MINOR}")
|
||||||
INCLUDE_DIRECTORIES(${Python_INCLUDE_DIRS})
|
INCLUDE_DIRECTORIES(${Python_INCLUDE_DIRS})
|
||||||
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR})
|
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
@@ -109,11 +112,14 @@ if(NOT ${PYTHON_EXECUTABLE} STREQUAL "")
|
|||||||
endif()
|
endif()
|
||||||
FIND_PACKAGE(Python COMPONENTS Interpreter)
|
FIND_PACKAGE(Python COMPONENTS Interpreter)
|
||||||
IF(Python_Interpreter_FOUND OR PYTHON_MODULE_INSTALL_DIR)
|
IF(Python_Interpreter_FOUND OR PYTHON_MODULE_INSTALL_DIR)
|
||||||
if (NOT WASM_BUILD)
|
|
||||||
# Not on WASM because we're cross compiling in that case
|
|
||||||
#
|
|
||||||
# Python_SOABI example value is 'cp311-win_amd64'.
|
# Python_SOABI example value is 'cp311-win_amd64'.
|
||||||
if(WIN32)
|
if(WASM_BUILD)
|
||||||
|
# For WASM we usually don't provide interpreter,
|
||||||
|
# so `find_package` couldn't find `Python_SOABI`.
|
||||||
|
# So we just hardcode it.
|
||||||
|
# .cpython-313-wasm32-emscripten.so
|
||||||
|
set(PYTHON_EXTENSION_SUFFIX ".cpython-${_python_libs_version}-wasm32-emscripten.so")
|
||||||
|
elseif(WIN32)
|
||||||
set(PYTHON_EXTENSION_SUFFIX ".${Python_SOABI}.pyd")
|
set(PYTHON_EXTENSION_SUFFIX ".${Python_SOABI}.pyd")
|
||||||
else()
|
else()
|
||||||
set(PYTHON_EXTENSION_SUFFIX ".${Python_SOABI}.so")
|
set(PYTHON_EXTENSION_SUFFIX ".${Python_SOABI}.so")
|
||||||
@@ -131,7 +137,6 @@ IF(Python_Interpreter_FOUND OR PYTHON_MODULE_INSTALL_DIR)
|
|||||||
SUFFIX ${PYTHON_EXTENSION_SUFFIX}
|
SUFFIX ${PYTHON_EXTENSION_SUFFIX}
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endif(NOT WASM_BUILD)
|
|
||||||
|
|
||||||
if (PYTHON_MODULE_INSTALL_DIR)
|
if (PYTHON_MODULE_INSTALL_DIR)
|
||||||
set(python_package_dir "${PYTHON_MODULE_INSTALL_DIR}")
|
set(python_package_dir "${PYTHON_MODULE_INSTALL_DIR}")
|
||||||
|
|||||||
Reference in New Issue
Block a user