Skip to content

Commit

Permalink
git: Added NoGPU dmg for MacOS (WerWolv#708)
Browse files Browse the repository at this point in the history
  • Loading branch information
iTrooz authored Aug 30, 2022
1 parent 6689b8e commit 0569770
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 6 deletions.
55 changes: 50 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,33 @@ jobs:
# MacOS build
macos:
runs-on: macos-11
name: 🍎 macOS 11.0
steps:

strategy:
matrix:
include:
- suffix: "-NoGPU"
custom_glfw: true
- suffix: ""
custom_glfw: false

name: 🍎 macOS 11.0${{matrix.suffix}}

steps:
- name: 🧰 Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: 📜 Set version variable
run: |
echo "IMHEX_VERSION=`cat VERSION`" >> $GITHUB_ENV
- name: 📜 Restore ccache
uses: actions/cache@v3
with:
path: |
~/Library/Caches/ccache
key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build-${{ github.run_id }}
key: ${{ runner.os }}-${{ matrix.suffix }}-${{ secrets.CACHE_VERSION }}-build-${{ github.run_id }}
restore-keys: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build


Expand All @@ -140,12 +153,43 @@ jobs:
with:
path: |
build/CMakeCache.txt
key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build-${{ hashFiles('**/CMakeLists.txt') }}
key: ${{ runner.os }}-${{ matrix.suffix }}-${{ secrets.CACHE_VERSION }}-build-${{ hashFiles('**/CMakeLists.txt') }}

- name: ⬇️ Install dependencies
run: |
brew bundle --no-lock --file dist/Brewfile
- name: ⬇️ Install classic glfw
if: ${{! matrix.custom_glfw}}
run: |
brew install glfw
- name: 🧰 Checkout glfw
if: ${{matrix.custom_glfw}}
uses: actions/checkout@v3
with:
repository: glfw/glfw
path: glfw

- name: ⬇️ Patch and install custom glfw
if: ${{matrix.custom_glfw}}
run: |
cd glfw
git apply ../dist/macOS/0001-glfw-SW.patch
mkdir build
cd build
cmake \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_OBJC_COMPILER_LAUNCHER=ccache \
-DCMAKE_OBJCXX_COMPILER_LAUNCHER=ccache \
..
make -j 4 install
# MacOS cmake build
- name: 🛠️ Build
run: |
Expand All @@ -167,13 +211,14 @@ jobs:
-DCMAKE_OBJCXX_COMPILER_LAUNCHER=ccache \
-DIMHEX_PATTERNS_PULL_MASTER=ON \
-DCMAKE_OSX_DEPLOYMENT_TARGET="10.10" \
-DCPACK_PACKAGE_FILE_NAME="imhex-${{env.IMHEX_VERSION}}-macOS${{matrix.suffix}}" \
..
make -j4 package
- name: ⬆️ Upload DMG
uses: actions/upload-artifact@v3
with:
name: macOS DMG
name: macOS DMG${{matrix.suffix}}
path: build/*.dmg

# Ubuntu build
Expand Down
1 change: 0 additions & 1 deletion dist/Brewfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
brew "glfw"
brew "mbedtls"
brew "nlohmann-json"
brew "cmake"
Expand Down
25 changes: 25 additions & 0 deletions dist/macOS/0001-glfw-SW.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From 9c8665af4c2e2ce66555c15c05c72027bfdf0cb6 Mon Sep 17 00:00:00 2001
From: iTrooz <[email protected]>
Date: Mon, 29 Aug 2022 17:29:38 +0200
Subject: [PATCH] Use software rendering on MacOS

---
src/nsgl_context.m | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/nsgl_context.m b/src/nsgl_context.m
index fc1f7521..e5906575 100644
--- a/src/nsgl_context.m
+++ b/src/nsgl_context.m
@@ -198,7 +198,7 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
NSOpenGLPixelFormatAttribute attribs[40];
int index = 0;

- ADD_ATTRIB(NSOpenGLPFAAccelerated);
+ ADD_ATTRIB(NSOpenGLPFARendererID);ADD_ATTRIB(kCGLRendererGenericFloatID);
ADD_ATTRIB(NSOpenGLPFAClosestPolicy);

if (ctxconfig->nsgl.offline)
--
2.37.2

0 comments on commit 0569770

Please sign in to comment.