From 684fea131433dcbb6d24feaf261404d1d9cf69b4 Mon Sep 17 00:00:00 2001 From: Toni Saario Date: Wed, 27 May 2020 16:24:24 +0300 Subject: CMake: Add instructions to re-use host artifacts for target builds We don't want to build the host Qt configuration every single time we do a cross-build in Coin. Coin learned some new qt5.git platform configuration options, which allow specifying a dependency between a host Coin configuration and a target one. This means we can specify a host macOS config as a dependency when building iOS, and the host artifacts for all dependent repos (qtbase, qtsvg, qtdeclarative, etc) will be installed into /home/qt/work/install (as specified by the {{.AgentWorkingDir}}/install location). Same for Linux + Android and Linux + qemu. Modify the qtbase Coin instructions to use these installed host artifacts if such a dependency is present (platformDependency is not null). The target artifacts will be installed into a subfolder of the host installation, called 'target', e.g. /home/qt/work/install/target. If a dependency is not present, continue to build a host Qt before doing a target build. This allows gradual conversion of configurations in case if some of them don't work, or if the dependencies.yaml have not propagated far enough for all new repos to use the new instructions. In this case the locations of the artifacts are different host - /home/qt/work/install/host target - /home/qt/work/install/target Task-number: QTBUG-85623 Change-Id: I33539f4376034539fb7db80293dc4d39dcb9539b Reviewed-by: Cristian Adam --- ...ross_compilation_module_build_instructions.yaml | 56 +++++++++------- ...ross_compilation_qtbase_build_instructions.yaml | 76 ++++++++++++++-------- 2 files changed, 79 insertions(+), 53 deletions(-) (limited to 'coin') diff --git a/coin/instructions/cmake_cross_compilation_module_build_instructions.yaml b/coin/instructions/cmake_cross_compilation_module_build_instructions.yaml index a5ff61f153..c6bfa4d59a 100644 --- a/coin/instructions/cmake_cross_compilation_module_build_instructions.yaml +++ b/coin/instructions/cmake_cross_compilation_module_build_instructions.yaml @@ -6,33 +6,39 @@ instructions: directory: build - type: ChangeDirectory directory: "{{.BuildDir}}/build" - - type: MakeDirectory - directory: host - type: MakeDirectory directory: target - - type: SetBuildDirectory - directory: "{{.SourceDir}}/build/host" - - type: ChangeDirectory - directory: "{{.BuildDir}}" - - type: EnvironmentVariable - variableName: COIN_CMAKE_ARGS - # The lack of space between the non qtbase configure args and the rest of the args is important! - variableValue: "{{.Env.NON_QTBASE_CONFIGURE_ARGS}} -DBUILD_TESTING=OFF {{.SourceDir}}" - - !include "{{qt/qtbase}}/call_host_cmake.yaml" - - type: ExecuteCommand - command: "{{.Env.ENV_PREFIX}} cmake --build . --parallel -v" - maxTimeInSeconds: 6000 - maxTimeBetweenOutput: 1200 - userMessageOnFailure: > - Failed to build sources. In the current state bug can be everywhere. - - type: EnvironmentVariable - variableName: COIN_CMAKE_INSTALL_SCRIPT_PATH - variableValue: "{{.InstallDir}}/host" - - !include "{{qt/qtbase}}/call_host_install.yaml" - - type: EnvironmentVariable - variableName: DESTDIR - variableValue: "{{.InstallRoot}}" - - !include "{{qt/qtbase}}/call_host_install.yaml" + - type: Group + instructions: + - type: MakeDirectory + directory: host + - type: SetBuildDirectory + directory: "{{.SourceDir}}/build/host" + - type: ChangeDirectory + directory: "{{.BuildDir}}" + - type: EnvironmentVariable + variableName: COIN_CMAKE_ARGS + # The lack of space between the non qtbase configure args and the rest of the args is important! + variableValue: "{{.Env.NON_QTBASE_CONFIGURE_ARGS}} -DBUILD_TESTING=OFF {{.SourceDir}}" + - !include "{{qt/qtbase}}/call_host_cmake.yaml" + - type: ExecuteCommand + command: "{{.Env.ENV_PREFIX}} cmake --build . --parallel -v" + maxTimeInSeconds: 6000 + maxTimeBetweenOutput: 1200 + userMessageOnFailure: > + Failed to build sources. In the current state bug can be everywhere. + - type: EnvironmentVariable + variableName: COIN_CMAKE_INSTALL_SCRIPT_PATH + variableValue: "{{.InstallDir}}/host" + - !include "{{qt/qtbase}}/call_host_install.yaml" + - type: EnvironmentVariable + variableName: DESTDIR + variableValue: "{{.InstallRoot}}" + - !include "{{qt/qtbase}}/call_host_install.yaml" + enable_if: + condition: property + property: platformDependency + equals_value: null - type: EnvironmentVariable variableName: DESTDIR variableValue: "" diff --git a/coin/instructions/cmake_cross_compilation_qtbase_build_instructions.yaml b/coin/instructions/cmake_cross_compilation_qtbase_build_instructions.yaml index 6a51bdc975..bb9ac0acf9 100644 --- a/coin/instructions/cmake_cross_compilation_qtbase_build_instructions.yaml +++ b/coin/instructions/cmake_cross_compilation_qtbase_build_instructions.yaml @@ -6,35 +6,41 @@ instructions: directory: build - type: ChangeDirectory directory: "{{.BuildDir}}/build" - - type: MakeDirectory - directory: host - type: MakeDirectory directory: target - - type: SetBuildDirectory - directory: "{{.SourceDir}}/build/host" - - type: ChangeDirectory - directory: "{{.BuildDir}}" - - type: ExecuteCommand - command: "{{.Env.ENV_PREFIX}} cmake {{.Env.CONFIGURE_ARGS}} -DCMAKE_INSTALL_PREFIX:PATH={{.InstallDir}}/host -DBUILD_TESTING=OFF {{.SourceDir}}" - executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution - maxTimeInSeconds: 6000 - maxTimeBetweenOutput: 1200 - userMessageOnFailure: > - Failed to call cmake. - - type: ExecuteCommand - command: "{{.Env.ENV_PREFIX}} cmake --build . --parallel -v" - maxTimeInSeconds: 6000 - maxTimeBetweenOutput: 1200 - userMessageOnFailure: > - Failed to build sources. In the current state bug can be everywhere. - - type: EnvironmentVariable - variableName: COIN_CMAKE_INSTALL_SCRIPT_PATH - variableValue: "{{.BuildDir}}" - - !include "{{qt/qtbase}}/call_host_install.yaml" - - type: EnvironmentVariable - variableName: DESTDIR - variableValue: "{{.InstallRoot}}" - - !include "{{qt/qtbase}}/call_host_install.yaml" + - type: Group + instructions: + - type: MakeDirectory + directory: host + - type: SetBuildDirectory + directory: "{{.SourceDir}}/build/host" + - type: ChangeDirectory + directory: "{{.BuildDir}}" + - type: ExecuteCommand + command: "{{.Env.ENV_PREFIX}} cmake {{.Env.CONFIGURE_ARGS}} -DCMAKE_INSTALL_PREFIX:PATH={{.InstallDir}}/host -DBUILD_TESTING=OFF {{.SourceDir}}" + executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution + maxTimeInSeconds: 6000 + maxTimeBetweenOutput: 1200 + userMessageOnFailure: > + Failed to call cmake. + - type: ExecuteCommand + command: "{{.Env.ENV_PREFIX}} cmake --build . --parallel -v" + maxTimeInSeconds: 6000 + maxTimeBetweenOutput: 1200 + userMessageOnFailure: > + Failed to build sources. In the current state bug can be everywhere. + - type: EnvironmentVariable + variableName: COIN_CMAKE_INSTALL_SCRIPT_PATH + variableValue: "{{.BuildDir}}" + - !include "{{qt/qtbase}}/call_host_install.yaml" + - type: EnvironmentVariable + variableName: DESTDIR + variableValue: "{{.InstallRoot}}" + - !include "{{qt/qtbase}}/call_host_install.yaml" + enable_if: + condition: property + property: platformDependency + equals_value: null - type: EnvironmentVariable variableName: DESTDIR variableValue: "" @@ -42,8 +48,22 @@ instructions: directory: "{{.SourceDir}}/build/target" - type: ChangeDirectory directory: "{{.BuildDir}}" + - type: AppendToEnvironmentVariable + variableName: TARGET_CONFIGURE_ARGS + variableValue: " -DQT_HOST_PATH={{.AgentWorkingDir}}/install" + disable_if: + condition: property + property: platformDependency + equals_value: null + - type: AppendToEnvironmentVariable + variableName: TARGET_CONFIGURE_ARGS + variableValue: " -DQT_HOST_PATH={{.InstallDir}}/host" + enable_if: + condition: property + property: platformDependency + equals_value: null - type: ExecuteCommand - command: "{{.Env.TARGET_ENV_PREFIX}} cmake {{.Env.TARGET_CONFIGURE_ARGS}} -DQT_HOST_PATH={{.InstallDir}}/host -DCMAKE_INSTALL_PREFIX:PATH={{.InstallDir}}/target -DBUILD_TESTING=OFF {{.SourceDir}}" + command: "{{.Env.TARGET_ENV_PREFIX}} cmake {{.Env.TARGET_CONFIGURE_ARGS}} -DCMAKE_INSTALL_PREFIX:PATH={{.InstallDir}}/target -DBUILD_TESTING=OFF {{.SourceDir}}" executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution maxTimeInSeconds: 6000 maxTimeBetweenOutput: 1200 -- cgit v1.2.3