aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2017-05-24 18:50:44 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2017-07-12 12:44:47 +0000
commit5337435edaa10518c4495d480f934e87b2ccd444 (patch)
tree9d4d876f0b9c163721dba1210de008045af6559f
parent8ae4d5827d1ccd463b99aaf54c2e8cb482094c91 (diff)
Fix Windows module extensions and tests to work with --debug build
Use the same imp.get_suffixes() mechanism as on Unix, to determine the suffix part of module extension files. This fixes debug builds to work on Windows. Note that the whole build stack has to use the same configuration, no mixing is allowed on Windows. For release build you need: python.exe + setup.py without --debug flag + release build of Qt5. For debug build you need: python_d.exe + setup.py with --debug flag + debug build of Qt5. Change-Id: I6188c859b5757d11e87d6a9e32b9ba558f7f609e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r--setup.py43
m---------sources/pyside2-examples0
-rw-r--r--sources/pyside2/CMakeLists.txt46
-rw-r--r--sources/pyside2/cmake/Macros/PySideModules.cmake3
-rw-r--r--sources/pyside2/tests/pysidetest/CMakeLists.txt2
-rw-r--r--sources/shiboken2/CMakeLists.txt47
-rw-r--r--sources/shiboken2/shibokenmodule/CMakeLists.txt3
7 files changed, 75 insertions, 69 deletions
diff --git a/setup.py b/setup.py
index 771a9c538..af33254ca 100644
--- a/setup.py
+++ b/setup.py
@@ -1067,15 +1067,23 @@ class pyside_build(_build):
"{dist_dir}/PySide2/docs/shiboken2",
force=False, vars=vars)
# <install>/lib/site-packages/shiboken2.pyd -> <setup>/PySide2/shiboken2.pyd
+ shiboken_module_name = 'shiboken2.pyd'
+ shiboken_src_path = "{site_packages_dir}".format(**vars)
+ maybe_shiboken_names = [f for f in os.listdir(shiboken_src_path)
+ if re.match(r'shiboken.*\.pyd', f)]
+ if maybe_shiboken_names:
+ shiboken_module_name = maybe_shiboken_names[0]
+ vars.update({'shiboken_module_name': shiboken_module_name})
copyfile(
- "{site_packages_dir}/shiboken2{dbgPostfix}.pyd",
- "{dist_dir}/PySide2/shiboken2{dbgPostfix}.pyd",
+ "{site_packages_dir}/{shiboken_module_name}",
+ "{dist_dir}/PySide2/{shiboken_module_name}",
vars=vars)
if self.debug or self.build_type == 'RelWithDebInfo':
- copyfile(
- "{build_dir}/shiboken2/shibokenmodule/shiboken2{dbgPostfix}.pdb",
- "{dist_dir}/PySide2/shiboken2{dbgPostfix}.pdb",
- vars=vars)
+ copydir(
+ "{build_dir}/shiboken2/shibokenmodule",
+ "{dist_dir}/PySide2",
+ filter=pdbs,
+ recursive=False, vars=vars)
# <install>/lib/site-packages/pyside2uic/* -> <setup>/pyside2uic
copydir(
"{site_packages_dir}/pyside2uic",
@@ -1189,14 +1197,21 @@ class pyside_build(_build):
# pdb files for libshiboken and libpyside
if self.debug or self.build_type == 'RelWithDebInfo':
# XXX dbgPostfix gives problems - the structure in shiboken2/data should be re-written!
- copyfile(
- "{build_dir}/shiboken2/libshiboken/shiboken2.pdb",
- "{dist_dir}/PySide2/shiboken2.pdb", # omitted dbgPostfix
- vars=vars)
- copyfile(
- "{build_dir}/pyside2/libpyside/pyside2.pdb",
- "{dist_dir}/PySide2/pyside2.pdb", # omitted dbgPostfix
- vars=vars)
+ # Not sure what the above refers to, but because both the extension module
+ # (shiboken2.pyd) and the shared library (shiboken2.dll) have the same basename,
+ # the pdb file gets overwritten. This doesn't happen on Unix because the shared library
+ # has a 'lib' prefix in the basename.
+ # @TODO Change the shared library name on Windows.
+ copydir(
+ "{build_dir}/shiboken2/libshiboken",
+ "{dist_dir}/PySide2",
+ filter=pdbs,
+ recursive=False, vars=vars)
+ copydir(
+ "{build_dir}/pyside2/libpyside",
+ "{dist_dir}/PySide2",
+ filter=pdbs,
+ recursive=False, vars=vars)
def update_rpath(self, package_path, executables):
if sys.platform.startswith('linux'):
diff --git a/sources/pyside2-examples b/sources/pyside2-examples
-Subproject c8c9f64eb4657c54f063f01f00116732cb3fc10
+Subproject 8df6dccecc5165f7c3ec5896c9be8baceda7161
diff --git a/sources/pyside2/CMakeLists.txt b/sources/pyside2/CMakeLists.txt
index 4ac5afa85..d89b0f890 100644
--- a/sources/pyside2/CMakeLists.txt
+++ b/sources/pyside2/CMakeLists.txt
@@ -43,38 +43,36 @@ macro(get_python_extension_suffix)
message("PYTHON_EXTENSION_SUFFIX: " ${PYTHON_EXTENSION_SUFFIX})
endmacro()
-# Note the quirk that UNIX includes Apple!
-if (UNIX)
- if (NOT PYTHON_EXTENSION_SUFFIX)
- get_python_extension_suffix()
- endif()
- if (NOT PYTHON_CONFIG_SUFFIX)
- if (PYTHON_VERSION_MAJOR EQUAL 2)
- set(PYTHON_CONFIG_SUFFIX "-python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
- if (PYTHON_EXTENSION_SUFFIX)
- set(PYTHON_CONFIG_SUFFIX "${PYTHON_CONFIG_SUFFIX}${PYTHON_EXTENSION_SUFFIX}")
- endif()
- elseif (PYTHON_VERSION_MAJOR EQUAL 3)
- set(PYTHON_CONFIG_SUFFIX "${PYTHON_EXTENSION_SUFFIX}")
+if (NOT PYTHON_EXTENSION_SUFFIX)
+ get_python_extension_suffix()
+endif()
+
+if (NOT PYTHON_CONFIG_SUFFIX)
+ if (PYTHON_VERSION_MAJOR EQUAL 2)
+ set(PYTHON_CONFIG_SUFFIX "-python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
+ if (PYTHON_EXTENSION_SUFFIX)
+ set(PYTHON_CONFIG_SUFFIX "${PYTHON_CONFIG_SUFFIX}${PYTHON_EXTENSION_SUFFIX}")
endif()
+ elseif (PYTHON_VERSION_MAJOR EQUAL 3)
+ set(PYTHON_CONFIG_SUFFIX "${PYTHON_EXTENSION_SUFFIX}")
endif()
+endif()
- if (NOT PYTHON_SHARED_LIBRARY_SUFFIX)
- set(PYTHON_SHARED_LIBRARY_SUFFIX "${PYTHON_CONFIG_SUFFIX}")
+if (NOT PYTHON_SHARED_LIBRARY_SUFFIX)
+ set(PYTHON_SHARED_LIBRARY_SUFFIX "${PYTHON_CONFIG_SUFFIX}")
- # Append a "v" to disambiguate the python version and the pyside version in the
- # shared library file name.
- if (APPLE AND PYTHON_VERSION_MAJOR EQUAL 2)
- set(PYTHON_SHARED_LIBRARY_SUFFIX "${PYTHON_SHARED_LIBRARY_SUFFIX}v")
- endif()
+ # Append a "v" to disambiguate the python version and the pyside version in the
+ # shared library file name.
+ if (APPLE AND PYTHON_VERSION_MAJOR EQUAL 2)
+ set(PYTHON_SHARED_LIBRARY_SUFFIX "${PYTHON_SHARED_LIBRARY_SUFFIX}v")
endif()
+endif()
- message(STATUS "PYTHON_EXTENSION_SUFFIX: ${PYTHON_EXTENSION_SUFFIX}")
- message(STATUS "PYTHON_CONFIG_SUFFIX: ${PYTHON_CONFIG_SUFFIX}")
- message(STATUS "PYTHON_SHARED_LIBRARY_SUFFIX: ${PYTHON_SHARED_LIBRARY_SUFFIX}")
-endif()
+message(STATUS "PYTHON_EXTENSION_SUFFIX: ${PYTHON_EXTENSION_SUFFIX}")
+message(STATUS "PYTHON_CONFIG_SUFFIX: ${PYTHON_CONFIG_SUFFIX}")
+message(STATUS "PYTHON_SHARED_LIBRARY_SUFFIX: ${PYTHON_SHARED_LIBRARY_SUFFIX}")
find_package(Shiboken2 2.0.0 REQUIRED)
find_package(Qt5 5.6.0 REQUIRED COMPONENTS Core)
diff --git a/sources/pyside2/cmake/Macros/PySideModules.cmake b/sources/pyside2/cmake/Macros/PySideModules.cmake
index daa5401a1..468ce51bc 100644
--- a/sources/pyside2/cmake/Macros/PySideModules.cmake
+++ b/sources/pyside2/cmake/Macros/PySideModules.cmake
@@ -100,9 +100,6 @@ macro(create_pyside_module
LIBRARY_OUTPUT_DIRECTORY ${pyside2_BINARY_DIR})
if(WIN32)
set_target_properties(${module_name} PROPERTIES SUFFIX ".pyd")
- set(${module_name}_suffix ".pyd")
- else()
- set(${module_name}_suffix ${CMAKE_SHARED_MODULE_SUFFIX})
endif()
target_link_libraries(${module_name} ${${module_libraries}})
diff --git a/sources/pyside2/tests/pysidetest/CMakeLists.txt b/sources/pyside2/tests/pysidetest/CMakeLists.txt
index 0702d6085..b5fcb8d12 100644
--- a/sources/pyside2/tests/pysidetest/CMakeLists.txt
+++ b/sources/pyside2/tests/pysidetest/CMakeLists.txt
@@ -90,7 +90,7 @@ add_library(testbinding MODULE ${testbinding_SRC})
set_property(TARGET testbinding PROPERTY PREFIX "")
set_property(TARGET testbinding PROPERTY OUTPUT_NAME "testbinding${PYTHON_EXTENSION_SUFFIX}")
if(WIN32)
- set_target_properties(testbinding PROPERTIES SUFFIX ".pyd")
+ set_property(TARGET testbinding PROPERTY SUFFIX ".pyd")
endif()
target_link_libraries(testbinding
pysidetest
diff --git a/sources/shiboken2/CMakeLists.txt b/sources/shiboken2/CMakeLists.txt
index 549974b8c..424142699 100644
--- a/sources/shiboken2/CMakeLists.txt
+++ b/sources/shiboken2/CMakeLists.txt
@@ -58,38 +58,37 @@ macro(get_python_extension_suffix)
message("PYTHON_EXTENSION_SUFFIX: " ${PYTHON_EXTENSION_SUFFIX})
endmacro()
-# Note the quirk that UNIX includes Apple!
-if (UNIX)
- if (NOT PYTHON_EXTENSION_SUFFIX)
- get_python_extension_suffix()
- endif()
- if (NOT PYTHON_CONFIG_SUFFIX)
- if (PYTHON_VERSION_MAJOR EQUAL 2)
- set(PYTHON_CONFIG_SUFFIX "-python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
- if (PYTHON_EXTENSION_SUFFIX)
- set(PYTHON_CONFIG_SUFFIX "${PYTHON_CONFIG_SUFFIX}${PYTHON_EXTENSION_SUFFIX}")
- endif()
- elseif (PYTHON_VERSION_MAJOR EQUAL 3)
- set(PYTHON_CONFIG_SUFFIX "${PYTHON_EXTENSION_SUFFIX}")
+if (NOT PYTHON_EXTENSION_SUFFIX)
+ get_python_extension_suffix()
+endif()
+
+if (NOT PYTHON_CONFIG_SUFFIX)
+ if (PYTHON_VERSION_MAJOR EQUAL 2)
+ set(PYTHON_CONFIG_SUFFIX "-python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
+ if (PYTHON_EXTENSION_SUFFIX)
+ set(PYTHON_CONFIG_SUFFIX "${PYTHON_CONFIG_SUFFIX}${PYTHON_EXTENSION_SUFFIX}")
endif()
+ elseif (PYTHON_VERSION_MAJOR EQUAL 3)
+ set(PYTHON_CONFIG_SUFFIX "${PYTHON_EXTENSION_SUFFIX}")
endif()
+endif()
- if (NOT PYTHON_SHARED_LIBRARY_SUFFIX)
- set(PYTHON_SHARED_LIBRARY_SUFFIX "${PYTHON_CONFIG_SUFFIX}")
+if (NOT PYTHON_SHARED_LIBRARY_SUFFIX)
+ set(PYTHON_SHARED_LIBRARY_SUFFIX "${PYTHON_CONFIG_SUFFIX}")
- # Append a "v" to disambiguate the python version and the shiboken version in the
- # shared library file name.
- if (APPLE AND PYTHON_VERSION_MAJOR EQUAL 2)
- set(PYTHON_SHARED_LIBRARY_SUFFIX "${PYTHON_SHARED_LIBRARY_SUFFIX}v")
- endif()
+ # Append a "v" to disambiguate the python version and the shiboken version in the
+ # shared library file name.
+ if (APPLE AND PYTHON_VERSION_MAJOR EQUAL 2)
+ set(PYTHON_SHARED_LIBRARY_SUFFIX "${PYTHON_SHARED_LIBRARY_SUFFIX}v")
endif()
+endif()
- message(STATUS "PYTHON_EXTENSION_SUFFIX: ${PYTHON_EXTENSION_SUFFIX}")
- message(STATUS "PYTHON_CONFIG_SUFFIX: ${PYTHON_CONFIG_SUFFIX}")
- message(STATUS "PYTHON_SHARED_LIBRARY_SUFFIX: ${PYTHON_SHARED_LIBRARY_SUFFIX}")
-endif()
+message(STATUS "PYTHON_EXTENSION_SUFFIX: ${PYTHON_EXTENSION_SUFFIX}")
+message(STATUS "PYTHON_CONFIG_SUFFIX: ${PYTHON_CONFIG_SUFFIX}")
+message(STATUS "PYTHON_SHARED_LIBRARY_SUFFIX: ${PYTHON_SHARED_LIBRARY_SUFFIX}")
+
if (NOT PYTHON_SITE_PACKAGES)
execute_process(
diff --git a/sources/shiboken2/shibokenmodule/CMakeLists.txt b/sources/shiboken2/shibokenmodule/CMakeLists.txt
index 5e8e39d5f..31b98132d 100644
--- a/sources/shiboken2/shibokenmodule/CMakeLists.txt
+++ b/sources/shiboken2/shibokenmodule/CMakeLists.txt
@@ -27,9 +27,6 @@ set_property(TARGET shibokenmodule PROPERTY PREFIX "")
set_property(TARGET shibokenmodule PROPERTY OUTPUT_NAME "shiboken2${PYTHON_EXTENSION_SUFFIX}")
if(WIN32)
- if(CMAKE_BUILD_TYPE STREQUAL "Debug")
- set_property(TARGET shibokenmodule PROPERTY OUTPUT_NAME "shiboken2_d")
- endif()
set_property(TARGET shibokenmodule PROPERTY SUFFIX ".pyd")
endif()
target_link_libraries(shibokenmodule