diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 00000000..7764e0fc --- /dev/null +++ b/.github/workflows/macos.yml @@ -0,0 +1,54 @@ +name: macos + +on: + push: + paths: + - 'src/**' + - 'data-*/**' + - 'packaging/**' + - 'CMakeLists.txt' + - '.github/workflows/macos.yml' + pull_request: + paths: + - 'src/**' + - 'data-*/**' + - 'packaging/**' + - 'CMakeLists.txt' + - '.github/workflows/macos.yml' + +jobs: + macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + + - name: Install deps + run: | + export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 + export HOMEBREW_NO_INSTALL_CLEANUP=1 + brew update --auto-update + brew install cmake ninja glew libpng libjpeg-turbo freetype sdl2 gtk+3 + + patch /opt/homebrew/include/GL/glew.h < packaging/glew_macos_fix.patch + + - name: Compile + run: | + mkdir build; cd build + cmake .. -G Ninja \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 \ + -DCMAKE_FIND_FRAMEWORK=LAST \ + -DCMAKE_INSTALL_PREFIX=../build/macos/ \ + -DCMAKE_EXE_LINKER_FLAGS="-L/opt/homebrew/lib/" \ + -DGLEW_LIBRARY_RELEASE=/opt/homebrew/lib/libGLEW.dylib + ninja + + - name: Package + run: | + cd build + ninja package + + - name: Upload output as artifact + uses: actions/upload-artifact@v4 + with: + name: principia-macos + path: build/*.zip diff --git a/packaging/glew_macos_fix.patch b/packaging/glew_macos_fix.patch new file mode 100644 index 00000000..bef73e42 --- /dev/null +++ b/packaging/glew_macos_fix.patch @@ -0,0 +1,21 @@ +--- glew.h 2022-11-15 14:16:27.000000000 +0100 ++++ glew_mod.h 2024-05-11 17:12:43.597037795 +0200 +@@ -220,13 +220,13 @@ + */ + + #if defined(__APPLE__) || defined(__linux__) +-# if defined(__cplusplus) +-# include +-# include +-# else ++//# if defined(__cplusplus) ++//# include ++//# include ++//# else + # include + # include +-# endif ++//# endif + #else + + # include