diff options
| author | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-11-12 19:14:51 +0100 |
|---|---|---|
| committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-11-15 11:53:47 +0100 |
| commit | 037e50c063c1a63d0d09482b8e166ccec2bd13c0 (patch) | |
| tree | 19835ab6ce636e187166a46550ebff41decf3f60 | |
| parent | 9594789fcc58cb250900c935e1adb4b2ce9ed8b6 (diff) | |
setup: coin: Use sccache when building if the platform config sets it
Set the CI_USE_SCCACHE env var if the sccache feature is enabled
for the platform config.
Pipe that through coin_build_instructions.py to setup.py.
Add the relevant CMake cache vars so sccache is used.
Pick-to: 6.2
Change-Id: I02d7ff0646791a5f0d2f1dd5c4a119ee016a9896
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Tismer <tismer@stackless.com>
| -rw-r--r-- | build_scripts/main.py | 5 | ||||
| -rw-r--r-- | build_scripts/options.py | 3 | ||||
| -rw-r--r-- | coin/instructions/common_environment.yaml | 7 | ||||
| -rw-r--r-- | coin/instructions/execute_build_instructions.yaml | 8 | ||||
| -rw-r--r-- | coin_build_instructions.py | 5 |
5 files changed, 24 insertions, 4 deletions
diff --git a/build_scripts/main.py b/build_scripts/main.py index 7b913ee73..a53ff0328 100644 --- a/build_scripts/main.py +++ b/build_scripts/main.py @@ -805,6 +805,11 @@ class PysideBuild(_build, DistUtilsCommandMixin): if OPTION["VERBOSE_BUILD"]: cmake_cmd.append("-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON") + if OPTION['COMPILER_LAUNCHER']: + compiler_launcher = OPTION['COMPILER_LAUNCHER'] + cmake_cmd.append(f"-DCMAKE_C_COMPILER_LAUNCHER={compiler_launcher}") + cmake_cmd.append(f"-DCMAKE_CXX_COMPILER_LAUNCHER={compiler_launcher}") + if OPTION["SANITIZE_ADDRESS"]: # Some simple sanity checking. Only use at your own risk. if (sys.platform.startswith('linux') diff --git a/build_scripts/options.py b/build_scripts/options.py index 46db56ddc..068bd62ab 100644 --- a/build_scripts/options.py +++ b/build_scripts/options.py @@ -200,6 +200,7 @@ class DistUtilsCommandMixin(object): ('build-tests', None, 'Build tests'), ('use-xvfb', None, 'Use Xvfb for testing'), ('reuse-build', None, 'Reuse existing build'), + ('compiler-launcher=', None, 'Use a compiler launcher like ccache or sccache for builds'), ('skip-cmake', None, 'Skip CMake step'), ('skip-make-install', None, 'Skip install step'), ('skip-packaging', None, 'Skip packaging step'), @@ -239,6 +240,7 @@ class DistUtilsCommandMixin(object): self.build_tests = False self.use_xvfb = False self.reuse_build = False + self.compiler_launcher = None self.skip_cmake = False self.skip_make_install = False self.skip_packaging = False @@ -289,6 +291,7 @@ class DistUtilsCommandMixin(object): OPTION['NO_JOM'] = self.no_jom OPTION['XVFB'] = self.use_xvfb OPTION['REUSE_BUILD'] = self.reuse_build + OPTION['COMPILER_LAUNCHER'] = self.compiler_launcher OPTION['SKIP_CMAKE'] = self.skip_cmake OPTION['SKIP_MAKE_INSTALL'] = self.skip_make_install OPTION['SKIP_PACKAGING'] = self.skip_packaging diff --git a/coin/instructions/common_environment.yaml b/coin/instructions/common_environment.yaml index 828891674..9bca255e6 100644 --- a/coin/instructions/common_environment.yaml +++ b/coin/instructions/common_environment.yaml @@ -49,6 +49,13 @@ instructions: property: features contains_value: Packaging - type: EnvironmentVariable + variableName: CI_USE_SCCACHE + variableValue: "--compiler-launcher=sccache" + enable_if: + condition: property + property: features + contains_value: Sccache + - type: EnvironmentVariable variableName: CI_OS variableValue: "MacOS" enable_if: diff --git a/coin/instructions/execute_build_instructions.yaml b/coin/instructions/execute_build_instructions.yaml index f26499027..8b1789728 100644 --- a/coin/instructions/execute_build_instructions.yaml +++ b/coin/instructions/execute_build_instructions.yaml @@ -1,7 +1,7 @@ type: Group instructions: - type: ExecuteCommand - command: "python3 -u coin_build_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} --instdir=/Users/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}} --phase=ALL" + command: "python3 -u coin_build_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} {{.Env.CI_USE_SCCACHE}} --instdir=/Users/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}} --phase=ALL" maxTimeInSeconds: 14400 maxTimeBetweenOutput: 1200 enable_if: @@ -11,7 +11,7 @@ instructions: userMessageOnFailure: > Failed to execute build instructions on osx - type: ExecuteCommand - command: "python3 -u coin_build_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} --instdir=/home/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}} --phase=ALL" + command: "python3 -u coin_build_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} {{.Env.CI_USE_SCCACHE}} --instdir=/home/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}} --phase=ALL" maxTimeInSeconds: 14400 maxTimeBetweenOutput: 600 enable_if: @@ -21,7 +21,7 @@ instructions: userMessageOnFailure: > Failed to execute build instructions on Linux - type: ExecuteCommand - command: "c:\\users\\qt\\MSVC.bat {{.Env.PYTHON3_PATH}}\\python.exe -u coin_build_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} --instdir=\\Users\\qt\\work\\install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}} --phase=BUILD" + command: "c:\\users\\qt\\MSVC.bat {{.Env.PYTHON3_PATH}}\\python.exe -u coin_build_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} {{.Env.CI_USE_SCCACHE}} --instdir=\\Users\\qt\\work\\install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}} --phase=BUILD" maxTimeInSeconds: 14400 maxTimeBetweenOutput: 600 enable_if: @@ -45,7 +45,7 @@ instructions: property: host.os equals_value: Windows - type: ExecuteCommand - command: "c:\\users\\qt\\MSVC.bat {{.Env.PYTHON3_PATH}}\\python.exe -u coin_build_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} --instdir=\\Users\\qt\\work\\install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}} --phase=WHEEL" + command: "c:\\users\\qt\\MSVC.bat {{.Env.PYTHON3_PATH}}\\python.exe -u coin_build_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} {{.Env.CI_USE_SCCACHE}} --instdir=\\Users\\qt\\work\\install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}} --phase=WHEEL" maxTimeInSeconds: 14400 maxTimeBetweenOutput: 300 enable_if: diff --git a/coin_build_instructions.py b/coin_build_instructions.py index f08926763..c879ffde5 100644 --- a/coin_build_instructions.py +++ b/coin_build_instructions.py @@ -61,6 +61,7 @@ CI_HOST_OS_VER = option_value("osVer") CI_ENV_INSTALL_DIR = option_value("instdir") CI_ENV_AGENT_DIR = option_value("agentdir") CI_COMPILER = option_value("compiler") +CI_USE_SCCACHE = option_value("compiler-launcher") CI_INTEGRATION_ID = option_value("coinIntegrationId") or str(calendar.timegm(datetime.datetime.now().timetuple())) CI_FEATURES = [] _ci_features = option_value("features") @@ -147,6 +148,10 @@ def call_setup(python_ver, phase): cmd += ["--build-tests", "--parallel=4", "--verbose-build"] + + if CI_USE_SCCACHE: + cmd += [f"--compiler-launcher={CI_USE_SCCACHE}"] + if python_ver == "3": cmd += ["--limited-api=yes"] if is_snapshot_build(): |
