forked from qt-creator/qt-creator
COIN: Add hack to support debug info with sccache and MSVC
sccache does not support the "/Zi /FS" option for debug information with MSVC. Optionally replace "/Zi" by "/Z7", which leaves debug information in the object files and only collects it at link time. See also qtbase 2354274f39934b94383923834479901106489def. Change-Id: Id94c2116f3c4192556dbdf8fe82b12ce0a204273 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -22,6 +22,8 @@ set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
qtc_handle_sccache_support()
|
||||
|
||||
option(WITH_TESTS "Build Tests" OFF)
|
||||
add_feature_info("Build tests" ${WITH_TESTS} "")
|
||||
option(WITH_DEBUG_CMAKE "Enabled CMake project debugging functionality (e.g. source file disk checking)" OFF)
|
||||
|
||||
@@ -40,6 +40,7 @@ option(BUILD_PLUGINS_BY_DEFAULT "Build plugins by default. This can be used to b
|
||||
option(BUILD_EXECUTABLES_BY_DEFAULT "Build executables by default. This can be used to build all executables by default, or none." ON)
|
||||
option(BUILD_LIBRARIES_BY_DEFAULT "Build libraries by default. This can be used to build all libraries by default, or none." ON)
|
||||
option(QTC_SEPARATE_DEBUG_INFO "Extract debug information from binary files." OFF)
|
||||
option(WITH_SCCACHE_SUPPORT "Enables support for building with SCCACHE and separate debug info with MSVC, which SCCACHE normally doesn't support." OFF)
|
||||
|
||||
# If we provide a list of plugins, executables, libraries, then the BUILD_<type>_BY_DEFAULT will be set to OFF
|
||||
# and for every element we set BUILD_<type>_<elment> to ON
|
||||
|
||||
@@ -103,6 +103,25 @@ set(__QTC_LIBRARIES "" CACHE INTERNAL "*** Internal ***")
|
||||
set(__QTC_EXECUTABLES "" CACHE INTERNAL "*** Internal ***")
|
||||
set(__QTC_TESTS "" CACHE INTERNAL "*** Internal ***")
|
||||
|
||||
# handle SCCACHE hack
|
||||
# SCCACHE does not work with the /Zi option, which makes each compilation write debug info
|
||||
# into the same .pdb file - even with /FS, which usually makes this work in the first place.
|
||||
# Replace /Zi with /Z7, which leaves the debug info in the object files until link time.
|
||||
# This increases memory usage, disk space usage and linking time, so should only be
|
||||
# enabled if necessary.
|
||||
# Must be called after project(...).
|
||||
function(qtc_handle_sccache_support)
|
||||
if (MSVC AND WITH_SCCACHE_SUPPORT)
|
||||
foreach(config DEBUG RELWITHDEBINFO)
|
||||
foreach(lang C CXX)
|
||||
set(flags_var "CMAKE_${lang}_FLAGS_${config}")
|
||||
string(REPLACE "/Zi" "/Z7" ${flags_var} "${${flags_var}}")
|
||||
set(${flags_var} "${${flags_var}}" PARENT_SCOPE)
|
||||
endforeach()
|
||||
endforeach()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(append_extra_translations target_name)
|
||||
if(NOT ARGN)
|
||||
return()
|
||||
|
||||
@@ -4,7 +4,7 @@ instructions:
|
||||
instructions:
|
||||
- type: EnvironmentVariable
|
||||
variableName: QTC_BUILD_TYPE
|
||||
variableValue: "Release"
|
||||
variableValue: "RelWithDebInfo"
|
||||
- type: EnvironmentVariable
|
||||
variableName: QTC_QT_BASE_URL
|
||||
variableValue: "http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/archive/qt/6.1/6.1.0-beta3-released"
|
||||
|
||||
@@ -92,7 +92,7 @@ instructions:
|
||||
maxTimeBetweenOutput: 360
|
||||
userMessageOnFailure: "Failed to extract LLVM package, check logs."
|
||||
- type: ExecuteCommand
|
||||
command: "python -u {{.AgentWorkingDir}}\\qt-creator\\qt-creator\\scripts\\build.py --build-type {{.Env.QTC_BUILD_TYPE}} --src {{.AgentWorkingDir}}\\qt-creator\\qt-creator --build {{.AgentWorkingDir}}\\qt-creator\\qt-creator_build --qt-path {{.AgentWorkingDir}}/build/qt5_install_dir --python-path {{.AgentWorkingDir}}\\build\\qt_temp\\python --elfutils-path {{.AgentWorkingDir}}\\buid\\qt_temp\\elfutils --llvm-path {{.AgentWorkingDir}}\\build\\qt_temp\\libclang --add-config=-DCMAKE_C_COMPILER_LAUNCHER=sccache --add-config=-DCMAKE_CXX_COMPILER_LAUNCHER=sccache"
|
||||
command: "python -u {{.AgentWorkingDir}}\\qt-creator\\qt-creator\\scripts\\build.py --build-type {{.Env.QTC_BUILD_TYPE}} --src {{.AgentWorkingDir}}\\qt-creator\\qt-creator --build {{.AgentWorkingDir}}\\qt-creator\\qt-creator_build --qt-path {{.AgentWorkingDir}}/build/qt5_install_dir --python-path {{.AgentWorkingDir}}\\build\\qt_temp\\python --elfutils-path {{.AgentWorkingDir}}\\buid\\qt_temp\\elfutils --llvm-path {{.AgentWorkingDir}}\\build\\qt_temp\\libclang --add-config=-DCMAKE_C_COMPILER_LAUNCHER=sccache --add-config=-DCMAKE_CXX_COMPILER_LAUNCHER=sccache --add-config=-DWITH_SCCACHE_SUPPORT=ON"
|
||||
maxTimeInSeconds: 36000
|
||||
maxTimeBetweenOutput: 3600
|
||||
userMessageOnFailure: "Failed to run build.py, check logs."
|
||||
|
||||
Reference in New Issue
Block a user