aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2017-05-18 18:22:07 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2017-05-19 09:30:13 +0000
commit8465adf2f908f8ef2630e78d840e07a13660253b (patch)
treea7e37d086169330faf372be06d9f04dc8812a128
parent5e507c6ead2457ae863ce4d6bf1710ef02fac892 (diff)
Collect Qt packages earlier to support QML exceptions
When a80a6eb94433529a6d984e8ff22874f7dff48eea was introduced, collection of Qt packages was moved from the top level CMake project, to the PySide2 CMake subproject. This caused the issue that libpyside could not find the QML private API classes (due to the packages not being found in the project scope), leading to the failing test javascript_exceptions.py. This change moves the collection of the Qt packages back into the top-level project, so that the found Qt packages are propagated to all subprojects, including libpyside. Change-Id: Ieb41a51cc40b11c9f9b81143bf1dbe7d9c97da0c Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r--CMakeLists.txt86
-rw-r--r--PySide2/CMakeLists.txt94
2 files changed, 86 insertions, 94 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 89d4dc7c1..6c5691d01 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -188,6 +188,92 @@ else()
CACHE STRING "PySide version [full]" FORCE)
endif()
+include(PySideModules)
+
+macro(COLLECT_MODULE_IF_FOUND shortname)
+ set(name "Qt5${shortname}")
+ find_package(${name})
+ set(_name_found "${name}_FOUND")
+ if(${_name_found})
+ message(STATUS "module ${name} found (${ARGN})")
+
+ # Put the module at the end of pyside2_global.h
+ file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/PySide2/pyside2_global.h.add"
+ "#include \"Qt${shortname}/Qt${shortname}\"\n")
+ # record the shortnames for the tests
+ list(APPEND all_module_shortnames ${shortname})
+ else()
+ if("${ARGN}" STREQUAL "opt")
+ message(STATUS "optional module ${name} skipped")
+ elseif("${ARGN}" STREQUAL "essential")
+ message(STATUS "skipped module ${name} is essential!\n"
+ " We do not guarantee that all tests are working.")
+ else()
+ message(FATAL_ERROR "module ${name} MISSING")
+ endif()
+ endif()
+endmacro()
+
+# note: the order of this list is relevant for dependencies.
+# For instance: Qt5Printsupport must come before Qt5WebKitWidgets.
+COLLECT_MODULE_IF_FOUND(Core)
+COLLECT_MODULE_IF_FOUND(Gui essential)
+COLLECT_MODULE_IF_FOUND(Widgets essential)
+COLLECT_MODULE_IF_FOUND(PrintSupport essential)
+COLLECT_MODULE_IF_FOUND(Sql essential)
+COLLECT_MODULE_IF_FOUND(Network essential)
+COLLECT_MODULE_IF_FOUND(Test essential)
+if(NOT MSVC)
+ # right now this does not build on windows
+ COLLECT_MODULE_IF_FOUND(Concurrent essential)
+else()
+ set(DISABLE_QtConcurrent 1)
+ENDIF()
+if(UNIX AND NOT APPLE)
+ COLLECT_MODULE_IF_FOUND(X11Extras essential)
+endif()
+if(WIN32)
+ COLLECT_MODULE_IF_FOUND(WinExtras essential)
+endif()
+if(APPLE)
+ COLLECT_MODULE_IF_FOUND(MacExtras essential)
+endif()
+COLLECT_MODULE_IF_FOUND(Xml)
+COLLECT_MODULE_IF_FOUND(XmlPatterns opt)
+COLLECT_MODULE_IF_FOUND(Help opt)
+COLLECT_MODULE_IF_FOUND(Multimedia opt)
+COLLECT_MODULE_IF_FOUND(MultimediaWidgets opt)
+COLLECT_MODULE_IF_FOUND(OpenGL opt)
+COLLECT_MODULE_IF_FOUND(Qml opt)
+COLLECT_MODULE_IF_FOUND(Quick opt)
+COLLECT_MODULE_IF_FOUND(QuickWidgets opt)
+COLLECT_MODULE_IF_FOUND(Script opt)
+if(NOT MSVC)
+ # right now this does not build on windows
+ COLLECT_MODULE_IF_FOUND(ScriptTools opt)
+else()
+ set(DISABLE_QtScriptTools 1)
+ENDIF()
+COLLECT_MODULE_IF_FOUND(Svg opt)
+if(Qt5Designer_FOUND)
+ COLLECT_MODULE_IF_FOUND(UiTools opt)
+else()
+ set(DISABLE_QtUiTools 1)
+endif()
+COLLECT_MODULE_IF_FOUND(WebChannel opt)
+# still forgotten:
+#COLLECT_MODULE_IF_FOUND(WebEngineCore opt)
+#COLLECT_MODULE_IF_FOUND(WebEngine opt)
+COLLECT_MODULE_IF_FOUND(WebEngineWidgets opt)
+COLLECT_MODULE_IF_FOUND(WebKit opt)
+if(NOT MSVC)
+ # right now this does not build on windows
+ COLLECT_MODULE_IF_FOUND(WebKitWidgets opt)
+else()
+ set(DISABLE_QtWebKitWidgets 1)
+ENDIF()
+COLLECT_MODULE_IF_FOUND(WebSockets opt)
+
string(REGEX MATCHALL "[0-9]+" qt_version_helper "${Qt5Core_VERSION}")
list(GET qt_version_helper 0 QT_VERSION_MAJOR)
diff --git a/PySide2/CMakeLists.txt b/PySide2/CMakeLists.txt
index d016bc3a4..01d9f64c2 100644
--- a/PySide2/CMakeLists.txt
+++ b/PySide2/CMakeLists.txt
@@ -1,99 +1,5 @@
project(pyside2)
-include(PySideModules)
-
-macro(COLLECT_MODULE_IF_FOUND shortname)
- set(name "Qt5${shortname}")
- find_package(${name})
- set(_name_found "${name}_FOUND")
- if(${_name_found})
- message(STATUS "module ${name} found (${ARGN})")
-
- # Hoist this to the parent scope to make sure all tests get built
- set("${name}_FOUND" 1 PARENT_SCOPE)
- # also put the module at the end of pyside2_global.h
- file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/pyside2_global.h.add"
- "#include \"Qt${shortname}/Qt${shortname}\"\n")
- # record the shortnames for the tests
- list(APPEND all_module_shortnames ${shortname})
- set(all_module_shortnames ${all_module_shortnames} PARENT_SCOPE)
- else()
- if("${ARGN}" STREQUAL "opt")
- message(STATUS "optional module ${name} skipped")
- elseif("${ARGN}" STREQUAL "essential")
- message(STATUS "skipped optional module ${name} is essential!\n"
- " We do not guarantee that all tests are working.")
- else()
- message(FATAL_ERROR "module ${name} MISSING")
- endif()
- endif()
-endmacro()
-
-# note: the order of this list is relevant for dependencies.
-# For instance: Qt5Printsupport must come before Qt5WebKitWidgets.
-COLLECT_MODULE_IF_FOUND(Core)
-COLLECT_MODULE_IF_FOUND(Gui essential)
-COLLECT_MODULE_IF_FOUND(Widgets essential)
-COLLECT_MODULE_IF_FOUND(PrintSupport essential)
-COLLECT_MODULE_IF_FOUND(Sql essential)
-COLLECT_MODULE_IF_FOUND(Network essential)
-COLLECT_MODULE_IF_FOUND(Test essential)
-if(NOT MSVC)
- # right now this does not build on windows
- COLLECT_MODULE_IF_FOUND(Concurrent essential)
-else()
- # Note: in order to use this variable in a sibling project (tests),
- # we need to either make the value persistent like so:
- # set(DISABLE_QtConcurrent 1 CACHE INTERNAL "")
- # or export it to the caller's scope by the PARENT_SCOPE specifier.
- # This is preferable, because there are no sticky side effects.
- set(DISABLE_QtConcurrent 1 PARENT_SCOPE)
-ENDIF()
-if(UNIX AND NOT APPLE)
- COLLECT_MODULE_IF_FOUND(X11Extras essential)
-endif()
-if(WIN32)
- COLLECT_MODULE_IF_FOUND(WinExtras essential)
-endif()
-if(APPLE)
- COLLECT_MODULE_IF_FOUND(MacExtras essential)
-endif()
-COLLECT_MODULE_IF_FOUND(Xml)
-COLLECT_MODULE_IF_FOUND(XmlPatterns opt)
-COLLECT_MODULE_IF_FOUND(Help opt)
-COLLECT_MODULE_IF_FOUND(Multimedia opt)
-COLLECT_MODULE_IF_FOUND(MultimediaWidgets opt)
-COLLECT_MODULE_IF_FOUND(OpenGL opt)
-COLLECT_MODULE_IF_FOUND(Qml opt)
-COLLECT_MODULE_IF_FOUND(Quick opt)
-COLLECT_MODULE_IF_FOUND(QuickWidgets opt)
-COLLECT_MODULE_IF_FOUND(Script opt)
-if(NOT MSVC)
- # right now this does not build on windows
- COLLECT_MODULE_IF_FOUND(ScriptTools opt)
-else()
- set(DISABLE_QtScriptTools 1 PARENT_SCOPE)
-ENDIF()
-COLLECT_MODULE_IF_FOUND(Svg opt)
-if(Qt5Designer_FOUND)
- COLLECT_MODULE_IF_FOUND(UiTools opt)
-else()
- set(DISABLE_QtUiTools 1 PARENT_SCOPE)
-endif()
-COLLECT_MODULE_IF_FOUND(WebChannel opt)
-# still forgotten:
-#COLLECT_MODULE_IF_FOUND(WebEngineCore opt)
-#COLLECT_MODULE_IF_FOUND(WebEngine opt)
-COLLECT_MODULE_IF_FOUND(WebEngineWidgets opt)
-COLLECT_MODULE_IF_FOUND(WebKit opt)
-if(NOT MSVC)
- # right now this does not build on windows
- COLLECT_MODULE_IF_FOUND(WebKitWidgets opt)
-else()
- set(DISABLE_QtWebKitWidgets 1 PARENT_SCOPE)
-ENDIF()
-COLLECT_MODULE_IF_FOUND(WebSockets opt)
-
# Configure include based on platform
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/global.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/pyside2_global.h" @ONLY)