summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2023-02-15 15:36:44 +0100
committerAlexey Edelev <alexey.edelev@qt.io>2023-06-27 17:27:28 +0000
commita8cf976ce6c82192bdf2d4b310e9ba0ea75bd0b0 (patch)
tree6d325adb33aeef6ceb52fa2c3a4ca6af2f4e184a /src/tools
parentb3f27f75b638c6eb8494d681cd4df50dd34bcac0 (diff)
Introduce QT_SYNC_HEADERS_AT_CONFIGURE_TIME flag
The syncqt tool was originally designed to run at build time, as a part of dependency chain of Qt modules. This works well unless we need the code model of the Qt project in IDE, since Qt source code actively uses header aliases, and creating them at build time breaks the code model until the initial build is done. So we made syncqt the configure time tool to not break the developer experience. It's more likely that developers build Qt using command line or don't need the code model before the first build. So running the tool at configure time should be optional. QT_SYNC_HEADERS_AT_CONFIGURE_TIME switches the "mode" of the syncqt tool from build time tool to the configure time tool. Without the option enabled build procedure runs all the syncing targets at build time only. The exception are the developer builds, if the '-developer-build' option is enabled, QT_SYNC_HEADERS_AT_CONFIGURE_TIME is set to TRUE by default. This gives better development experience for the developers that don't use the code model in their IDE or don't require it before the first build is finished. Also this build time mode is preferred for the CI or similar build procedures where code model is not required at all. By default, the option initialized from the QT_INTERNAL_CONFIGURE_FROM_IDE CMake variable. TODO: The option is forced to TRUE for the static Ninja Multi-Config builds. See QTBUG-113974 for details. [ChangeLog][Build System] When building Qt from sources, syncqt and Qt header files are now created at build time, not configure time. This should speed up the configuration step. You can set the CMake variable QT_CONFIGURE_TIME_SYNC_HEADERS to ON to use the previous behavior, though. The old behavior is also preserved if cmake/configure is run from inside an IDE - Qt Creator, Visual Studio Code, and CLion are currently detected. Task-number: QTBUG-111163 Task-number: QTBUG-109792 Pick-to: 6.6 Change-Id: Ib61bda9546e58492be874a8591c37e100313d02c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/syncqt/CMakeLists.txt60
1 files changed, 36 insertions, 24 deletions
diff --git a/src/tools/syncqt/CMakeLists.txt b/src/tools/syncqt/CMakeLists.txt
index 3740b1bd4d..9cdbec8841 100644
--- a/src/tools/syncqt/CMakeLists.txt
+++ b/src/tools/syncqt/CMakeLists.txt
@@ -11,29 +11,41 @@ set(compile_definitions
QT_NAMESPACE="${QT_NAMESPACE}"
)
-set(config_type "")
-if(NOT QT_INTERNAL_AVOID_OVERRIDING_SYNCQT_CONFIG)
- set(config_type CONFIG RelWithDebInfo)
-endif()
-
-if(CMAKE_OSX_ARCHITECTURES)
- set(osx_architectures "-DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES}")
-endif()
qt_get_tool_target_name(target_name syncqt)
-# Note: configure-time tools reserve the original tool name for the imported executable.
-# To re-build syncqt use 'syncqt_build' target.
-qt_internal_add_configure_time_tool(${target_name}
- DEFINES ${compile_definitions}
- COMPILE_OPTIONS ${optimize_full_flags}
- TOOLS_TARGET Core
- INSTALL_DIRECTORY "${INSTALL_LIBEXECDIR}"
- CMAKE_FLAGS
- -DCMAKE_CXX_STANDARD_REQUIRED:BOOL=TRUE
- -DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD}
- # std::filesystem API is only available in macOS 10.15+
- -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.15
- "${osx_architectures}"
- SOURCES
+if(NOT QT_SYNC_HEADERS_AT_CONFIGURE_TIME)
+ qt_internal_add_tool(${target_name}
+ DEFINES ${compile_definitions}
+ COMPILE_OPTIONS ${optimize_full_flags}
+ TOOLS_TARGET Core
+ CORE_LIBRARY None
+ INSTALL_DIR "${INSTALL_LIBEXECDIR}"
+ SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/main.cpp"
- ${config_type}
-)
+ )
+else()
+ set(config_type "")
+ if(NOT QT_INTERNAL_AVOID_OVERRIDING_SYNCQT_CONFIG)
+ set(config_type CONFIG RelWithDebInfo)
+ endif()
+
+ if(CMAKE_OSX_ARCHITECTURES)
+ set(osx_architectures "-DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES}")
+ endif()
+ # Note: configure-time tools reserve the original tool name for the imported executable.
+ # To re-build syncqt use 'syncqt_build' target.
+ qt_internal_add_configure_time_tool(${target_name}
+ DEFINES ${compile_definitions}
+ COMPILE_OPTIONS ${optimize_full_flags}
+ TOOLS_TARGET Core
+ INSTALL_DIRECTORY "${INSTALL_LIBEXECDIR}"
+ CMAKE_FLAGS
+ -DCMAKE_CXX_STANDARD_REQUIRED:BOOL=TRUE
+ -DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD}
+ # std::filesystem API is only available in macOS 10.15+
+ -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.15
+ "${osx_architectures}"
+ SOURCES
+ "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp"
+ ${config_type}
+ )
+endif()