Add macOS Apple Silicon (arm64) support #38
Workflow file for this run
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
| # Source: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml | |
| name: Tests on multiple platforms | |
| on: | |
| push: | |
| pull_request: | |
| branches: [ "master" ] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: windows-latest | |
| compiler: "" | |
| - os: ubuntu-latest | |
| compiler: gcc | |
| - os: ubuntu-latest | |
| compiler: clang | |
| - os: macos-13 | |
| compiler: clang | |
| - os: macos-latest | |
| compiler: clang | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ilammy/msvc-dev-cmd@v1 | |
| if: ${{ matrix.os == 'windows-latest' }} | |
| - name: Build and run tests (Windows) | |
| if: ${{ matrix.os == 'windows-latest' }} | |
| run: | | |
| wmic cpu | |
| nmake -f Makefile.win64 | |
| Get-ChildItem "." -Filter '*.exe' | | |
| Foreach-Object { | |
| Write-Output "--- RUNNING $_ ---" | |
| Invoke-Expression $_ | |
| Write-Output "--- done RUNNING $_ ---" | |
| } | |
| working-directory: ${{ github.workspace }}/test | |
| shell: pwsh | |
| - name: Build and run tests (Ubuntu) | |
| if: ${{ matrix.os == 'ubuntu-latest' }} | |
| run: | | |
| lscpu | |
| make -f Makefile.linux64.${{ matrix.compiler }} | |
| compiler=${{ matrix.compiler }} | |
| for f in $(find . -type f -name "*.cpp"); do | |
| if [[ -z "${f##*win.cpp}" ]]; then | |
| continue | |
| fi | |
| f=${f%.cpp} | |
| if [ ${compiler}="clang" ] && [[ $f == *virtual* ]]; then | |
| continue | |
| fi | |
| echo "--- RUNNING $f ---" | |
| ${f} | |
| echo "--- done RUNNING $f ---" | |
| done | |
| working-directory: ${{ github.workspace }}/test | |
| - name: Build and run tests (macOS) | |
| if: ${{ startsWith(matrix.os, 'macos') }} | |
| run: | | |
| sysctl -n machdep.cpu.brand_string || true | |
| uname -m | |
| # Build + post-process (macos_enable_stub.sh is invoked automatically | |
| # by the Makefile: it patches __TEXT maxprot to rwx and re-signs the | |
| # binary ad-hoc so cpp-stub's Apple code path can create a writable | |
| # alias of __TEXT at runtime). | |
| make -f Makefile.darwin.clang | |
| for f in $(find . -maxdepth 1 -type f -perm -u+x ! -name "Makefile*" ! -name "*.cpp" ! -name "*.md"); do | |
| echo "--- RUNNING $f ---" | |
| "$f" | |
| echo "--- done RUNNING $f ---" | |
| done | |
| working-directory: ${{ github.workspace }}/test | |
| shell: bash | |
| - name: CMake integration smoke test (macOS) | |
| if: ${{ startsWith(matrix.os, 'macos') }} | |
| run: | | |
| # Verifies that downstream projects only need | |
| # target_link_libraries(my_test PRIVATE cpp-stub) | |
| # and no manual post-build step — the root CMakeLists.txt | |
| # defers and attaches macos_enable_stub.sh automatically. | |
| cmake -S example/cmake_smoke -B example/cmake_smoke/build | |
| cmake --build example/cmake_smoke/build | |
| ./example/cmake_smoke/build/cmake_smoke | |
| shell: bash |