From 8a50516b1e534f5985aec767cd7816aebf47f46d Mon Sep 17 00:00:00 2001 From: Ben Beshara Date: Wed, 8 Dec 2021 23:06:28 +1100 Subject: [PATCH] Fixed build on arm macOS --- Makefile | 17 +++++++++++++---- src/vk/header/local.h | 5 +++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index d528a5a..7f01b1f 100644 --- a/Makefile +++ b/Makefile @@ -46,6 +46,10 @@ YQ2_ARCH ?= $(PROCESSOR_ARCHITECTURE) endif endif # windows but MINGW_CHOST not defined else +ifneq ($(YQ2_OSTYPE), Darwin) +else +YQ2_ARCH ?= $(shell uname -m) +endif # Normalize some abiguous YQ2_ARCH strings YQ2_ARCH ?= $(shell uname -m | sed -e 's/i.86/i386/' -e 's/amd64/x86_64/' -e 's/^arm.*/arm/') endif @@ -235,11 +239,7 @@ override LDFLAGS += -shared # ---------- # Extra LDFLAGS for SDL -ifeq ($(YQ2_OSTYPE), Darwin) -SDLLDFLAGS := -lSDL2 -else # not Darwin SDLLDFLAGS := $(shell sdl2-config --libs) -endif # Darwin # The renderer libs don't need libSDL2main, libmingw32 or -mwindows. ifeq ($(YQ2_OSTYPE), Windows) @@ -280,6 +280,11 @@ ref_vk: @echo "===> Building ref_vk.dll" ${Q}mkdir -p release $(MAKE) release/ref_vk.dll +else ifeq ($(YQ2_OSTYPE), Darwin) +ref_vk: + @echo "===> Building ref_vk.dlylib" + ${Q}mkdir -p release + $(MAKE) release/ref_vk.dylib else ref_vk: @echo "===> Building ref_vk.so" @@ -353,6 +358,10 @@ ifeq ($(YQ2_OSTYPE), Windows) release/ref_vk.dll : $(REFVK_OBJS) @echo "===> LD $@" ${Q}$(CC) $(REFVK_OBJS) $(LDFLAGS) $(DLL_SDLLDFLAGS) -o $@ +else ifeq ($(YQ2_OSTYPE), Darwin) +release/ref_vk.dylib : $(REFVK_OBJS) + @echo "===> LD $@" + ${Q}$(CC) $(LDFLAGS) $(REFVK_OBJS) $(LDLIBS) $(SDLLDFLAGS) -o $@ else release/ref_vk.so : $(REFVK_OBJS) @echo "===> LD $@" diff --git a/src/vk/header/local.h b/src/vk/header/local.h index fa11728..70276e2 100644 --- a/src/vk/header/local.h +++ b/src/vk/header/local.h @@ -24,8 +24,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include +#if defined(__APPLE__) +#include +#include +#else #include #include +#endif #include "../../common/header/ref_shared.h"