From 397fdf56b7c409ea2d3dfd687a3ebdf319baa95d Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Wed, 27 Apr 2022 23:50:50 -0500 Subject: [PATCH] Add Linux arm & x86 clang cross compile defs. --- .ci/azp-linux-extra.yml | 20 +++++++++++++++++++ azure-pipelines.yml | 16 +++++++++++++++ src/tools/clang.jam | 43 +++++++++++++++++++++++++---------------- 3 files changed, 62 insertions(+), 17 deletions(-) create mode 100644 .ci/azp-linux-extra.yml diff --git a/.ci/azp-linux-extra.yml b/.ci/azp-linux-extra.yml new file mode 100644 index 000000000..256da8df3 --- /dev/null +++ b/.ci/azp-linux-extra.yml @@ -0,0 +1,20 @@ +steps: + - bash: | + set -e + uname -a + ./.ci/linux-cxx-install.sh + displayName: Install + - bash: | + set -e + ./bootstrap.sh ${TOOLSET} + ./b2 --prefix=$HOME/temp/.b2 install toolset=${TOOLSET} + rm ./b2 + export PATH=$HOME/temp/.b2/bin:$PATH + cd $HOME + touch build.jam + b2 -v + b2 -n --debug-configuration toolset=${TOOLSET} + displayName: Bootstrap + - { bash: "./.ci/b2_example.sh example/hello", displayName: "example/hello" } + - { bash: "./.ci/b2_example.sh example/libraries", displayName: "example/libraries" } + - { bash: "./.ci/b2_example.sh example/make", displayName: "example/make" } diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9213599a1..fc9a99c74 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -142,6 +142,22 @@ stages: steps: - template: .ci/azp-macos-extra.yml + - job: 'Linux' + strategy: + matrix: + Clang ${{variables.clang_latest}} x86/64: { + B2_ARGS: "architecture=x86 address-model=64", + TOOLSET: "clang-${{variables.clang_latest}}", PACKAGES: "clang-${{variables.clang_latest}}", + LLVM_OS: "${{variables.linux_latest_os}}", LLVM_VER: "${{variables.clang_latest}}", VM_IMAGE: "${{variables.linux_latest_vm}}"} + Clang ${{variables.clang_latest}} x86/32: { + B2_ARGS: "architecture=x86 address-model=32", + TOOLSET: "clang-${{variables.clang_latest}}", PACKAGES: "clang-${{variables.clang_latest}}", + LLVM_OS: "${{variables.linux_latest_os}}", LLVM_VER: "${{variables.clang_latest}}", VM_IMAGE: "${{variables.linux_latest_vm}}"} + pool: + vmImage: $(VM_IMAGE) + steps: + - template: .ci/azp-linux-extra.yml + - stage: Website_Update dependsOn: [Core, Extra] displayName: 'Website Update' diff --git a/src/tools/clang.jam b/src/tools/clang.jam index b982bcff2..269bd19bf 100644 --- a/src/tools/clang.jam +++ b/src/tools/clang.jam @@ -67,34 +67,43 @@ rule init-cxxstd-flags ( toolset : condition * : version ) cxxstd-flags $(toolset) : $(condition)/latest/$(dialects) : -std=c++$(std) ; } -local rule init-flags-cross ( toolset : condition * : architecture address-model target-os ) +local rule init-flags-cross ( toolset : condition * : architecture + : address-model + : target-os ) { - local arch ; - local vendor ; - local sys ; - switch $(architecture)-$(address-model) - { - case arm-64 : arch = arm64 ; - case arm-32 : arch = arm ; - case x86-64 : arch = x86_64 ; - case x86-32 : arch = i386 ; - } + local vendor = unknown ; + local sys = unknown ; switch $(target-os) { case darwin : vendor = apple ; sys = darwin ; + case linux : vendor = pc ; sys = linux ; + } + local vendor-sys = $(vendor)-$(sys) ; + for local _architecture_ in $(architecture) + { + for local _address-model_ in $(address-model) + { + local arch = unknown ; + switch $(_architecture_)-$(_address-model_) + { + case arm-64 : arch = arm64 ; + case arm-32 : arch = arm ; + case x86-64 : arch = x86_64 ; + case x86-32 : arch = i386 ; + } + + toolset.flags $(toolset) + OPTIONS $(condition)/$(target-os)/$(_architecture_)/$(_address-model_) + : "--target=$(arch)-$(vendor-sys)" + : unchecked ; + } } - toolset.flags $(toolset) - OPTIONS $(condition)/$(target-os)/$(architecture)/$(address-model) - : "--target=$(arch)-$(vendor)-$(sys)" - : unchecked ; } rule init-flags ( toolset : condition * : version ) { init-cxxstd-flags $(toolset) : $(condition) : $(version) ; - init-flags-cross $(toolset) : $(condition) : arm 64 darwin ; - init-flags-cross $(toolset) : $(condition) : x86 64 darwin ; + init-flags-cross $(toolset) : $(condition) : arm x86 : 64 : darwin ; + init-flags-cross $(toolset) : $(condition) : arm x86 : 64 32 : linux ; # This is a remporary solution for doing combined architecture builds on macOS. toolset.flags $(toolset)