From 5e6e3453a581f7f2bafae1ce4ebeba113a523c86 Mon Sep 17 00:00:00 2001 From: Stefan Gartner Date: Mon, 21 Dec 2009 10:38:04 +0000 Subject: [PATCH] OS X: added support for building with Cocoa to Makefiles to build with Cocoa support, set WITH_COCOA to true in user-def.mk --- intern/ghost/intern/Makefile | 10 ++++++++- source/blender/makesrna/intern/Makefile | 2 +- source/blender/quicktime/apple/Makefile | 3 +-- source/nan_compile.mk | 27 +++++++++++++++++++++---- source/nan_link.mk | 7 +++++-- 5 files changed, 39 insertions(+), 10 deletions(-) diff --git a/intern/ghost/intern/Makefile b/intern/ghost/intern/Makefile index 5b95bbb3b68..a6392662c30 100644 --- a/intern/ghost/intern/Makefile +++ b/intern/ghost/intern/Makefile @@ -41,7 +41,15 @@ CCSRCS += GHOST_CallbackEventConsumer.cpp CCSRCS += GHOST_NDOFManager.cpp ifeq ($(OS),$(findstring $(OS), "darwin")) - CCSRCS += $(wildcard *Carbon.cpp) + ifeq ($(WITH_COCOA), true) + OCSRCS += $(wildcard *Cocoa.mm) + CPPFLAGS += -DGHOST_COCOA + ifeq ($(WITH_QUICKTIME), true) + CPPFLAGS += -DWITH_QUICKTIME + endif + else + CCSRCS += $(wildcard *Carbon.cpp) + endif endif ifeq ($(OS),$(findstring $(OS), "windows")) diff --git a/source/blender/makesrna/intern/Makefile b/source/blender/makesrna/intern/Makefile index 7923ea1e7de..e4e4e859ed3 100644 --- a/source/blender/makesrna/intern/Makefile +++ b/source/blender/makesrna/intern/Makefile @@ -75,7 +75,7 @@ ifeq ($(WITH_OPENJPEG), true) endif ifeq ($(WITH_QUICKTIME), true) - CPPFLAGS += -DWITH_QUICKTIME + CPPFLAGS += -DWITH_QUICKTIME -I../../quicktime endif ifeq ($(WITH_SDL),true) diff --git a/source/blender/quicktime/apple/Makefile b/source/blender/quicktime/apple/Makefile index 0cee45e3af0..19f87ed31e3 100644 --- a/source/blender/quicktime/apple/Makefile +++ b/source/blender/quicktime/apple/Makefile @@ -52,6 +52,5 @@ CPPFLAGS += -I.. # stuff needed by quicktime_[import|export].c CPPFLAGS += -I../../blenloader -I../../imbuf/intern -I../../imbuf CPPFLAGS += -I../../blenlib -I../../makesdna -I../../editors/include -I../../avi -CPPFLAGS += -I../../blenkernel -I../../render/extern/include - +CPPFLAGS += -I../../blenkernel -I../../render/extern/include -I../../windowmanager -I../../makesrna diff --git a/source/nan_compile.mk b/source/nan_compile.mk index 258d06c07b9..9036d0a0f34 100644 --- a/source/nan_compile.mk +++ b/source/nan_compile.mk @@ -73,15 +73,18 @@ ifeq ($(OS),darwin) CC ?= gcc CCC ?= g++ ifeq ($(CPU),powerpc) - CFLAGS += -pipe -fPIC -ffast-math -mcpu=7450 -mtune=G5 -funsigned-char -fno-strict-aliasing -Wno-long-double - CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing -Wno-long-double + CFLAGS += -pipe -fPIC -ffast-math -mcpu=7450 -mtune=G5 -funsigned-char -fno-strict-aliasing + CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing -wno-long-double else CFLAGS += -pipe -fPIC -ffast-math -march=pentium-m -funsigned-char -fno-strict-aliasing - CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing + CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing -wno-long-double endif # REL_CFLAGS += -O # REL_CCFLAGS += -O2 CPPFLAGS += -D_THREAD_SAFE + ifeq ($(WITH_COCOA), true) + CPPFLAGS += -DGHOST_COCOA + endif NAN_DEPEND = true OPENGL_HEADERS = /System/Library/Frameworks/OpenGL.framework AR = ar @@ -307,6 +310,20 @@ $(DIR)/$(DEBUG_DIR)%.o: %.cpp $(CCC) -c $(CCFLAGS) $(CPPFLAGS) $< -o $@ endif +$(DIR)/$(DEBUG_DIR)%.o: %.mm + ifdef NAN_DEPEND + @set -e; $(CC) -M $(CPPFLAGS) $< 2>/dev/null \ + | sed 's@\($*\)\.o[ :]*@$(DIR)/$(DEBUG_DIR)\1.o : @g' \ + > $(DIR)/$(DEBUG_DIR)$*.d; \ + [ -s $(DIR)/$(DEBUG_DIR)$*.d ] || $(RM) $(DIR)/$(DEBUG_DIR)$*.d + endif + ifdef NAN_QUIET + @echo " -- $< -- " + @$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ + else + $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ + endif + $(DIR)/$(DEBUG_DIR)%.res: %.rc ifeq ($(FREE_WINDOWS),true) windres $< -O coff -o $@ @@ -332,16 +349,18 @@ CCSRCS ?= $(wildcard *.cpp) JSRCS ?= $(wildcard *.java) ifdef NAN_DEPEND --include $(CSRCS:%.c=$(DIR)/$(DEBUG_DIR)%.d) $(CCSRCS:%.cpp=$(DIR)/$(DEBUG_DIR)%.d) +-include $(CSRCS:%.c=$(DIR)/$(DEBUG_DIR)%.d) $(CCSRCS:%.cpp=$(DIR)/$(DEBUG_DIR)%.d) $(OCSRCS:$.mm=$(DIR)/$(DEBUG_DIR)%.d) endif OBJS_AR := $(OBJS) OBJS_AR += $(CSRCS:%.c=%.o) OBJS_AR += $(CCSRCS:%.cpp=%.o) +OBJS_AR += $(OCSRCS:%.mm=%.o) OBJS_AR += $(WINRC:%.rc=%.res) OBJS += $(CSRCS:%.c=$(DIR)/$(DEBUG_DIR)%.o) OBJS += $(CCSRCS:%.cpp=$(DIR)/$(DEBUG_DIR)%.o) +OBJS += $(OCSRCS:%.mm=$(DIR)/$(DEBUG_DIR)%.o) OBJS += $(WINRC:%.rc=$(DIR)/$(DEBUG_DIR)%.res) JCLASS += $(JSRCS:%.java=$(DIR)/$(DEBUG_DIR)%.class) diff --git a/source/nan_link.mk b/source/nan_link.mk index f8bb8e8660d..0524ee7592d 100644 --- a/source/nan_link.mk +++ b/source/nan_link.mk @@ -54,8 +54,11 @@ ifeq ($(OS),darwin) LLIBS += -lz -lstdc++ ifdef USE_OSX10.4STUBS LLIBS +=-lSystemStubs - endif - LLIBS += -framework Carbon -framework AGL -framework OpenGL + endif + ifeq ($(WITH_COCOA), true) + LLIBS += -framework Cocoa + endif + LLIBS += -framework Carbon -framework AGL -framework OpenGL LLIBS += -framework QuickTime -framework CoreAudio LLIBS += -framework AudioUnit -framework AudioToolbox LDFLAGS += -L/System/Library/Frameworks/OpenGL.framework/Libraries