Skip to content

Commit 10735d6

Browse files
committed
CMake: Split QtBuild.cmake into smaller files v2
My motivation to do this: - it got big and tangled again - sometimes functions need to be added to QtBuild.cmake rather than to a separate file because they need to be called before some of the global variables are set, to determine the value of those global variables (in my case install paths needed to be modified when building with xcframework support) - some of the global variable assignments have dependencies on other variables already being set and it's hard to keep track where that happens Split the contents of the file into smaller functions and macros and place them into pre-existing files when appropriate, or into new files. The new files are: - QtBuildHelpers.cmake - QtBuildPathsHelpers.cmake - QtMkspecHelpers.cmake The idea is to have Helpers file only define functions and never call them, so it's easy to include the file where needed without being scared of side effects. QtBuild.cmake will just include the helpers and call one entry point function to set up everything that was done by the file before. QtBuild.cmake is not merged into QtSetup, to make it easier to git blame (it's hard to blame a removed file). No new features were added as part of the refactoring. Some function names were renamed (but not all of them) to include the qt_internal prefix. Some lines were reformatted so they don't pass 100 chars limit after the code was placed into a function / macro. The Helpers includes were re-sorted. Some function calls were re-ordered where the order call didn't matter. Some of the code in QtAndroidHelpers.cmake was wrapped into a macro so that including the file does not cause side-effects by default. I'd like to follow up with similar changes for QtSetup.cmake and QtBuildInternalsConfig.cmake where possible, because having a few "entry points" into building a Qt submodule is also confusing, especially for those that aren't familiar with the build system and why certain things go into certain places. The intent is to cherry-pick this also to 6.5 and 6.6. Amends 44cce1a Task-number: QTBUG-86035 Change-Id: I02ceff8ceb9b6e9c78bc85d6a42deb02fca3e46b Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Orkun Tokdemir <orkun.tokdemir@qt.io>
1 parent 55ce50c commit 10735d6

8 files changed

+766
-662
lines changed

cmake/QtAndroidHelpers.cmake

+82-81
Original file line numberDiff line numberDiff line change
@@ -5,87 +5,88 @@
55
# Android specific functions/macros/properties required for building Qt Modules
66
#
77

8-
define_property(TARGET
9-
PROPERTY
10-
QT_ANDROID_MODULE_INSTALL_DIR
11-
BRIEF_DOCS
12-
"Recorded install location for a Qt Module."
13-
FULL_DOCS
14-
"Recorded install location for a Qt Module. Used by qt_internal_android_dependencies()."
15-
)
16-
17-
18-
define_property(TARGET
19-
PROPERTY
20-
QT_ANDROID_JAR_DEPENDENCIES
21-
BRIEF_DOCS
22-
"Qt Module Jar dependencies list."
23-
FULL_DOCS
24-
"Qt Module Jar dependencies list."
25-
)
26-
27-
define_property(TARGET
28-
PROPERTY
29-
QT_ANDROID_BUNDLED_JAR_DEPENDENCIES
30-
BRIEF_DOCS
31-
"Qt Module Jars that should be bundled with it during packing."
32-
FULL_DOCS
33-
"Qt Module Jars that should be bundled with it during packing."
34-
)
35-
36-
define_property(TARGET
37-
PROPERTY
38-
QT_ANDROID_LIB_DEPENDENCIES
39-
BRIEF_DOCS
40-
"Qt Module C++ libraries that should be bundled with it during packing."
41-
FULL_DOCS
42-
"Qt Module C++ libraries that should be bundled with it during packing."
43-
)
44-
45-
define_property(TARGET
46-
PROPERTY
47-
QT_ANDROID_LIB_DEPENDENCY_REPLACEMENTS
48-
BRIEF_DOCS
49-
"Qt Module C++ libraries that can replace libraries declared with the QT_ANDROID_LIB_DEPENDENCIES property."
50-
FULL_DOCS
51-
"Qt Module C++ libraries that can replace libraries declared with the QT_ANDROID_LIB_DEPENDENCIES property."
52-
)
53-
54-
define_property(TARGET
55-
PROPERTY
56-
QT_ANDROID_BUNDLED_FILES
57-
BRIEF_DOCS
58-
"Qt Module files that need to be bundled during packing."
59-
FULL_DOCS
60-
"Qt Module files that need to be bundled during packing."
61-
)
62-
63-
define_property(TARGET
64-
PROPERTY
65-
QT_ANDROID_PERMISSIONS
66-
BRIEF_DOCS
67-
"Qt Module android permission list."
68-
FULL_DOCS
69-
"Qt Module android permission list."
70-
)
71-
72-
define_property(TARGET
73-
PROPERTY
74-
QT_ANDROID_FEATURES
75-
BRIEF_DOCS
76-
"Qt Module android feature list."
77-
FULL_DOCS
78-
"Qt Module android feature list."
79-
)
80-
81-
define_property(TARGET
82-
PROPERTY
83-
QT_ANDROID_ABIS
84-
BRIEF_DOCS
85-
"List of ABIs that the target packages are built with."
86-
FULL_DOCS
87-
"List of ABIs that the target packages are built with."
88-
)
8+
macro(qt_internal_setup_android_target_properties)
9+
define_property(TARGET
10+
PROPERTY
11+
QT_ANDROID_MODULE_INSTALL_DIR
12+
BRIEF_DOCS
13+
"Recorded install location for a Qt Module."
14+
FULL_DOCS
15+
"Recorded install location for a Qt Module. Used by qt_internal_android_dependencies()."
16+
)
17+
18+
define_property(TARGET
19+
PROPERTY
20+
QT_ANDROID_JAR_DEPENDENCIES
21+
BRIEF_DOCS
22+
"Qt Module Jar dependencies list."
23+
FULL_DOCS
24+
"Qt Module Jar dependencies list."
25+
)
26+
27+
define_property(TARGET
28+
PROPERTY
29+
QT_ANDROID_BUNDLED_JAR_DEPENDENCIES
30+
BRIEF_DOCS
31+
"Qt Module Jars that should be bundled with it during packing."
32+
FULL_DOCS
33+
"Qt Module Jars that should be bundled with it during packing."
34+
)
35+
36+
define_property(TARGET
37+
PROPERTY
38+
QT_ANDROID_LIB_DEPENDENCIES
39+
BRIEF_DOCS
40+
"Qt Module C++ libraries that should be bundled with it during packing."
41+
FULL_DOCS
42+
"Qt Module C++ libraries that should be bundled with it during packing."
43+
)
44+
45+
define_property(TARGET
46+
PROPERTY
47+
QT_ANDROID_LIB_DEPENDENCY_REPLACEMENTS
48+
BRIEF_DOCS
49+
"Qt Module C++ libraries that can replace libraries declared with the QT_ANDROID_LIB_DEPENDENCIES property."
50+
FULL_DOCS
51+
"Qt Module C++ libraries that can replace libraries declared with the QT_ANDROID_LIB_DEPENDENCIES property."
52+
)
53+
54+
define_property(TARGET
55+
PROPERTY
56+
QT_ANDROID_BUNDLED_FILES
57+
BRIEF_DOCS
58+
"Qt Module files that need to be bundled during packing."
59+
FULL_DOCS
60+
"Qt Module files that need to be bundled during packing."
61+
)
62+
63+
define_property(TARGET
64+
PROPERTY
65+
QT_ANDROID_PERMISSIONS
66+
BRIEF_DOCS
67+
"Qt Module android permission list."
68+
FULL_DOCS
69+
"Qt Module android permission list."
70+
)
71+
72+
define_property(TARGET
73+
PROPERTY
74+
QT_ANDROID_FEATURES
75+
BRIEF_DOCS
76+
"Qt Module android feature list."
77+
FULL_DOCS
78+
"Qt Module android feature list."
79+
)
80+
81+
define_property(TARGET
82+
PROPERTY
83+
QT_ANDROID_ABIS
84+
BRIEF_DOCS
85+
"List of ABIs that the target packages are built with."
86+
FULL_DOCS
87+
"List of ABIs that the target packages are built with."
88+
)
89+
endmacro()
8990

9091
function(qt_internal_android_dependencies_content target file_content_out)
9192
get_target_property(arg_JAR_DEPENDENCIES ${target} QT_ANDROID_JAR_DEPENDENCIES)

cmake/QtBaseGlobalTargets.cmake

+3
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ qt_copy_or_install(FILES
218218
cmake/QtAutogenHelpers.cmake
219219
cmake/QtBaseTopLevelHelpers.cmake
220220
cmake/QtBuild.cmake
221+
cmake/QtBuildHelpers.cmake
222+
cmake/QtBuildPathsHelpers.cmake
221223
cmake/QtBuildInformation.cmake
222224
cmake/QtCMakeHelpers.cmake
223225
cmake/QtCMakeVersionHelpers.cmake
@@ -247,6 +249,7 @@ qt_copy_or_install(FILES
247249
cmake/QtInstallHelpers.cmake
248250
cmake/QtJavaHelpers.cmake
249251
cmake/QtLalrHelpers.cmake
252+
cmake/QtMkspecHelpers.cmake
250253
cmake/QtModuleConfig.cmake.in
251254
cmake/QtModuleDependencies.cmake.in
252255
cmake/QtModuleHeadersCheck.cmake

0 commit comments

Comments
 (0)