OS X: added support for building with Cocoa to Makefiles
authorStefan Gartner <stefang@aon.at>
Mon, 21 Dec 2009 10:38:04 +0000 (10:38 +0000)
committerStefan Gartner <stefang@aon.at>
Mon, 21 Dec 2009 10:38:04 +0000 (10:38 +0000)
to build with Cocoa support, set WITH_COCOA to true in user-def.mk

intern/ghost/intern/Makefile
source/blender/makesrna/intern/Makefile
source/blender/quicktime/apple/Makefile
source/nan_compile.mk
source/nan_link.mk

index 5b95bbb3b6848ee10618e9aebeebd0fdc45fc435..a6392662c3031e276414966f43dded6a20e4a9f0 100644 (file)
@@ -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"))
index 7923ea1e7de9aa21c7dd95acf8e659284dccb1ce..e4e4e859ed3966e439c01425b2de6549028e6b4a 100644 (file)
@@ -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)
index 0cee45e3af03f358be1ae6947546510319dec311..19f87ed31e31462cf0bd9e50671801bc1521bc59 100644 (file)
@@ -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
 
index 258d06c07b90da468074c21c8de3fd86dc961372..9036d0a0f34c6047090c2426d04a46c9ff984356 100644 (file)
@@ -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)
index f8bb8e8660dc1c46f201e5f71fa336900a784a8a..0524ee7592d75822c810e149eb946bd08dae7557 100644 (file)
@@ -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