OS X: added support for building with Cocoa to Makefiles

to build with Cocoa support, set WITH_COCOA to true in user-def.mk
This commit is contained in:
Stefan Gartner 2009-12-21 10:38:04 +00:00
parent f7f06d96f3
commit 5e6e3453a5
5 changed files with 39 additions and 10 deletions

@ -41,7 +41,15 @@ CCSRCS += GHOST_CallbackEventConsumer.cpp
CCSRCS += GHOST_NDOFManager.cpp CCSRCS += GHOST_NDOFManager.cpp
ifeq ($(OS),$(findstring $(OS), "darwin")) 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 endif
ifeq ($(OS),$(findstring $(OS), "windows")) ifeq ($(OS),$(findstring $(OS), "windows"))

@ -75,7 +75,7 @@ ifeq ($(WITH_OPENJPEG), true)
endif endif
ifeq ($(WITH_QUICKTIME), true) ifeq ($(WITH_QUICKTIME), true)
CPPFLAGS += -DWITH_QUICKTIME CPPFLAGS += -DWITH_QUICKTIME -I../../quicktime
endif endif
ifeq ($(WITH_SDL),true) ifeq ($(WITH_SDL),true)

@ -52,6 +52,5 @@ CPPFLAGS += -I..
# stuff needed by quicktime_[import|export].c # stuff needed by quicktime_[import|export].c
CPPFLAGS += -I../../blenloader -I../../imbuf/intern -I../../imbuf CPPFLAGS += -I../../blenloader -I../../imbuf/intern -I../../imbuf
CPPFLAGS += -I../../blenlib -I../../makesdna -I../../editors/include -I../../avi 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

@ -73,15 +73,18 @@ ifeq ($(OS),darwin)
CC ?= gcc CC ?= gcc
CCC ?= g++ CCC ?= g++
ifeq ($(CPU),powerpc) ifeq ($(CPU),powerpc)
CFLAGS += -pipe -fPIC -ffast-math -mcpu=7450 -mtune=G5 -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 CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing -wno-long-double
else else
CFLAGS += -pipe -fPIC -ffast-math -march=pentium-m -funsigned-char -fno-strict-aliasing 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 endif
# REL_CFLAGS += -O # REL_CFLAGS += -O
# REL_CCFLAGS += -O2 # REL_CCFLAGS += -O2
CPPFLAGS += -D_THREAD_SAFE CPPFLAGS += -D_THREAD_SAFE
ifeq ($(WITH_COCOA), true)
CPPFLAGS += -DGHOST_COCOA
endif
NAN_DEPEND = true NAN_DEPEND = true
OPENGL_HEADERS = /System/Library/Frameworks/OpenGL.framework OPENGL_HEADERS = /System/Library/Frameworks/OpenGL.framework
AR = ar AR = ar
@ -307,6 +310,20 @@ $(DIR)/$(DEBUG_DIR)%.o: %.cpp
$(CCC) -c $(CCFLAGS) $(CPPFLAGS) $< -o $@ $(CCC) -c $(CCFLAGS) $(CPPFLAGS) $< -o $@
endif 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 $(DIR)/$(DEBUG_DIR)%.res: %.rc
ifeq ($(FREE_WINDOWS),true) ifeq ($(FREE_WINDOWS),true)
windres $< -O coff -o $@ windres $< -O coff -o $@
@ -332,16 +349,18 @@ CCSRCS ?= $(wildcard *.cpp)
JSRCS ?= $(wildcard *.java) JSRCS ?= $(wildcard *.java)
ifdef NAN_DEPEND 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 endif
OBJS_AR := $(OBJS) OBJS_AR := $(OBJS)
OBJS_AR += $(CSRCS:%.c=%.o) OBJS_AR += $(CSRCS:%.c=%.o)
OBJS_AR += $(CCSRCS:%.cpp=%.o) OBJS_AR += $(CCSRCS:%.cpp=%.o)
OBJS_AR += $(OCSRCS:%.mm=%.o)
OBJS_AR += $(WINRC:%.rc=%.res) OBJS_AR += $(WINRC:%.rc=%.res)
OBJS += $(CSRCS:%.c=$(DIR)/$(DEBUG_DIR)%.o) OBJS += $(CSRCS:%.c=$(DIR)/$(DEBUG_DIR)%.o)
OBJS += $(CCSRCS:%.cpp=$(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) OBJS += $(WINRC:%.rc=$(DIR)/$(DEBUG_DIR)%.res)
JCLASS += $(JSRCS:%.java=$(DIR)/$(DEBUG_DIR)%.class) JCLASS += $(JSRCS:%.java=$(DIR)/$(DEBUG_DIR)%.class)

@ -54,8 +54,11 @@ ifeq ($(OS),darwin)
LLIBS += -lz -lstdc++ LLIBS += -lz -lstdc++
ifdef USE_OSX10.4STUBS ifdef USE_OSX10.4STUBS
LLIBS +=-lSystemStubs LLIBS +=-lSystemStubs
endif endif
LLIBS += -framework Carbon -framework AGL -framework OpenGL ifeq ($(WITH_COCOA), true)
LLIBS += -framework Cocoa
endif
LLIBS += -framework Carbon -framework AGL -framework OpenGL
LLIBS += -framework QuickTime -framework CoreAudio LLIBS += -framework QuickTime -framework CoreAudio
LLIBS += -framework AudioUnit -framework AudioToolbox LLIBS += -framework AudioUnit -framework AudioToolbox
LDFLAGS += -L/System/Library/Frameworks/OpenGL.framework/Libraries LDFLAGS += -L/System/Library/Frameworks/OpenGL.framework/Libraries