Fix C++ module usage #991
This file contains hidden or 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: Build and tests | |
| on: | |
| push: | |
| branches: | |
| - '*' | |
| paths-ignore: | |
| - '**/README.md' | |
| pull_request: | |
| branches: | |
| - '*' | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: ${{ matrix.platform.os }} ${{ matrix.config.name }} ${{ matrix.type.name }} | |
| runs-on: ${{ matrix.platform.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| # - { name: Windows VS2019, os: windows-2019 } | |
| - { name: Windows VS2022, os: windows-2022 } | |
| - { name: Linux GCC, os: ubuntu-22.04, flags: -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_CXX_STANDARD=17 } | |
| - { name: Linux Clang, os: ubuntu-22.04, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_STANDARD=17 } | |
| #- { name: Linux GCC, os: ubuntu-18.04, flags: -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_CXX_STANDARD=14 } | |
| #- { name: Linux Clang, os: ubuntu-18.04, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_STANDARD=14 } | |
| # - { name: MacOS XCode, os: macos-latest } | |
| config: | |
| - { name: Shared, flags: -DBUILD_SHARED_LIBS=TRUE } | |
| - { name: Static, flags: -DBUILD_SHARED_LIBS=FALSE } | |
| type: | |
| - { name: Release, flags: -DCMAKE_BUILD_TYPE=Release } | |
| - { name: Debug, flags: -DCMAKE_BUILD_TYPE=Debug } | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install Linux Dependencies | |
| if: runner.os == 'Linux' | |
| run: sudo apt-get update && sudo apt-get install -y libasound2-dev libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev libglu1-mesa-dev libxcursor-dev libxinerama-dev | |
| - name: Configure Linux | |
| if: runner.os == 'Linux' | |
| run: cmake -B build -S . -DGLFW_BUILD_WAYLAND=OFF -DBUILD_TESTING=ON -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic" ${{ matrix.platform.flags }} ${{ matrix.type.flags }} ${{ matrix.config.flags }} | |
| - name: Configure Windows | |
| if: runner.os == 'Windows' | |
| run: cmake -B build -S . ${{ matrix.platform.flags }} ${{ matrix.type.flags }} ${{ matrix.config.flags }} | |
| - name: Build | |
| run: cmake --build build | |
| # seem to be failing on windows (even with -C), no clue why | |
| - name: Test | |
| if: runner.os == 'Linux' | |
| run: ctest --verbose --test-dir build | |
| # Verify the C++20 module target (`import raylib;`) builds. Module | |
| # dependency scanning requires the Ninja generator and a scan-capable | |
| # compiler (LLVM Clang here), so this uses its own job. | |
| modules: | |
| name: C++20 Modules (Ninja Clang) | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install Dependencies | |
| run: sudo apt-get update && sudo apt-get install -y ninja-build clang-18 clang-tools-18 libasound2-dev libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev libglu1-mesa-dev libxcursor-dev libxinerama-dev | |
| - name: Configure | |
| run: > | |
| cmake -B build -S . -G Ninja | |
| -DCMAKE_C_COMPILER=clang-18 | |
| -DCMAKE_CXX_COMPILER=clang++-18 | |
| -DBUILD_RAYLIB_CPP_MODULES=ON | |
| -DCMAKE_CXX_STANDARD=20 | |
| -DGLFW_BUILD_WAYLAND=OFF | |
| -DCMAKE_BUILD_TYPE=Release | |
| - name: Build modules | |
| run: cmake --build build --target raylib_cpp_modules module |