-
Notifications
You must be signed in to change notification settings - Fork 110
77 lines (68 loc) · 2.33 KB
/
cmake-multi-platform.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# This workflow is for CMake-based build/test running on multiple platforms.
name: cmake build
on: [push, pull_request]
jobs:
build:
name: ${{ matrix.target_arch }} ${{ matrix.os }} (${{ matrix.c_compiler }})
runs-on: ${{ matrix.os }}
strategy:
# Deliver the feedback for all matrix combinations.
fail-fast: false
matrix:
#target_arch: [ aarch64, amd64, armv7, ppc64le, riscv64, s390x ]
target_arch: [ amd64 ]
os: [ macos-latest, ubuntu-latest, windows-latest ]
c_compiler: [ cl, clang, gcc ]
build_type: [ Release ]
include:
- os: windows-latest
cmake_generator_opt: '-G "Unix Makefiles"'
exclude:
- os: macos-latest
c_compiler: cl
- os: macos-latest
c_compiler: gcc
- os: ubuntu-latest
c_compiler: cl
# - os: macos-latest
# target_arch: armv7
# - os: macos-latest
# target_arch: ppc64le
# - os: macos-latest
# target_arch: riscv64
# - os: macos-latest
# target_arch: s390x
# - os: windows-latest
# target_arch: ppc64le
# - os: windows-latest
# target_arch: riscv64
# - os: windows-latest
# target_arch: s390x
steps:
- uses: actions/checkout@v4
#- uses: uraimo/run-on-arch-action@v2
# specify distro
- name: Set reusable strings
# Turn repeated input strings into step outputs.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Configure CMake
# Configure CMake in a 'build' subdirectory.
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
${{ matrix.cmake_generator_opt }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-Dbuild_tests=ON
-S ${{ github.workspace }}
- name: Build
# Build the code with the given configuration.
run: >
cmake --build ${{ steps.strings.outputs.build-output-dir }}
--config ${{ matrix.build_type }}
- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
# Execute tests defined by the CMake configuration.
run: ctest --build-config ${{ matrix.build_type }} --verbose