Skip to content

Commit

Permalink
[azure-pipelines] CXX and CC variables on Dep stage
Browse files Browse the repository at this point in the history
  • Loading branch information
Raffaello committed May 10, 2020
1 parent c40e110 commit 1a94e6d
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 13 deletions.
3 changes: 1 addition & 2 deletions azure-pipelines/templates/cmake-gen-build-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ parameters:
steps:
- bash: |
mkdir -p build && cd build
CXX="${{ parameters.CXX }}" CC="${{ parameters.CC }}" cmake -DVCPKG_TARGET_TRIPLET=${{ parameters.triplet }} -DCMAKE_BUILD_TYPE=${{ parameters.build_type }} -DCMAKE_TOOLCHAIN_FILE=${{ parameters.vcpkg_cmake }} ${{ parameters.cmake_args }} ..
CC="${{ parameters.CC }}" CXX="${{ parameters.CXX }}" cmake -DVCPKG_TARGET_TRIPLET=${{ parameters.triplet }} -DCMAKE_BUILD_TYPE=${{ parameters.build_type }} -DCMAKE_TOOLCHAIN_FILE=${{ parameters.vcpkg_cmake }} ${{ parameters.cmake_args }} ..
displayName: cmake generator (UNIX)
condition: ne(variables['Agent.OS'], 'Windows_NT')
- bash: ${{ parameters.build_wrapper }} cmake --build .
Expand All @@ -53,7 +53,6 @@ steps:
- script: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars${{ parameters.arch }}.bat"
mkdir build & cd build
set CXX=${{ parameters.CXX}} & set CC=${{ parameters.CC }}
cmake -DVCPKG_TARGET_TRIPLET=${{ parameters.triplet }} -DCMAKE_IGNORE_PATH="${{ parameters.cmake_ignore_path }}" -G"Ninja" -DCMAKE_BUILD_TYPE=${{ parameters.build_type }} -DCMAKE_TOOLCHAIN_FILE=${{ parameters.vcpkg_cmake }} ${{ parameters.cmake_args }} ..
displayName: 'CMake generator (WIN)'
condition: eq(variables['Agent.OS'], 'Windows_NT')
Expand Down
23 changes: 15 additions & 8 deletions azure-pipelines/templates/dep-vcpkg-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,40 @@ parameters:
displayName: arch
type: string
default: ''


- name: CXX
type: string
default: ''

- name: CC
type: string
default: ''

- name: VCPKG_REMOVABLES
displayName: VCPKG_REMOVABLES
type: string
default: 'buildtrees docs downloads packages .git .github ports toolsrc triplets'

steps:
- checkout: none
- task: Cache@2
inputs:
key: '${{ parameters.vcpkg_key_cache }} | ${{ parameters.triplet }}'
path: "vcpkg"
cacheHitVar: CACHE_RESTORED
- template: 'vcpkg-cache-step.yml'
parameters:
vcpkg_key_cache: ${{ parameters.vcpkg_key_cache }}
triplet: ${{ parameters.triplet }}
- bash: test -d vcpkg || git clone https://github.com/Microsoft/vcpkg.git
displayName: clone vcpkg
- script: echo "installing packages ${{ parameters.packages }}"
displayName: packages
- bash: |
./bootstrap-vcpkg.sh
./vcpkg install ${{ parameters.packages }} --triplet ${{ parameters.triplet }}
CXX="${{ parameters.CXX }}" CC="${{ parameters.CC }}" ./vcpkg install ${{ parameters.packages }} --triplet ${{ parameters.triplet }}
rm -rf ${{ parameters.VCPKG_REMOVABLES }}
workingDirectory: vcpkg
displayName: vcpkg unix
condition: and(ne(variables['Agent.OS'], 'Windows_NT'), ne(variables.CACHE_RESTORED, 'true'))
- script: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars${{ parameters.arch}}.bat"
call bootstrap-vcpkg.bat
call bootstrap-vcpkg.bat
vcpkg.exe install ${{ parameters.packages }} --triplet ${{ parameters.triplet }}
del /Q /S ${{ parameters.VCPKG_REMOVABLES }} > NUL
workingDirectory: vcpkg
Expand Down
27 changes: 24 additions & 3 deletions azure-pipelines/win-gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,23 @@ stages:
osx:
imageName: ${{ variables.mac_image }}
TRIPLET: x64-osx
CXX: g++-8
CC: gcc-8
linux:
imageName: ${{ variables.linux_image }}
TRIPLET: x64-linux
CXX: g++8
C: gcc-8
pool:
vmImage: $(imageName)
steps:
- template: templates/dep-vcpkg-steps.yml
parameters:
vcpkg_key_cache: $(CACHE_VCPKG_KEY)
vcpkg_key_cache: $(CACHE_VCPKG_KEY)_2
triplet: $(TRIPLET)
arch: $(ARCH)
CXX: $(CXX)
CC: $(CC)

- stage: mingw
variables:
Expand Down Expand Up @@ -79,5 +88,17 @@ stages:
sonar_wrapper_url: 'https://sonarcloud.io/static/cpp/build-wrapper-macosx-x86.zip'
build_wrapper: 'build-wrapper-macosx-x86/build-wrapper-macosx-x86'
build_wrapper_path: build/build-wrapper-macosx-x86
CXX: gcc-8
CC: gcc-8
CXX: g++-8
#CC: g++-8
- template: 'templates/sonarcloud-job.yml'
parameters:
imageName: ${{ variables.linux_image }}
jobName: SonarCloud_linux
jobDisplayName: SonarCloud (Linux)
vcpkg_key_cache: $(CACHE_VCPKG_KEY)
triplet: x64-linux
build_type: Debug
sonar_wrapper_url: 'https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip'
build_wrapper: 'build-wrapper-linux-x86/build-wrapper-linux-x86-64'
build_wrapper_path: build/build-wrapper-linux-x86-64
CXX: g++8

0 comments on commit 1a94e6d

Please sign in to comment.