ifcwrap cmake - provide correct suffix for wasm python extension

This commit is contained in:
Andrej730
2025-10-17 18:48:11 +05:00
parent c3c94b9c59
commit a6921b83a1
+10 -5
View File
@@ -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.")
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(BEFORE ${CMAKE_CURRENT_SOURCE_DIR})
@@ -109,11 +112,14 @@ if(NOT ${PYTHON_EXECUTABLE} STREQUAL "")
endif()
FIND_PACKAGE(Python COMPONENTS Interpreter)
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'.
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")
else()
set(PYTHON_EXTENSION_SUFFIX ".${Python_SOABI}.so")
@@ -131,7 +137,6 @@ IF(Python_Interpreter_FOUND OR PYTHON_MODULE_INSTALL_DIR)
SUFFIX ${PYTHON_EXTENSION_SUFFIX}
)
endif()
endif(NOT WASM_BUILD)
if (PYTHON_MODULE_INSTALL_DIR)
set(python_package_dir "${PYTHON_MODULE_INSTALL_DIR}")