From 330b1352fb2c6348109ef844cd424072c712465d Mon Sep 17 00:00:00 2001 From: Denis Pauk Date: Sat, 22 Jun 2024 16:46:47 +0300 Subject: [PATCH] Add macos test build on release tag --- .github/workflows/macos.yml | 38 ++++++++++++++++++++++++++++++++ .github/workflows/windows.yml | 4 ++-- Makefile | 14 +++++++++++- doc/020_installation.md | 2 +- src/client/cl_screen.c | 2 +- src/client/refresh/gl4/gl4_sdl.c | 6 +++++ 6 files changed, 61 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/macos.yml diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 00000000..9e196b41 --- /dev/null +++ b/.github/workflows/macos.yml @@ -0,0 +1,38 @@ +name: Build macos application +run-name: macos +on: + push: + tags: + - "*" +jobs: + build64: + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + include: + - env: macos + steps: + - name: Install build libraries + run: | + brew update + brew install sdl2 openal-soft make ffmpeg molten-vk + brew upgrade + - name: Check out repository code + uses: actions/checkout@v4 + - name: Build Release code + run: | + make + - name: Create release package + run: | + # copy docs + cp -rv stuff/mapfixes/* LICENSE README.md doc release/ + # create archive + mkdir yquake2remaster-${{matrix.env}}-${{github.ref_name}} + cp -rv release/* yquake2remaster-${{matrix.env}}-${{github.ref_name}} + zip -9r yquake2remaster-${{matrix.env}}-${{github.ref_name}}.zip yquake2remaster-${{matrix.env}}-${{github.ref_name}} + - name: Upload Release Asset + uses: softprops/action-gh-release@v2 + with: + files: | + yquake2remaster-${{matrix.env}}-${{github.ref_name}}.zip diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 8bbbc9c6..57574b01 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -64,7 +64,7 @@ jobs: cp -rv release/* yquake2remaster-${{matrix.env}}-${{github.ref_name}} zip -9r yquake2remaster-${{matrix.env}}-${{github.ref_name}}.zip yquake2remaster-${{matrix.env}}-${{github.ref_name}} - name: Upload Release Asset - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: files: | yquake2remaster-${{matrix.env}}-${{github.ref_name}}.zip @@ -122,7 +122,7 @@ jobs: cp -rv release/* yquake2remaster-${{matrix.env}}-${{github.ref_name}} zip -9r yquake2remaster-${{matrix.env}}-${{github.ref_name}}.zip yquake2remaster-${{matrix.env}}-${{github.ref_name}} - name: Upload Release Asset - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: files: | yquake2remaster-${{matrix.env}}-${{github.ref_name}}.zip diff --git a/Makefile b/Makefile index ad3040c3..b3d27b5d 100644 --- a/Makefile +++ b/Makefile @@ -743,6 +743,15 @@ ref_gl4: release/ref_gl4.dll : GLAD_INCLUDE = -Isrc/client/refresh/gl4/glad/include release/ref_gl4.dll : LDFLAGS += -shared +else ifeq ($(YQ2_OSTYPE), Darwin) + +ref_gl4: + @echo "===> Building ref_gl4.dylib" + $(MAKE) release/ref_gl4.dylib + +release/ref_gl4.dylib : GLAD_INCLUDE = -Isrc/client/refresh/gl4/glad/include +release/ref_gl4.dylib : LDFLAGS += -shared + else # not Windows or Darwin - macOS doesn't support OpenGL 4.6 ref_gl4: @@ -1469,7 +1478,10 @@ release/ref_gl4.dll : $(REFGL4_OBJS) @echo "===> LD $@" ${Q}$(CC) $(LDFLAGS) $(REFGL4_OBJS) $(LDLIBS) $(DLL_SDLLDFLAGS) -o $@ $(Q)strip $@ - +else ifeq ($(YQ2_OSTYPE), Darwin) +release/ref_gl4.dylib : $(REFGL4_OBJS) + @echo "===> LD $@" + ${Q}$(CC) $(LDFLAGS) $(REFGL4_OBJS) $(LDLIBS) $(SDLLDFLAGS) -o $@ else release/ref_gl4.so : $(REFGL4_OBJS) @echo "===> LD $@" diff --git a/doc/020_installation.md b/doc/020_installation.md index 656302b4..918e059d 100644 --- a/doc/020_installation.md +++ b/doc/020_installation.md @@ -329,7 +329,7 @@ The build dependencies can be installed with: * On Solaris/Illumos: `pkg install sdl2 openal curl` * On Haiku: `pkgman libsdl2_devel openal_devel curl_devel` * On MacOS the dependencies can be installed with Homebrew (from - https://brew.sh): `brew install sdl2 openal-soft` + https://brew.sh): `brew install sdl2 openal-soft make ffmpeg molten-vk` Other distributions or platforms often have package named similar to the Debian or FreeBSD packages. diff --git a/src/client/cl_screen.c b/src/client/cl_screen.c index f69445a0..b4cd4aca 100644 --- a/src/client/cl_screen.c +++ b/src/client/cl_screen.c @@ -67,8 +67,8 @@ int crosshair_width, crosshair_height; extern cvar_t *cl_showfps; extern cvar_t *crosshair_scale; extern cvar_t *cl_showspeed; -extern float GetPlayerSpeed(); +float GetPlayerSpeed(float* speed, float* speedxy); void SCR_TimeRefresh_f(void); void SCR_Loading_f(void); diff --git a/src/client/refresh/gl4/gl4_sdl.c b/src/client/refresh/gl4/gl4_sdl.c index b1ffd29c..10059c66 100644 --- a/src/client/refresh/gl4/gl4_sdl.c +++ b/src/client/refresh/gl4/gl4_sdl.c @@ -240,7 +240,11 @@ int GL4_PrepareForWindow(void) else { SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4); +#if !defined(__APPLE__) SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 6); +#else + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); +#endif } SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); @@ -359,6 +363,7 @@ int GL4_InitContext(void* win) } else if (GLVersion.major < 4 || (GLVersion.major == 4 && GLVersion.minor < 6)) { +#if !defined(__APPLE__) if ((!gl_version_override->value) || (GLVersion.major < gl_version_override->value)) { @@ -368,6 +373,7 @@ int GL4_InitContext(void* win) return false; } else +#endif { R_Printf(PRINT_ALL, "%s(): Warning: glad only got GL version %d.%d.\n" "Some functionality could be broken.\n",