name: CI on: push: branches: [ "master" ] pull_request: branches: [ "master" ] jobs: build_autotools: name: Autotools / ${{ matrix.os }} / ${{ matrix.simd }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: # x86/x64 builds - { os: macos-13, simd: none } - { os: macos-13, simd: sse } - { os: macos-13, simd: sse2 } - { os: macos-13, simd: sse3 } - { os: macos-13, simd: sse4 } - { os: macos-13, simd: avx } - { os: macos-13, simd: avx2 } - { os: macos-14, simd: none } - { os: macos-14, simd: sse } - { os: macos-14, simd: sse2 } - { os: macos-14, simd: sse3 } - { os: macos-14, simd: sse4 } - { os: macos-14, simd: avx } - { os: macos-14, simd: avx2 } - { os: ubuntu-22.04, simd: none } - { os: ubuntu-22.04, simd: sse } - { os: ubuntu-22.04, simd: sse2 } - { os: ubuntu-22.04, simd: sse3 } - { os: ubuntu-22.04, simd: sse4 } - { os: ubuntu-22.04, simd: avx } - { os: ubuntu-22.04, simd: avx2 } - { os: ubuntu-24.04, simd: none } - { os: ubuntu-24.04, simd: sse } - { os: ubuntu-24.04, simd: sse2 } - { os: ubuntu-24.04, simd: sse3 } - { os: ubuntu-24.04, simd: sse4 } - { os: ubuntu-24.04, simd: avx } - { os: ubuntu-24.04, simd: avx2 } # ARM64 builds - { os: ubuntu-latest-arm64, simd: neon } steps: - uses: actions/checkout@v4 - name: Install Autotools on macOS if: runner.os == 'macOS' run: brew upgrade && brew install autoconf automake libtool - name: Install Autotools on Ubuntu if: matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-24.04' run: sudo apt-get install -y autoconf automake libtool - name: Set SIMD flags run: | if [ "${{ matrix.simd }}" == "none" ]; then export CFLAGS="" elif [ "${{ matrix.simd }}" == "sse" ]; then export CFLAGS="-msse" elif [ "${{ matrix.simd }}" == "sse2" ]; then export CFLAGS="-msse2" elif [ "${{ matrix.simd }}" == "sse3" ]; then export CFLAGS="-msse3" elif [ "${{ matrix.simd }}" == "sse4" ]; then export CFLAGS="-msse4" elif [ "${{ matrix.simd }}" == "avx" ]; then export CFLAGS="-mavx" elif [ "${{ matrix.simd }}" == "avx2" ]; then export CFLAGS="-mavx2" elif [ "${{ matrix.simd }}" == "neon" ]; then export CFLAGS="-mfpu=neon" fi - name: Generate Autotools run: ./autogen.sh - name: Configure Autotools run: ./configure CFLAGS="$CFLAGS" - name: Build run: make - name: Test run: make check build_cmake_ios: name: CMake / iOS runs-on: macos-14 steps: - uses: actions/checkout@v4 - name: Configure CMake run: | cmake \ -B build \ -GXcode \ -DCMAKE_SYSTEM_NAME=iOS \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO \ -DCGLM_STATIC=ON \ -DCGLM_USE_TEST=ON - name: Build run: cmake --build build build_cmake_ubuntu: name: CMake / ${{ matrix.target.os }} / ${{ matrix.target.cc }} / ${{ matrix.target.arch }} / ${{ matrix.target.simd }} runs-on: ${{ matrix.target.arch == 'arm64' && 'ubuntu-latest-arm64' || matrix.target.os }} strategy: fail-fast: false matrix: target: # GCC 11 builds - { os: ubuntu-20.04, cc: gcc-11, arch: x64, simd: none } - { os: ubuntu-20.04, cc: gcc-11, arch: x64, simd: sse } - { os: ubuntu-20.04, cc: gcc-11, arch: x64, simd: sse2 } - { os: ubuntu-20.04, cc: gcc-11, arch: x64, simd: sse3 } - { os: ubuntu-20.04, cc: gcc-11, arch: x64, simd: sse4 } - { os: ubuntu-20.04, cc: gcc-11, arch: x64, simd: avx } - { os: ubuntu-20.04, cc: gcc-11, arch: x64, simd: avx2 } # GCC 12 builds - { os: ubuntu-22.04, cc: gcc-12, arch: x64, simd: none } - { os: ubuntu-22.04, cc: gcc-12, arch: x64, simd: sse } - { os: ubuntu-22.04, cc: gcc-12, arch: x64, simd: sse2 } - { os: ubuntu-22.04, cc: gcc-12, arch: x64, simd: sse3 } - { os: ubuntu-22.04, cc: gcc-12, arch: x64, simd: sse4 } - { os: ubuntu-22.04, cc: gcc-12, arch: x64, simd: avx } - { os: ubuntu-22.04, cc: gcc-12, arch: x64, simd: avx2 } # GCC 13 builds - { os: ubuntu-24.04, cc: gcc-13, arch: x64, simd: none } - { os: ubuntu-24.04, cc: gcc-13, arch: x64, simd: sse } - { os: ubuntu-24.04, cc: gcc-13, arch: x64, simd: sse2 } - { os: ubuntu-24.04, cc: gcc-13, arch: x64, simd: sse3 } - { os: ubuntu-24.04, cc: gcc-13, arch: x64, simd: sse4 } - { os: ubuntu-24.04, cc: gcc-13, arch: x64, simd: avx } - { os: ubuntu-24.04, cc: gcc-13, arch: x64, simd: avx2 } # Clang 12 builds - { os: ubuntu-20.04, cc: clang-12, arch: x64, simd: none } - { os: ubuntu-20.04, cc: clang-12, arch: x64, simd: sse } - { os: ubuntu-20.04, cc: clang-12, arch: x64, simd: sse2 } - { os: ubuntu-20.04, cc: clang-12, arch: x64, simd: sse3 } - { os: ubuntu-20.04, cc: clang-12, arch: x64, simd: sse4 } - { os: ubuntu-20.04, cc: clang-12, arch: x64, simd: avx } - { os: ubuntu-20.04, cc: clang-12, arch: x64, simd: avx2 } # Clang 15 builds - { os: ubuntu-22.04, cc: clang-15, arch: x64, simd: none } - { os: ubuntu-22.04, cc: clang-15, arch: x64, simd: sse } - { os: ubuntu-22.04, cc: clang-15, arch: x64, simd: sse2 } - { os: ubuntu-22.04, cc: clang-15, arch: x64, simd: sse3 } - { os: ubuntu-22.04, cc: clang-15, arch: x64, simd: sse4 } - { os: ubuntu-22.04, cc: clang-15, arch: x64, simd: avx } - { os: ubuntu-22.04, cc: clang-15, arch: x64, simd: avx2 } # ARM64 builds - { os: ubuntu-latest, cc: gcc-12, arch: arm64, simd: neon } - { os: ubuntu-latest, cc: gcc-13, arch: arm64, simd: neon } # ARMv7 builds - { os: ubuntu-latest-arm64, cc: gcc-12, arch: armv7, simd: neon } - { os: ubuntu-latest-arm64, cc: gcc-12, arch: armv7, simd: none } steps: - uses: actions/checkout@v4 - name: Add Ubuntu Toolchain PPA if: matrix.target.os == 'ubuntu-20.04' run: | sudo apt-get update sudo apt-get install -y software-properties-common sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test sudo apt-get update - name: Install Compiler and Ninja run: | sudo apt-get install -y ${{ matrix.target.cc }} ninja-build - name: Set SIMD flags run: | if [ "${{ matrix.simd }}" == "none" ]; then export CFLAGS="" elif [ "${{ matrix.simd }}" == "sse" ]; then export CFLAGS="-msse" elif [ "${{ matrix.simd }}" == "sse2" ]; then export CFLAGS="-msse2" elif [ "${{ matrix.simd }}" == "sse3" ]; then export CFLAGS="-msse3" elif [ "${{ matrix.simd }}" == "sse4" ]; then export CFLAGS="-msse4" elif [ "${{ matrix.simd }}" == "avx" ]; then export CFLAGS="-mavx" elif [ "${{ matrix.simd }}" == "avx2" ]; then export CFLAGS="-mavx2" elif [ "${{ matrix.simd }}" == "neon" ]; then export CFLAGS="-mfpu=neon" fi - name: Configure CMake run: | if [ "${{ matrix.target.arch }}" == "armv7" ]; then # Build for ARMv7 neon_flags="" if [ "${{ matrix.simd }}" == "neon" ]; then neon_flags="-mfpu=neon -mfloat-abi=hard" fi cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_C_COMPILER=${{ matrix.target.cc }} \ -DCMAKE_C_FLAGS="$CFLAGS -m32 -march=armv7-a ${neon_flags}" \ -DCGLM_STATIC=ON -DCGLM_USE_TEST=ON elif [ "${{ matrix.target.arch }}" == "arm64" ]; then # Build for ARM64 (AArch64) neon_flags="" if [ "${{ matrix.simd }}" == "neon" ]; then neon_flags="+simd" # Enable SIMD/NEON features on ARM64 else neon_flags="+nosimd" # Explicitly disable SIMD/NEON fi cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_C_COMPILER=${{ matrix.target.cc }} \ -DCMAKE_C_FLAGS="$CFLAGS -march=armv8-a${neon_flags}" \ -DCGLM_STATIC=ON -DCGLM_USE_TEST=ON else # Normal build (x86/x64) cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_C_COMPILER=${{ matrix.target.cc }} \ -DCMAKE_C_FLAGS="$CFLAGS" \ -DCGLM_STATIC=ON -DCGLM_USE_TEST=ON fi - name: Build run: cmake --build build - name: Test working-directory: build run: ./tests build_cmake_macos: name: CMake / ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [macos-13, macos-14] steps: - uses: actions/checkout@v4 - name: Install Ninja if: runner.os == 'macOS' run: brew upgrade && brew install ninja - name: Configure CMake run: | cmake \ -B build \ -GNinja \ -DCMAKE_BUILD_TYPE=Release \ -DCGLM_STATIC=ON \ -DCGLM_USE_TEST=ON - name: Build run: cmake --build build - name: Test working-directory: build run: ./tests build_cmake: name: CMake / ${{ matrix.os }} / ${{ matrix.simd }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: # x86/x64 builds - { os: macos-13, simd: none } - { os: macos-13, simd: sse } - { os: macos-13, simd: sse2 } - { os: macos-13, simd: sse3 } - { os: macos-13, simd: sse4 } - { os: macos-13, simd: avx } - { os: macos-13, simd: avx2 } - { os: macos-14, simd: none } - { os: macos-14, simd: sse } - { os: macos-14, simd: sse2 } - { os: macos-14, simd: sse3 } - { os: macos-14, simd: sse4 } - { os: macos-14, simd: avx } - { os: macos-14, simd: avx2 } - { os: windows-2022, simd: none } - { os: windows-2022, simd: sse } - { os: windows-2022, simd: sse2 } - { os: windows-2022, simd: sse3 } - { os: windows-2022, simd: sse4 } - { os: windows-2022, simd: avx } - { os: windows-2022, simd: avx2 } # ARM64 builds - { os: macos-14-arm64, simd: neon } steps: - uses: actions/checkout@v4 - name: Install Ninja on macOS if: runner.os == 'macOS' run: brew upgrade && brew install ninja - name: Set SIMD flags (Windows) if: runner.os == 'Windows' shell: pwsh run: | $simd = "${{ matrix.simd }}" if ($simd -eq "none") { $env:CFLAGS = "" } elseif ($simd -eq "sse") { $env:CFLAGS = "-arch:SSE" } elseif ($simd -eq "sse2") { $env:CFLAGS = "-arch:SSE2" } elseif ($simd -eq "sse3") { $env:CFLAGS = "-arch:SSE3" } elseif ($simd -eq "sse4") { $env:CFLAGS = "-arch:SSE4" } elseif ($simd -eq "avx") { $env:CFLAGS = "-arch:AVX" } elseif ($simd -eq "avx2") { $env:CFLAGS = "-arch:AVX2" } elseif ($simd -eq "neon") { $env:CFLAGS = "-arch:NEON" } - name: Set SIMD flags (Unix) if: runner.os != 'Windows' shell: bash run: | if [ "${{ matrix.simd }}" == "none" ]; then export CFLAGS="" elif [ "${{ matrix.simd }}" == "sse" ]; then export CFLAGS="-msse" elif [ "${{ matrix.simd }}" == "sse2" ]; then export CFLAGS="-msse2" elif [ "${{ matrix.simd }}" == "sse3" ]; then export CFLAGS="-msse3" elif [ "${{ matrix.simd }}" == "sse4" ]; then export CFLAGS="-msse4" elif [ "${{ matrix.simd }}" == "avx" ]; then export CFLAGS="-mavx" elif [ "${{ matrix.simd }}" == "avx2" ]; then export CFLAGS="-mavx2" elif [ "${{ matrix.simd }}" == "neon" ]; then export CFLAGS="-mfpu=neon" fi - name: Configure CMake (Windows) if: runner.os == 'Windows' shell: pwsh run: cmake -B build -G "Visual Studio 17 2022" -A x64 -T host=x64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="$env:CFLAGS" -DCGLM_STATIC=ON -DCGLM_USE_TEST=ON - name: Configure CMake (Unix) if: runner.os != 'Windows' shell: bash run: cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="$CFLAGS" -DCGLM_STATIC=ON -DCGLM_USE_TEST=ON - name: Build run: cmake --build build - name: Test (Windows) if: runner.os == 'Windows' shell: pwsh working-directory: build run: .\Debug\tests.exe - name: Test (Unix) if: runner.os != 'Windows' shell: bash working-directory: build run: ./tests build_meson: name: Meson / ${{ matrix.os }} / ${{ matrix.simd }} runs-on: ${{ contains(matrix.os, 'arm64') && 'ubuntu-latest-arm64' || matrix.os }} strategy: fail-fast: false matrix: include: # x86/x64 builds - { os: macos-14, simd: none } - { os: macos-14, simd: sse } - { os: macos-14, simd: sse2 } - { os: macos-14, simd: sse3 } - { os: macos-14, simd: sse4 } - { os: macos-14, simd: avx } - { os: macos-14, simd: avx2 } - { os: ubuntu-22.04, simd: none } - { os: ubuntu-22.04, simd: sse } - { os: ubuntu-22.04, simd: sse2 } - { os: ubuntu-22.04, simd: sse3 } - { os: ubuntu-22.04, simd: sse4 } - { os: ubuntu-22.04, simd: avx } - { os: ubuntu-22.04, simd: avx2 } - { os: ubuntu-24.04, simd: none } - { os: ubuntu-24.04, simd: sse } - { os: ubuntu-24.04, simd: sse2 } - { os: ubuntu-24.04, simd: sse3 } - { os: ubuntu-24.04, simd: sse4 } - { os: ubuntu-24.04, simd: avx } - { os: ubuntu-24.04, simd: avx2 } - { os: windows-2022, simd: none } - { os: windows-2022, simd: sse } - { os: windows-2022, simd: sse2 } - { os: windows-2022, simd: sse3 } - { os: windows-2022, simd: sse4 } - { os: windows-2022, simd: avx } - { os: windows-2022, simd: avx2 } # ARM64 builds - { os: ubuntu-latest-arm64, simd: neon } steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: '3.12' cache: 'pip' - name: Install meson run: python3 -m pip install meson ninja - name: Set SIMD flags (Windows) if: runner.os == 'Windows' shell: pwsh run: | $simd = "${{ matrix.simd }}" if ($simd -eq "none") { $env:CFLAGS = "" } elseif ($simd -eq "sse") { $env:CFLAGS = "-arch:SSE" } elseif ($simd -eq "sse2") { $env:CFLAGS = "-arch:SSE2" } elseif ($simd -eq "sse3") { $env:CFLAGS = "-arch:SSE3" } elseif ($simd -eq "sse4") { $env:CFLAGS = "-arch:SSE4" } elseif ($simd -eq "avx") { $env:CFLAGS = "-arch:AVX" } elseif ($simd -eq "avx2") { $env:CFLAGS = "-arch:AVX2" } elseif ($simd -eq "neon") { $env:CFLAGS = "-arch:NEON" } - name: Set SIMD flags (Unix) if: runner.os != 'Windows' shell: bash run: | if [ "${{ matrix.simd }}" == "none" ]; then export CFLAGS="" elif [ "${{ matrix.simd }}" == "sse" ]; then export CFLAGS="-msse" elif [ "${{ matrix.simd }}" == "sse2" ]; then export CFLAGS="-msse2" elif [ "${{ matrix.simd }}" == "sse3" ]; then export CFLAGS="-msse3" elif [ "${{ matrix.simd }}" == "sse4" ]; then export CFLAGS="-msse4" elif [ "${{ matrix.simd }}" == "avx" ]; then export CFLAGS="-mavx" elif [ "${{ matrix.simd }}" == "avx2" ]; then export CFLAGS="-mavx2" elif [ "${{ matrix.simd }}" == "neon" ]; then export CFLAGS="-mfpu=neon" fi - name: Build with meson (Windows) if: runner.os == 'Windows' shell: pwsh run: | meson setup build -Dbuildtype=release --default-library=static -Dbuild_tests=true -Dc_args="$env:CFLAGS" meson test -C build - name: Build with meson (Unix) if: runner.os != 'Windows' shell: bash run: | meson setup build -Dbuildtype=release --default-library=static -Dbuild_tests=true -Dc_args="$CFLAGS" meson test -C build build_msbuild: name: MSBuild / Windows / ${{ matrix.simd }} runs-on: windows-2022 strategy: fail-fast: false matrix: simd: [none, sse, sse2, sse3, sse4, avx, avx2, neon] steps: - uses: actions/checkout@v4 - uses: microsoft/setup-msbuild@v2 - name: Retarget solution run: | vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath $vsInstallPath = vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath & "$vsInstallPath\Common7\IDE\devenv.com" cglm.sln /Upgrade - name: Set SIMD flags run: | if ($Env:SIMD -eq 'none') { $Env:CFLAGS="" } elseif ($Env:SIMD -eq 'sse') { $Env:CFLAGS="-arch:SSE" } elseif ($Env:SIMD -eq 'sse2') { $Env:CFLAGS="-arch:SSE2" } elseif ($Env:SIMD -eq 'sse3') { $Env:CFLAGS="-arch:SSE3" } elseif ($Env:SIMD -eq 'sse4') { $Env:CFLAGS="-arch:SSE4" } elseif ($Env:SIMD -eq 'avx') { $Env:CFLAGS="-arch:AVX" } elseif ($Env:SIMD -eq 'avx2') { $Env:CFLAGS="-arch:AVX2" } elseif ($Env:SIMD -eq 'neon') { $Env:CFLAGS="-arch:NEON" } - name: Build (x86) working-directory: win run: msbuild cglm.vcxproj /p:Configuration=Release /p:Platform=x86 /p:PlatformToolset=v143 /p:BuildInParallel=true /p:AdditionalOptions="$Env:CFLAGS" - name: Build (x64) working-directory: win run: msbuild cglm.vcxproj /p:Configuration=Release /p:Platform=x64 /p:PlatformToolset=v143 /p:BuildInParallel=true /p:AdditionalOptions="$Env:CFLAGS" build_documentation: name: Documentation runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: '3.12' - name: Install Dependencies working-directory: docs run: python3 -m pip install -r requirements.txt - name: Build working-directory: docs run: sphinx-build -W --keep-going source build build_swift: name: Swift ${{ matrix.swift }} / ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [macos-13, macos-14, ubuntu-22.04] # This has no test yet. steps: - uses: actions/checkout@v4 - name: Build run: swift build build_cmake_arm: name: CMake / ARM / ${{ matrix.os }} / ${{ matrix.arch }} / ${{ matrix.simd }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: # Linux ARM builds - os: ubuntu-latest-arm64 arch: arm64 simd: neon - os: ubuntu-latest-arm64 arch: armv7 simd: neon - os: ubuntu-latest-arm64 arch: armv7 simd: none # Windows ARM builds - os: windows-latest-arm64 arch: arm64 simd: neon - os: windows-latest-arm64 arch: arm simd: neon - os: windows-latest-arm64 arch: arm simd: none steps: - uses: actions/checkout@v4 - name: Configure CMake (Windows) if: runner.os == 'Windows' shell: pwsh run: | $flags = "" if ("${{ matrix.arch }}" -eq "arm") { $flags = "-m32 -march=armv7-a" if ("${{ matrix.simd }}" -eq "neon") { $flags += " -mfpu=neon" } } elseif ("${{ matrix.simd }}" -eq "neon") { $flags = "-march=armv8-a+simd" } cmake -B build -G "Visual Studio 17 2022" -A ${{ matrix.arch == 'arm64' && 'ARM64' || 'ARM' }} ` -DCMAKE_BUILD_TYPE=Release ` -DCMAKE_C_FLAGS="$flags" ` -DCGLM_STATIC=ON -DCGLM_USE_TEST=ON - name: Configure CMake (Unix) if: runner.os != 'Windows' shell: bash run: | flags="" if [ "${{ matrix.arch }}" = "armv7" ]; then flags="-m32 -march=armv7-a" if [ "${{ matrix.simd }}" = "neon" ]; then flags="$flags -mfpu=neon -mfloat-abi=hard" fi elif [ "${{ matrix.simd }}" = "neon" ]; then flags="-march=armv8-a+simd" fi cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_C_FLAGS="$flags" \ -DCGLM_STATIC=ON -DCGLM_USE_TEST=ON - name: Build run: cmake --build build - name: Test working-directory: build run: ./tests