trying to fix gcc not being identified by CMake on macOS #8
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
name: Release Build | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '**/README.md' | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build-msys2: | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: msys2 {0} | |
strategy: | |
fail-fast: true | |
matrix: | |
build_type: ["Release"] | |
cmake_generator: ["Ninja"] | |
shared_libs_enabled: ["ON", "OFF"] | |
config: | |
- { sys: mingw32, env: i686, cc: gcc, cxx: g++ } | |
- { sys: mingw32, env: i686, cc: clang, cxx: clang++ } | |
- { sys: mingw64, env: x86_64, cc: gcc, cxx: g++ } | |
- { sys: mingw64, env: x86_64, cc: clang, cxx: clang++ } | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup MSYS2 | |
uses: msys2/[email protected] | |
with: | |
msystem: ${{ matrix.config.sys }} | |
install: >- | |
mingw-w64-${{ matrix.config.env }}-gcc | |
mingw-w64-${{ matrix.config.env }}-clang | |
mingw-w64-${{ matrix.config.env }}-make | |
mingw-w64-${{ matrix.config.env }}-cmake | |
mingw-w64-${{ matrix.config.env }}-ninja | |
- name: Set reusable strings | |
id: strings | |
run: | | |
echo "build-output-dir=$(cygpath -u '${{ github.workspace }}')/build" >> "$GITHUB_OUTPUT" | |
echo "source-dir=$(cygpath -u '${{ github.workspace }}')" >> "$GITHUB_OUTPUT" | |
- name: Configure CMake | |
run: > | |
cmake | |
-G ${{ matrix.cmake_generator }} | |
-S ${{ steps.strings.outputs.source-dir }} | |
-B ${{ steps.strings.outputs.build-output-dir }} | |
-DCMAKE_C_COMPILER=${{ matrix.config.cc }} | |
-DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
-DBUILD_SHARED_LIBS=${{ matrix.shared_libs_enabled }} | |
- name: Build | |
run: > | |
cmake | |
--build ${{ steps.strings.outputs.build-output-dir }} | |
--config ${{ matrix.build_type }} | |
build-msvc: | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
build_type: ["Release"] | |
shared_libs_enabled: ["ON", "OFF"] | |
config: | |
- { | |
os: windows-latest, | |
cc: "cl", | |
cxx: "cl" | |
} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set reusable strings | |
id: strings | |
shell: bash | |
run: | | |
echo "build-output-dir=${{ github.workspace }}\build" >> "$GITHUB_OUTPUT" | |
- name: Configure CMake | |
run: > | |
cmake | |
-S ${{ github.workspace }} | |
-B ${{ steps.strings.outputs.build-output-dir }} | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
-DBUILD_SHARED_LIBS=${{ matrix.shared_libs_enabled }} | |
- name: Build | |
run: > | |
cmake | |
--build ${{ steps.strings.outputs.build-output-dir }} | |
--config ${{ matrix.build_type }} | |
build-unix: | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
build_type: ["Release"] | |
cmake_generator: ["Ninja"] | |
config: | |
- { | |
os: ubuntu-latest, | |
cc: "gcc", | |
cxx: "g++" | |
} | |
- { | |
os: ubuntu-latest, | |
cc: "clang", | |
cxx: "clang++" | |
} | |
- { | |
os: macos-latest, | |
cc: "gcc", | |
cxx: "g++" | |
} | |
- { | |
os: macos-latest, | |
cc: "clang", | |
cxx: "clang++" | |
} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set reusable strings | |
id: strings | |
shell: bash | |
run: | | |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" | |
- name: Install dependencies (Ubuntu) | |
if: matrix.config.os == 'ubuntu-latest' | |
shell: bash | |
run: | | |
sudo apt install -y xorg-dev libasound2-dev ninja-build | |
- name: Install dependencies (macOS) | |
if: matrix.config.os == 'macos-latest' | |
run: | | |
brew install gcc ninja | |
- name: Configure CMake | |
run: > | |
cmake | |
-G ${{ matrix.cmake_generator }} | |
-S ${{ github.workspace }} | |
-B ${{ steps.strings.outputs.build-output-dir }} | |
-DCMAKE_C_COMPILER=${{ matrix.config.cc }} | |
-DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
- name: Build | |
run: > | |
cmake | |
--build ${{ steps.strings.outputs.build-output-dir }} | |
--config ${{ matrix.build_type }} |