Fix compiling against macOS system OpenAL and SDL2 frameworks

This commit is contained in:
Zack Middleton 2018-04-24 12:28:46 -05:00
parent 7ad05ccf2d
commit 3bc3fa1b3b
1 changed files with 18 additions and 11 deletions

View File

@ -480,6 +480,9 @@ ifeq ($(PLATFORM),darwin)
BASE_CFLAGS += -fno-strict-aliasing -fno-common -pipe BASE_CFLAGS += -fno-strict-aliasing -fno-common -pipe
ifeq ($(USE_OPENAL),1) ifeq ($(USE_OPENAL),1)
ifneq ($(USE_LOCAL_HEADERS),1)
CLIENT_CFLAGS += -I/System/Library/Frameworks/OpenAL.framework/Headers
endif
ifneq ($(USE_OPENAL_DLOPEN),1) ifneq ($(USE_OPENAL_DLOPEN),1)
CLIENT_LIBS += -framework OpenAL CLIENT_LIBS += -framework OpenAL
endif endif
@ -494,9 +497,9 @@ ifeq ($(PLATFORM),darwin)
BASE_CFLAGS += -D_THREAD_SAFE=1 BASE_CFLAGS += -D_THREAD_SAFE=1
# FIXME: It is not possible to build using system SDL2 framework CLIENT_LIBS += -framework IOKit
# 1. IF you try, this Makefile will still drop libSDL-2.0.0.dylib into the builddir RENDERER_LIBS += -framework OpenGL
# 2. Debugger warns that you have 2- which one will be used is undefined
ifeq ($(USE_LOCAL_HEADERS),1) ifeq ($(USE_LOCAL_HEADERS),1)
# libSDL2-2.0.0.dylib for PPC is SDL 2.0.1 + changes to compile # libSDL2-2.0.0.dylib for PPC is SDL 2.0.1 + changes to compile
ifeq ($(ARCH),ppc) ifeq ($(ARCH),ppc)
@ -506,14 +509,18 @@ ifeq ($(PLATFORM),darwin)
endif endif
endif endif
# We copy sdlmain before ranlib'ing it so that subversion doesn't think # We copy sdlmain before ranlib'ing it so that subversion doesn't think
# the file has been modified by each build. # the file has been modified by each build.
LIBSDLMAIN=$(B)/libSDL2main.a LIBSDLMAIN=$(B)/libSDL2main.a
LIBSDLMAINSRC=$(LIBSDIR)/macosx/libSDL2main.a LIBSDLMAINSRC=$(LIBSDIR)/macosx/libSDL2main.a
CLIENT_LIBS += -framework IOKit \ CLIENT_LIBS += $(LIBSDIR)/macosx/libSDL2-2.0.0.dylib
$(LIBSDIR)/macosx/libSDL2-2.0.0.dylib RENDERER_LIBS += $(LIBSDIR)/macosx/libSDL2-2.0.0.dylib
RENDERER_LIBS += -framework OpenGL $(LIBSDIR)/macosx/libSDL2-2.0.0.dylib CLIENT_EXTRA_FILES += $(LIBSDIR)/macosx/libSDL2-2.0.0.dylib
CLIENT_EXTRA_FILES += $(LIBSDIR)/macosx/libSDL2-2.0.0.dylib else
BASE_CFLAGS += -I/Library/Frameworks/SDL2.framework/Headers
CLIENT_LIBS += -framework SDL2
RENDERER_LIBS += -framework SDL2
endif
OPTIMIZE = $(OPTIMIZEVM) -ffast-math OPTIMIZE = $(OPTIMIZEVM) -ffast-math