@@ -53,6 +53,9 @@ IF(NOT Python_Development_FOUND)
5353 MESSAGE (FATAL_ERROR "BUILD_IFCPYTHON enabled, but unable to find Python lib or header. Disable BUILD_IFCPYTHON or fix Python paths to proceed." )
5454ENDIF ()
5555
56+ # Ensure version is saved here, from wasm libraries,
57+ # not from Python interpreter that might be unrelated to pyodide Python version.
58+ set (_python_libs_version "${Python_VERSION_MAJOR}${Python_VERSION_MINOR} " )
5659INCLUDE_DIRECTORIES (${Python_INCLUDE_DIRS} )
5760INCLUDE_DIRECTORIES (BEFORE ${CMAKE_CURRENT_SOURCE_DIR} )
5861
@@ -109,11 +112,14 @@ if(NOT ${PYTHON_EXECUTABLE} STREQUAL "")
109112endif ()
110113FIND_PACKAGE (Python COMPONENTS Interpreter )
111114IF (Python_Interpreter_FOUND OR PYTHON_MODULE_INSTALL_DIR)
112- if (NOT WASM_BUILD)
113- # Not on WASM because we're cross compiling in that case
114- #
115115 # Python_SOABI example value is 'cp311-win_amd64'.
116- if (WIN32 )
116+ if (WASM_BUILD)
117+ # For WASM we usually don't provide interpreter,
118+ # so `find_package` couldn't find `Python_SOABI`.
119+ # So we just hardcode it.
120+ # .cpython-313-wasm32-emscripten.so
121+ set (PYTHON_EXTENSION_SUFFIX ".cpython-${_python_libs_version} -wasm32-emscripten.so" )
122+ elseif (WIN32 )
117123 set (PYTHON_EXTENSION_SUFFIX ".${Python_SOABI} .pyd" )
118124 else ()
119125 set (PYTHON_EXTENSION_SUFFIX ".${Python_SOABI} .so" )
@@ -131,7 +137,6 @@ IF(Python_Interpreter_FOUND OR PYTHON_MODULE_INSTALL_DIR)
131137 SUFFIX ${PYTHON_EXTENSION_SUFFIX}
132138 )
133139 endif ()
134- endif (NOT WASM_BUILD )
135140
136141 if (PYTHON_MODULE_INSTALL_DIR)
137142 set (python_package_dir "${PYTHON_MODULE_INSTALL_DIR} " )
0 commit comments