CMake on multiple platforms #40
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform. | |
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml | |
name: CMake on multiple platforms | |
on: | |
workflow_dispatch | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
build_type: [Release] | |
include: | |
- os: ubuntu-latest | |
os_family: linux | |
arch: x86_64 | |
# macos-latest image is arm64 based | |
- os: macos-latest | |
os_family: osx | |
arch: aarch_64 | |
# macos-13 image is the most recent x86 based macos | |
- os: macos-13 | |
os_family: osx | |
arch: x86_64 | |
- os: windows-latest | |
os_family: windows | |
arch: x86_64 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: criteo_release_protobuf_bom | |
- name: Checkout submodule | |
run: git submodule update --init --recursive | |
- name: Configure CMake | |
if: ${{ matrix.os_family == 'linux' || matrix.os_family == 'windows' }} | |
run: > | |
cmake -B ${{ github.workspace }}/build | |
-G "Unix Makefiles" | |
-DBUILD_SHARED_LIBS=OFF | |
-DCMAKE_EXE_LINKER_FLAGS="-static" | |
-DZLIB_USE_STATIC_LIBS=ON | |
-DCMAKE_CXX_STANDARD=14 | |
-DCMAKE_BUILD_TYPE=Release | |
- name: Configure CMake | |
if: ${{ matrix.os_family == 'osx' }} | |
run: > | |
cmake -B ${{ github.workspace }}/build | |
-G "Unix Makefiles" | |
-DCMAKE_CXX_STANDARD=14 | |
-DCMAKE_BUILD_TYPE=Release | |
- name: Build | |
run: cmake --build ${{ github.workspace }}/build | |
- name: Rename | |
if: ${{ matrix.os_family == 'linux' || matrix.os_family == 'osx' }} | |
run: mv $(readlink -f ${{ github.workspace }}/build/protoc) ${{ github.workspace }}/build/protoc.exe | |
- name: Upload artifacts | |
uses: actions/[email protected] | |
with: | |
name: protoc-${{ matrix.os_family }}-${{ matrix.arch }} | |
path: ${{ github.workspace }}/build/protoc.exe | |
retention-days: 7 |