aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2017-11-07 16:14:47 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-11-14 10:48:50 +0000
commit7daa59703916ebd40eeac83eecc90b73f76f4b8b (patch)
tree4e92d2c25506c8a64221b3732f8ece180177ee0b
parentcb8cb895a9bd8620d3e26b39254b3212b07113b2 (diff)
Allow building subset of Qt modules
Collect the list of essential and optional modules in list variables and concatenate them to a list variable MODULES unless its value was passed in on the command line with -D. Remove the additional parameter indicating the module type to COLLECT_MODULE_IF_FOUND() and let it determine that by checking the essentials list instead. Add a command line option --module-subset to setup.py which can be used like "--module-subset=QtCore,QtGui,QtWidgets,QtTest" to specify the modules to be built. Change-Id: Ibb0fa16a8d9b0d7aeeaf8a8cfcbd50cb910ecc97 Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r--setup.py10
-rw-r--r--sources/pyside2/CMakeLists.txt84
2 files changed, 50 insertions, 44 deletions
diff --git a/setup.py b/setup.py
index 4cdd800cb..35a802b06 100644
--- a/setup.py
+++ b/setup.py
@@ -239,6 +239,7 @@ OPTION_REUSE_BUILD = has_option("reuse-build")
OPTION_SKIP_CMAKE = has_option("skip-cmake")
OPTION_SKIP_MAKE_INSTALL = has_option("skip-make-install")
OPTION_SKIP_PACKAGING = has_option("skip-packaging")
+OPTION_MODULE_SUBSET = option_value("module-subset")
if OPTION_QT_VERSION is None:
OPTION_QT_VERSION = "5"
@@ -829,6 +830,15 @@ class pyside_build(_build):
cmake_cmd.append("-DPYTHON_EXECUTABLE=%s" % self.py_executable)
cmake_cmd.append("-DPYTHON_INCLUDE_DIR=%s" % self.py_include_dir)
cmake_cmd.append("-DPYTHON_LIBRARY=%s" % self.py_library)
+ if OPTION_MODULE_SUBSET:
+ moduleSubSet = ''
+ for m in OPTION_MODULE_SUBSET.split(','):
+ if m.startswith('Qt'):
+ m = m[2:]
+ if moduleSubSet:
+ moduleSubSet += ';'
+ moduleSubSet += m
+ cmake_cmd.append("-DMODULES=%s" % moduleSubSet)
# Add source location for generating documentation
if qtSrcDir:
cmake_cmd.append("-DQT_SRC_DIR=%s" % qtSrcDir)
diff --git a/sources/pyside2/CMakeLists.txt b/sources/pyside2/CMakeLists.txt
index 859771c0e..44e44071e 100644
--- a/sources/pyside2/CMakeLists.txt
+++ b/sources/pyside2/CMakeLists.txt
@@ -227,15 +227,27 @@ 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})")
+ # Determine essential/optional/missing
+ set(module_state "missing")
+ list(FIND ALL_ESSENTIAL_MODULES "${shortname}" essentialIndex)
+ if(${essentialIndex} EQUAL -1)
+ list(FIND ALL_OPTIONAL_MODULES "${shortname}" optionalIndex)
+ if(NOT ${optionalIndex} EQUAL -1)
+ set(module_state "optional")
+ endif()
+ else()
+ set(module_state "essential")
+ endif()
+
+ if(${_name_found})
+ message(STATUS "${module_state} module ${name} found (${ARGN})")
# record the shortnames for the tests
list(APPEND all_module_shortnames ${shortname})
else()
- if("${ARGN}" STREQUAL "opt")
+ if("${module_state}" STREQUAL "optional")
message(STATUS "optional module ${name} skipped")
- elseif("${ARGN}" STREQUAL "essential")
+ elseif("${module_state}" STREQUAL "essential")
message(STATUS "skipped module ${name} is essential!\n"
" We do not guarantee that all tests are working.")
else()
@@ -244,59 +256,43 @@ macro(COLLECT_MODULE_IF_FOUND shortname)
endif()
endmacro()
+# Set default values for pyside2_global.h
+set (Qt5X11Extras_FOUND "0")
+set (Qt5Test_FOUND "0")
+set (Qt5Widgets_FOUND "0")
+
+# Collect all essential modules.
# 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)
-COLLECT_MODULE_IF_FOUND(Concurrent essential)
+set(ALL_ESSENTIAL_MODULES Core Gui Widgets PrintSupport Sql Network Test Concurrent)
if(UNIX AND NOT APPLE)
- COLLECT_MODULE_IF_FOUND(X11Extras essential)
+ list(APPEND ALL_ESSENTIAL_MODULES X11Extras)
endif()
if(WIN32)
- COLLECT_MODULE_IF_FOUND(WinExtras essential)
+ list(APPEND ALL_ESSENTIAL_MODULES WinExtras)
endif()
if(APPLE)
- COLLECT_MODULE_IF_FOUND(MacExtras essential)
+ list(APPEND ALL_ESSENTIAL_MODULES MacExtras)
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)
-COLLECT_MODULE_IF_FOUND(ScriptTools opt)
-COLLECT_MODULE_IF_FOUND(TextToSpeech opt)
-COLLECT_MODULE_IF_FOUND(Charts opt)
-COLLECT_MODULE_IF_FOUND(Svg opt)
-COLLECT_MODULE_IF_FOUND(DataVisualization opt)
+
+# Collect all optional modules.
+set(ALL_OPTIONAL_MODULES Xml XmlPatterns Help Multimedia MultimediaWidgets OpenGL Qml Quick QuickWidgets Script ScriptTools TextToSpeech Charts Svg DataVisualization)
find_package(Qt5UiTools)
if(Qt5UiTools_FOUND)
- COLLECT_MODULE_IF_FOUND(UiTools opt)
+ list(APPEND ALL_OPTIONAL_MODULES UiTools)
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)
+list(APPEND ALL_OPTIONAL_MODULES WebChannel WebEngineWidgets WebKit WebKitWidgets WebSockets)
+
+# Modules to be built unless specified by -DMODULES on command line
+if (NOT MODULES)
+ set(MODULES "${ALL_ESSENTIAL_MODULES};${ALL_OPTIONAL_MODULES}")
+endif()
+
+foreach(m ${MODULES})
+ COLLECT_MODULE_IF_FOUND(${m})
+endforeach()
string(REGEX MATCHALL "[0-9]+" qt_version_helper "${Qt5Core_VERSION}")