-
Notifications
You must be signed in to change notification settings - Fork 102
macOS: Initial Apple Silicon and x86_64 build support #14059
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
magnesj
wants to merge
12
commits into
dev
Choose a base branch
from
mac-prototype-01
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
b694b82
Refactor: add MACOSX_BUNDLE option to qt_add_executable in multiple C…
ded271a
#14045 macOS: Guard std::stacktrace usage and skip ucontext on Apple …
magnesj e6da5ed
#14045 macOS: Guard std::ispanstream with std::istringstream fallback
magnesj 0ac7a71
#14045 macOS: Add vcpkg overlay triplets for osx and exclude grpc on osx
magnesj 61f713f
#14045 macOS: CMake macOS build support and openzgy OpenMP-disable patch
magnesj 5d4b0ee
#14045 CI: Add macOS build workflow
magnesj 0bb248f
#14045 CI: Drop mac-prototype branch filter from macOS workflow triggers
magnesj df5c087
#14045 macOS: Use feature-test macros to detect <stacktrace> and <spa…
magnesj 9fc2b3d
#14045 macOS: Make MAX_STIMPLAN_LAYERS constexpr to fix arm64 link error
magnesj 0497155
#14045 CI: Ship README-macOS.txt with artifact to document Gatekeeper…
9d6f3e0
#14045 CI: Pin macOS runner to macos-14 and set deployment target to …
7613b37
#14045 CI: Move macOS runner to macos-15 and fix README step on confi…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,186 @@ | ||
| name: ResInsight Mac Build | ||
|
|
||
| on: | ||
| push: | ||
| pull_request: | ||
| workflow_dispatch: | ||
| schedule: | ||
| # 02:00 UTC daily, offset from ResInsightWithCache.yml's 01:00 slot | ||
| # so the two workflows do not contend for the same Actions runners. | ||
| - cron: '0 2 * * *' | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| # Cancel a still-running build when a new push lands on the same ref -- | ||
| # otherwise two simultaneous Mac runs race on the same daily cache keys | ||
| # (vcpkg-clang/macOS-..., macOS-appleclang-...-buildcache-v01-<date>, | ||
| # macOS-buildcache-tool-v0.33.0) and one reports | ||
| # "Failed to save: Unable to reserve cache with key ..., another job may | ||
| # be creating this cache." Mirrors the pattern in ResInsightWithCache.yml. | ||
| concurrency: | ||
| group: mac-build-${{ github.event.pull_request.number || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: macos-latest | ||
| env: | ||
| BUILD_TYPE: Release | ||
| VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" | ||
| BUILDCACHE_DIR: ${{ github.workspace }}/buildcache_dir | ||
| BUILDCACHE_ACCURACY: SLOPPY | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| submodules: true | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: "3.12" | ||
|
|
||
| - name: Display Python version | ||
| run: python -c "import sys; print(sys.version)" | ||
|
|
||
| - name: Get Python executable path | ||
| id: python-path | ||
| run: echo "PYTHON_EXECUTABLE=$(python -c 'import sys; import pathlib; print(pathlib.PurePath(sys.executable).as_posix())')" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| # rips/_version.py is normally generated by CMake; create a dev | ||
| # fallback so the editable install below can resolve the version. | ||
| echo '__version__ = "0.0.0.dev"' > GrpcInterface/Python/rips/_version.py | ||
| pip install -e GrpcInterface/Python[dev] | ||
|
|
||
| - name: Restore buildcache tool binary | ||
| uses: actions/cache@v5 | ||
| with: | ||
| path: ${{ github.workspace }}/buildcache-tool | ||
| key: ${{ runner.os }}-buildcache-tool-v0.33.0 | ||
|
|
||
| - name: Build buildcache from source if needed | ||
| # CeetronSolutions/setup-buildcache-action has no macOS support, so | ||
| # build the binary from the upstream source release and add it to | ||
| # PATH. Source build (~30 s) only happens on cache miss; subsequent | ||
| # runs restore the binary from the cache step above. | ||
| env: | ||
| BUILDCACHE_VERSION: v0.33.0 | ||
| BUILDCACHE_PREFIX: ${{ github.workspace }}/buildcache-tool | ||
| run: | | ||
| if [ ! -x "$BUILDCACHE_PREFIX/bin/buildcache" ]; then | ||
| workdir="$RUNNER_TEMP/buildcache-src" | ||
| mkdir -p "$workdir" "$BUILDCACHE_PREFIX" | ||
| cd "$workdir" | ||
| curl -sSL "https://gitlab.com/bits-n-bites/buildcache/-/archive/${BUILDCACHE_VERSION}/buildcache-${BUILDCACHE_VERSION}.tar.gz" \ | ||
| | tar xz --strip-components=1 | ||
| cmake -S src -B build -G Ninja \ | ||
| -DCMAKE_BUILD_TYPE=Release \ | ||
| -DCMAKE_INSTALL_PREFIX="$BUILDCACHE_PREFIX" | ||
| cmake --build build --target install | ||
| fi | ||
| echo "$BUILDCACHE_PREFIX/bin" >> "$GITHUB_PATH" | ||
| "$BUILDCACHE_PREFIX/bin/buildcache" --version | ||
|
|
||
| - name: Get current date | ||
| id: current-time | ||
| shell: bash | ||
| run: echo "formattedTime=$(date -u +%Y-%m-%d)" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Cache buildcache contents | ||
| id: cache-buildcache | ||
| uses: actions/cache@v5 | ||
| with: | ||
| path: ${{ env.BUILDCACHE_DIR }} | ||
| key: ${{ runner.os }}-appleclang-6.7.0-buildcache-v01-${{ steps.current-time.outputs.formattedTime }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-appleclang-6.7.0-buildcache-v01- | ||
|
|
||
| - name: Create folder for buildcache | ||
| run: mkdir -p "${{ env.BUILDCACHE_DIR }}" | ||
|
|
||
| - name: Install Homebrew build tools | ||
| # vcpkg's thrift port (transitive dep of arrow) requires bison > 2.5; | ||
| # macOS ships an ancient /usr/bin/bison (2.3). Install Homebrew's | ||
| # bison and put it ahead on PATH so the port build finds it. | ||
| run: | | ||
| brew install bison | ||
| echo "$(brew --prefix bison)/bin" >> "$GITHUB_PATH" | ||
| "$(brew --prefix bison)/bin/bison" --version | head -1 | ||
|
|
||
| - name: Install Qt | ||
| # cache: false on macOS: the 1.1 GB Qt tarball eats most of the | ||
| # 10 GB per-repo Actions cache quota; downloading fresh each run | ||
| # is ~30 s on the runner-internal mirror and leaves room for the | ||
| # buildcache + vcpkg caches which actually save build time. | ||
| uses: CeetronSolutions/install-qt-action@bump-node24 | ||
| with: | ||
| version: 6.7.0 | ||
| dir: "${{ github.workspace }}/Qt/" | ||
| cache: false | ||
| setup-python: false | ||
| modules: "qtnetworkauth" | ||
|
|
||
| - name: vcpkg bootstrap | ||
| run: | | ||
| ThirdParty/vcpkg/bootstrap-vcpkg.sh | ||
|
|
||
| - name: Get vcpkg submodule SHA | ||
| id: vcpkg-sha | ||
| shell: bash | ||
| run: echo "sha=$(git rev-parse HEAD:ThirdParty/vcpkg)" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Restore vcpkg cache | ||
| id: vcpkg-cache | ||
| uses: CeetronSolutions/vcpkg-cache@copilot/optimize-cache-storage-structure | ||
| with: | ||
| cache-key: ${{ runner.os }}-clang-${{ steps.vcpkg-sha.outputs.sha }}-${{ hashFiles('vcpkg.json', 'vcpkg-configuration.json') }} | ||
| prefix: vcpkg-clang/ | ||
|
|
||
| - name: Configure | ||
| shell: bash | ||
| env: | ||
| VCPKG_FEATURE_FLAGS: "binarycaching" | ||
| VCPKG_BINARY_SOURCES: "clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite" | ||
| run: > | ||
| cmake -S . -B cmakebuild | ||
| -DVCPKG_BUILD_TYPE=release | ||
| -DCMAKE_INSTALL_PREFIX=cmakebuild/install | ||
| -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} | ||
| -DCMAKE_POLICY_VERSION_MINIMUM=3.5 | ||
| -DCMAKE_C_COMPILER_LAUNCHER=buildcache | ||
| -DCMAKE_CXX_COMPILER_LAUNCHER=buildcache | ||
| -DRESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS=true | ||
| -DRESINSIGHT_TREAT_WARNINGS_AS_ERRORS=false | ||
| -DRESINSIGHT_ENABLE_PRECOMPILED_HEADERS=false | ||
| -DRESINSIGHT_ENABLE_UNITY_BUILD=false | ||
| -DRESINSIGHT_ENABLE_GRPC=false | ||
| -DRESINSIGHT_ENABLE_HDF5=false | ||
| -DCMAKE_TOOLCHAIN_FILE=ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake | ||
| -G Ninja | ||
|
|
||
| - name: Build | ||
| run: | | ||
| cmake --build cmakebuild --target install | ||
|
|
||
| - name: Stats for buildcache | ||
| run: buildcache -s | ||
|
|
||
| - name: Run Unit Tests | ||
| shell: bash | ||
| run: | | ||
| echo "Content of unit test folder" | ||
| ls cmakebuild/ResInsight-tests | ||
| cmakebuild/ResInsight-tests | ||
|
|
||
| - name: Upload artifacts | ||
| if: always() | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: ResInsight-macOS | ||
| path: ${{ runner.workspace }}/ResInsight/cmakebuild/install | ||
| retention-days: 5 |
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.