aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2018-05-25 17:08:25 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-05-31 07:32:29 +0000
commit6b4155223ce1670ed630b0b8780187cfeeadb564 (patch)
treee753252dc733dce4232e70cf4fc600a752481215 /sources/pyside2
parent18dc31becdd994c53a9f894087cf1ef99fbd0232 (diff)
Fix module names to contain correct limited api suffix
This includes .abi3.so on Linux and macOS, and .pyd on Windows. Otherwise if you build with Python 3.6, and try to install the package on Python 3.5, none of the modules would be found on import. Change-Id: I56639da6319cfa06e23ae793d66099813074adf4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside2')
-rw-r--r--sources/pyside2/CMakeLists.txt98
1 files changed, 51 insertions, 47 deletions
diff --git a/sources/pyside2/CMakeLists.txt b/sources/pyside2/CMakeLists.txt
index 08647530..ee98d1d0 100644
--- a/sources/pyside2/CMakeLists.txt
+++ b/sources/pyside2/CMakeLists.txt
@@ -69,6 +69,50 @@ if (NOT PYTHON_EXTENSION_SUFFIX)
get_python_extension_suffix()
endif()
+# On Windows, PYTHON_LIBRARIES can be a list. Example:
+# optimized;C:/Python36/libs/python36.lib;debug;C:/Python36/libs/python36_d.lib
+# On other platforms, this result is not used at all.
+execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} -c "if True:
+ for lib in '${PYTHON_LIBRARIES}'.split(';'):
+ if '/' in lib:
+ prefix, py = lib.rsplit( '/', 1)
+ if py.startswith('python3'):
+ print(prefix + '/python3.lib')
+ break
+ "
+ OUTPUT_VARIABLE PYTHON_LIMITED_LIBRARIES
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+if (WIN32)
+ set(PATH_SEP "\;")
+else()
+ set(PATH_SEP ":")
+endif()
+
+option(FORCE_LIMITED_API "Enable the limited API." "no")
+
+set(PYTHON_LIMITED_API 0)
+if(FORCE_LIMITED_API STREQUAL "yes")
+ # GREATER_EQUAL is available only from cmake 3.7 on. We mean python 3.5 .
+ if (${PYTHON_VERSION_MAJOR} EQUAL 3 AND ${PYTHON_VERSION_MINOR} GREATER 4)
+ add_definitions("-DPy_LIMITED_API=0x03050000")
+ set(PYTHON_LIMITED_API 1)
+ endif()
+endif()
+if (CMAKE_BUILD_TYPE STREQUAL "Release")
+ add_definitions("-DNDEBUG")
+endif()
+
+if (PYTHON_LIMITED_API)
+ if (WIN32 AND NOT EXISTS "${PYTHON_LIMITED_LIBRARIES}")
+ message(FATAL_ERROR "The Limited API was enabled, but ${PYTHON_LIMITED_LIBRARIES} was not found!")
+ endif()
+ message(STATUS "******************************************************")
+ message(STATUS "** Limited API enabled ${PYTHON_LIMITED_LIBRARIES}")
+ message(STATUS "******************************************************")
+endif()
+
if (NOT PYTHON_CONFIG_SUFFIX)
if (PYTHON_VERSION_MAJOR EQUAL 2)
set(PYTHON_CONFIG_SUFFIX "-python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
@@ -76,6 +120,13 @@ if (NOT PYTHON_CONFIG_SUFFIX)
set(PYTHON_CONFIG_SUFFIX "${PYTHON_CONFIG_SUFFIX}${PYTHON_EXTENSION_SUFFIX}")
endif()
elseif (PYTHON_VERSION_MAJOR EQUAL 3)
+ if (PYTHON_LIMITED_API)
+ if(WIN32)
+ set(PYTHON_EXTENSION_SUFFIX "")
+ else()
+ set(PYTHON_EXTENSION_SUFFIX ".abi3")
+ endif()
+ endif()
set(PYTHON_CONFIG_SUFFIX "${PYTHON_EXTENSION_SUFFIX}")
endif()
endif()
@@ -400,53 +451,6 @@ else()
endif()
message(STATUS "Detected OS: ${AUTO_OS}")
-# On Windows, PYTHON_LIBRARIES can be a list. Example:
-# optimized;C:/Python36/libs/python36.lib;debug;C:/Python36/libs/python36_d.lib
-# On other platforms, this result is not used at all.
-execute_process(
- COMMAND ${PYTHON_EXECUTABLE} -c "if True:
- for lib in '${PYTHON_LIBRARIES}'.split(';'):
- if '/' in lib:
- prefix, py = lib.rsplit( '/', 1)
- if py.startswith('python3'):
- print(prefix + '/python3.lib')
- break
- "
- OUTPUT_VARIABLE PYTHON_LIMITED_LIBRARIES
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-
-if (WIN32)
- set(PATH_SEP "\;")
-else()
- set(PATH_SEP ":")
-endif()
-
-option(FORCE_LIMITED_API "Enable the limited API." "no")
-
-set(PYTHON_LIMITED_API 0)
-if(FORCE_LIMITED_API STREQUAL "yes")
- # GREATER_EQUAL is available only from cmake 3.7 on. We mean python 3.5 .
- if (${PYTHON_VERSION_MAJOR} EQUAL 3 AND ${PYTHON_VERSION_MINOR} GREATER 4)
- if (WIN32)
- set(SHIBOKEN_PYTHON_LIBRARIES ${PYTHON_LIMITED_LIBRARIES})
- endif()
- add_definitions("-DPy_LIMITED_API=0x03050000")
- set(PYTHON_LIMITED_API 1)
- endif()
- if (CMAKE_BUILD_TYPE STREQUAL "Release")
- add_definitions("-DNDEBUG")
- endif()
-endif()
-
-if (PYTHON_LIMITED_API)
- if (WIN32 AND NOT EXISTS "${PYTHON_LIMITED_LIBRARIES}")
- message(FATAL_ERROR "The Limited API was enabled, but ${PYTHON_LIMITED_LIBRARIES} was not found!")
- endif()
- message(STATUS "******************************************************")
- message(STATUS "** Limited API enabled ${PYTHON_LIMITED_LIBRARIES}")
- message(STATUS "******************************************************")
-endif()
-
# Define supported Qt Version
set(SUPPORTED_QT_VERSION "${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}")