diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0212a5482..d098122c4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 @@ -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: | @@ -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 diff --git a/dist/Brewfile b/dist/Brewfile index 5deb156f5..832c408f2 100644 --- a/dist/Brewfile +++ b/dist/Brewfile @@ -1,4 +1,3 @@ -brew "glfw" brew "mbedtls" brew "nlohmann-json" brew "cmake" diff --git a/dist/macOS/0001-glfw-SW.patch b/dist/macOS/0001-glfw-SW.patch new file mode 100644 index 000000000..fe7fb8dd5 --- /dev/null +++ b/dist/macOS/0001-glfw-SW.patch @@ -0,0 +1,25 @@ +From 9c8665af4c2e2ce66555c15c05c72027bfdf0cb6 Mon Sep 17 00:00:00 2001 +From: iTrooz +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 +