diff options
author | Christian Tismer <tismer@stackless.com> | 2017-12-17 19:12:56 +0100 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2018-05-30 18:13:41 +0000 |
commit | 18dc31becdd994c53a9f894087cf1ef99fbd0232 (patch) | |
tree | 3021cfa473f20102bfb63a26117776615b91b526 /sources/pyside2/CMakeLists.txt | |
parent | 50dd4ae202d7afb3556335c056db003f5ef50532 (diff) |
PEP 384-squash: Implement PEP 384
This is the condensed checkin of 18 commits which created
the implementation of PEP 384.
Task-number: PYSIDE-560
Change-Id: I834c659af4c2b55b268f8e8dc4cfa53f02502409
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources/pyside2/CMakeLists.txt')
-rw-r--r-- | sources/pyside2/CMakeLists.txt | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/sources/pyside2/CMakeLists.txt b/sources/pyside2/CMakeLists.txt index 77382480d..08647530c 100644 --- a/sources/pyside2/CMakeLists.txt +++ b/sources/pyside2/CMakeLists.txt @@ -400,12 +400,53 @@ 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}") |