Skip to content

Commit 734e181

Browse files
authored
Create cmake-multi-platform.yml
Adding same GitHub action workflow as in DasherCore
1 parent 2f549f2 commit 734e181

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: CMake on multiple platforms
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
runs-on: ${{ matrix.os }}
11+
12+
strategy:
13+
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
14+
fail-fast: false
15+
16+
matrix:
17+
os: [ubuntu-latest, windows-latest, macos-latest]
18+
build_type: [Release, Debug]
19+
c_compiler: [gcc, clang, cl]
20+
include:
21+
- os: windows-latest
22+
c_compiler: cl
23+
cpp_compiler: cl
24+
- os: ubuntu-latest
25+
c_compiler: gcc
26+
cpp_compiler: g++
27+
- os: ubuntu-latest
28+
c_compiler: clang
29+
cpp_compiler: clang++
30+
- os: macos-latest
31+
c_compiler: gcc
32+
cpp_compiler: g++
33+
- os: macos-latest
34+
c_compiler: clang
35+
cpp_compiler: clang++
36+
exclude:
37+
- os: windows-latest
38+
c_compiler: gcc
39+
- os: windows-latest
40+
c_compiler: clang
41+
- os: ubuntu-latest
42+
c_compiler: cl
43+
- os: macos-latest
44+
c_compiler: cl
45+
46+
steps:
47+
- uses: actions/checkout@v4
48+
with:
49+
submodules: 'recursive'
50+
51+
- name: Set reusable strings
52+
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
53+
id: strings
54+
shell: bash
55+
run: |
56+
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
57+
58+
- name: Configure CMake
59+
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
60+
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
61+
run: >
62+
cmake -B ${{ steps.strings.outputs.build-output-dir }}
63+
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
64+
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
65+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
66+
-S ${{ github.workspace }}
67+
68+
- name: Build
69+
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
70+
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}

0 commit comments

Comments
 (0)