Merge with trunk, revision 28528 - 28976.
[blender-staging.git] / config / darwin-config.py
1 #
2 # Note : if you want to alter this file
3 # copy it as a whole in the upper folder
4 # as user-config.py
5 # dont create a new file with only some
6 # vars changed.
7
8 import commands
9
10 # IMPORTANT NOTE : OFFICIAL BUILDS SHOULD BE DONE WITH SDKs
11 USE_SDK=True
12
13 #############################################################################
14 ###################     Cocoa & architecture settings      ##################
15 #############################################################################
16 WITH_GHOST_COCOA=True
17 MACOSX_ARCHITECTURE = 'i386' # valid archs: ppc, i386, ppc64, x86_64
18
19
20 cmd = 'uname -p'
21 MAC_PROC=commands.getoutput(cmd) 
22 cmd = 'uname -r'
23 cmd_res=commands.getoutput(cmd) 
24 if cmd_res[0]=='7':
25         MAC_CUR_VER='10.3'
26 elif cmd_res[0]=='8':
27         MAC_CUR_VER='10.4'
28 elif cmd_res[0]=='9':
29         MAC_CUR_VER='10.5'
30 elif cmd_res[0]=='10':
31         MAC_CUR_VER='10.6'
32
33 if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'ppc64':
34         USE_QTKIT=True # Carbon quicktime is not available for 64bit
35
36
37 # Default target OSX settings per architecture
38 # Can be customized
39
40 if MACOSX_ARCHITECTURE == 'ppc':
41 # ppc release are now made for 10.4
42 #       MAC_MIN_VERS = '10.3'
43 #       MACOSX_SDK='/Developer/SDKs/MacOSX10.3.9.sdk'
44 #       LCGDIR = '#../lib/darwin-6.1-powerpc'
45 #       CC = 'gcc-3.3'
46 #       CXX = 'g++-3.3'
47         MAC_MIN_VERS = '10.4'
48         MACOSX_DEPLOYMENT_TARGET = '10.4'
49         MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
50         LCGDIR = '#../lib/darwin-8.0.0-powerpc'
51         CC = 'gcc-4.0'
52         CXX = 'g++-4.0'
53 elif MACOSX_ARCHITECTURE == 'i386':
54         MAC_MIN_VERS = '10.4'
55         MACOSX_DEPLOYMENT_TARGET = '10.4'
56         MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
57         LCGDIR = '#../lib/darwin-8.x.i386'
58         CC = 'gcc-4.0'
59         CXX = 'g++-4.0'
60 else :
61         MAC_MIN_VERS = '10.5'
62         MACOSX_DEPLOYMENT_TARGET = '10.5'
63         MACOSX_SDK='/Developer/SDKs/MacOSX10.5.sdk'
64         LCGDIR = '#../lib/darwin-9.x.universal'
65         CC = 'gcc-4.2'
66         CXX = 'g++-4.2'
67
68 LIBDIR = '${LCGDIR}'
69
70 #############################################################################
71 ###################          Dependency settings           ##################
72 #############################################################################
73
74 #Defaults openMP to true if compiler (currently only gcc 4.2) handles it
75 if CC == 'gcc-4.2':
76     WITH_BF_OPENMP = True  # multithreading for fluids, cloth and smoke
77 else:
78     WITH_BF_OPENMP = False
79
80 # enable ffmpeg  support
81 WITH_BF_FFMPEG = True  # -DWITH_FFMPEG
82 BF_FFMPEG = LIBDIR + '/ffmpeg'
83 BF_FFMPEG_INC = "${BF_FFMPEG}/include"
84 BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
85 BF_FFMPEG_LIB = 'avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore theora theoradec theoraenc vorbis vorbisenc vorbisfile ogg bz2'
86 #bz2 is a standard osx dynlib
87
88 # python 3.1 uses precompiled libraries in bf svn /lib by default
89 BF_PYTHON_VERSION = '3.1'
90 BF_PYTHON = LIBDIR + '/python'
91 BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
92 # BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
93 BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}'
94 BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}'
95 # BF_PYTHON_LINKFLAGS = ['-u', '_PyMac_Error', '-framework', 'System']
96         
97 WITH_BF_OPENAL = True
98 #different lib must be used  following version of gcc
99 # for gcc 3.3
100 #BF_OPENAL = LIBDIR + '/openal'
101 # for gcc 3.4 and ulterior
102 if MAC_PROC == 'powerpc':
103         BF_OPENAL = '#../lib/darwin-8.0.0-powerpc/openal'
104 else :
105         BF_OPENAL = LIBDIR + '/openal'
106
107 WITH_BF_STATICOPENAL = False
108 BF_OPENAL_INC = '${BF_OPENAL}/include' # only headers from libdir needed for proper use of framework !!!!
109 #BF_OPENAL_LIB = 'openal'
110 #BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
111 # Warning, this static lib configuration is untested! users of this OS please confirm.
112 #BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
113
114 # Warning, this static lib configuration is untested! users of this OS please confirm.
115 BF_CXX = '/usr'
116 WITH_BF_STATICCXX = False
117 BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
118
119 BF_LIBSAMPLERATE = LIBDIR + '/samplerate'
120 BF_LIBSAMPLERATE_INC = '${BF_LIBSAMPLERATE}/include'
121 BF_LIBSAMPLERATE_LIB = 'samplerate'
122 BF_LIBSAMPLERATE_LIBPATH = '${BF_LIBSAMPLERATE}/lib'
123
124 # TODO - set proper paths here (add precompiled to lib/ ? )
125 WITH_BF_JACK = False
126 BF_JACK = '/usr'
127 BF_JACK_INC = '${BF_JACK}/include/jack'
128 BF_JACK_LIB = 'jack'
129 BF_JACK_LIBPATH = '${BF_JACK}/lib'
130
131 WITH_BF_SNDFILE = True
132 BF_SNDFILE = LIBDIR + '/sndfile'
133 BF_SNDFILE_INC = '${BF_SNDFILE}/include'
134 BF_SNDFILE_LIB = 'sndfile FLAC ogg vorbis vorbisenc'
135 BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib ${BF_FFMPEG}/lib' #ogg libs are stored in ffmpeg dir
136
137 WITH_BF_SDL = True
138 BF_SDL = LIBDIR + '/sdl' #$(shell sdl-config --prefix)
139 BF_SDL_INC = '${BF_SDL}/include' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
140 BF_SDL_LIB = 'SDL' #BF_SDL #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
141 BF_SDL_LIBPATH = '${BF_SDL}/lib'
142
143 WITH_BF_OPENEXR = True
144 WITH_BF_STATICOPENEXR = False
145 BF_OPENEXR = '${LCGDIR}/openexr'
146 BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR'
147 BF_OPENEXR_LIB = ' Iex Half IlmImf Imath IlmThread'
148 BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
149 # Warning, this static lib configuration is untested! users of this OS please confirm.
150 BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
151
152 WITH_BF_DDS = True
153
154 WITH_BF_JPEG = True
155 BF_JPEG = LIBDIR + '/jpeg'
156 BF_JPEG_INC = '${BF_JPEG}/include'
157 BF_JPEG_LIB = 'jpeg'
158 BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
159
160 WITH_BF_PNG = True
161 BF_PNG = LIBDIR + '/png'
162 BF_PNG_INC = '${BF_PNG}/include'
163 BF_PNG_LIB = 'png'
164 BF_PNG_LIBPATH = '${BF_PNG}/lib'
165
166 WITH_BF_TIFF = True
167 BF_TIFF = LIBDIR + '/tiff'
168 BF_TIFF_INC = '${BF_TIFF}/include'
169 BF_TIFF_LIB = 'tiff'
170 BF_TIFF_LIBPATH = '${BF_TIFF}/lib'
171
172 WITH_BF_ZLIB = True
173 BF_ZLIB = '/usr'
174 BF_ZLIB_INC = '${BF_ZLIB}/include'
175 BF_ZLIB_LIB = 'z'
176
177 WITH_BF_INTERNATIONAL = True
178
179 BF_GETTEXT = LIBDIR + '/gettext'
180 BF_GETTEXT_INC = '${BF_GETTEXT}/include'
181 BF_GETTEXT_LIB = 'intl'
182 BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
183
184 WITH_BF_GAMEENGINE=True
185 WITH_BF_PLAYER = False
186
187 WITH_BF_BULLET = True
188 BF_BULLET = '#extern/bullet2/src'
189 BF_BULLET_INC = '${BF_BULLET}'
190 BF_BULLET_LIB = 'extern_bullet'
191
192 WITH_BF_FFTW3 = True
193 BF_FFTW3 = LIBDIR + '/fftw3'
194 BF_FFTW3_INC = '${BF_FFTW3}/include'
195 BF_FFTW3_LIB = 'libfftw3'
196 BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
197
198 #WITH_BF_NSPR = True
199 #BF_NSPR = $(LIBDIR)/nspr
200 #BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
201 #BF_NSPR_LIB = 
202
203 # Uncomment the following line to use Mozilla inplace of netscape
204 #CPPFLAGS += -DMOZ_NOT_NET
205 # Location of MOZILLA/Netscape header files...
206 #BF_MOZILLA = $(LIBDIR)/mozilla
207 #BF_MOZILLA_INC = -I$(BF_MOZILLA)/include/mozilla/nspr -I$(BF_MOZILLA)/include/mozilla -I$(BF_MOZILLA)/include/mozilla/xpcom -I$(BF_MOZILLA)/include/mozilla/idl
208 #BF_MOZILLA_LIB =
209 # Will fall back to look in BF_MOZILLA_INC/nspr and BF_MOZILLA_LIB
210 # if this is not set.
211 #
212 # Be paranoid regarding library creation (do not update archives)
213 #BF_PARANOID = True
214
215 # enable freetype2 support for text objects
216 BF_FREETYPE = LIBDIR + '/freetype'
217 BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
218 BF_FREETYPE_LIB = 'freetype'
219 BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
220
221 WITH_BF_QUICKTIME = True
222
223 WITH_BF_ICONV = True
224 BF_ICONV = '/usr'
225 BF_ICONV_INC = '${BF_ICONV}/include'
226 BF_ICONV_LIB = 'iconv'
227 #BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
228
229 # Mesa Libs should go here if your using them as well....
230 WITH_BF_STATICOPENGL = True
231 BF_OPENGL_LIB = 'GL GLU'
232 BF_OPENGL_LIBPATH = '/System/Library/Frameworks/OpenGL.framework/Libraries'
233 BF_OPENGL_LINKFLAGS = ['-framework', 'OpenGL']
234
235 #OpenCollada flags
236 WITH_BF_COLLADA = False
237 BF_COLLADA = '#source/blender/collada'
238 BF_COLLADA_INC = '${BF_COLLADA}'
239 BF_COLLADA_LIB = 'bf_collada'
240 BF_OPENCOLLADA = LIBDIR + '/opencollada'
241 BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include'
242 BF_OPENCOLLADA_LIB = 'OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils OpenCOLLADAStreamWriter MathMLSolver GeneratedSaxParser UTF xml2 buffer ftoa'
243 BF_OPENCOLLADA_LIBPATH = LIBDIR + '/opencollada'
244 BF_PCRE = LIBDIR + '/opencollada'
245 BF_PCRE_LIB = 'pcre'
246 BF_PCRE_LIBPATH = '${BF_PCRE}/lib'
247 #BF_EXPAT = '/usr'
248 #BF_EXPAT_LIB = 'expat'
249 #BF_EXPAT_LIBPATH = '/usr/lib'
250
251 #Ray trace optimization
252 if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'i386':
253     WITH_BF_RAYOPTIMIZATION = True
254 else:
255     WITH_BF_RAYOPTIMIZATION = False
256 if MACOSX_ARCHITECTURE == 'i386':
257     BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse']
258 elif MACOSX_ARCHITECTURE == 'x86_64':
259     BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse','-msse2']
260     
261
262 #############################################################################
263 ###################  various compile settings and flags    ##################
264 #############################################################################
265
266 BF_QUIET = '1' # suppress verbose output
267
268 if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'ppc64':
269         ARCH_FLAGS = ['-m64']
270 else:
271         ARCH_FLAGS = ['-m32']
272
273 CFLAGS = ['-pipe','-funsigned-char']+ARCH_FLAGS
274
275 CPPFLAGS = ['-fpascal-strings']+ARCH_FLAGS
276 CCFLAGS = ['-pipe','-funsigned-char','-fpascal-strings']+ARCH_FLAGS
277 CXXFLAGS = ['-pipe','-funsigned-char', '-fpascal-strings']+ARCH_FLAGS
278
279 if WITH_GHOST_COCOA==True:
280         PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Cocoa','-framework','Carbon','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','OpenAL']+ARCH_FLAGS
281 else:
282         PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Carbon','-framework','AGL','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','OpenAL']+ARCH_FLAGS
283
284 if WITH_BF_QUICKTIME == True:
285         if USE_QTKIT == True:
286                 PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QTKit']
287         else:
288                 PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QuickTime']
289
290 #note to build succesfully on 10.3.9 SDK you need to patch  10.3.9 by adding the SystemStubs.a lib from 10.4
291 LLIBS = ['stdc++', 'SystemStubs']
292
293 # some flags shuffling for different Os versions
294 if MAC_MIN_VERS == '10.3':
295         CFLAGS = ['-fuse-cxa-atexit']+CFLAGS
296         CXXFLAGS = ['-fuse-cxa-atexit']+CXXFLAGS
297         PLATFORM_LINKFLAGS = ['-fuse-cxa-atexit']+PLATFORM_LINKFLAGS
298         LLIBS.append('crt3.o')
299         
300 if USE_SDK==True:
301         SDK_FLAGS=['-isysroot', MACOSX_SDK,'-mmacosx-version-min='+MAC_MIN_VERS,'-arch',MACOSX_ARCHITECTURE]    
302         PLATFORM_LINKFLAGS = ['-mmacosx-version-min='+MAC_MIN_VERS,'-Wl','-isysroot',MACOSX_SDK,'-arch',MACOSX_ARCHITECTURE]+PLATFORM_LINKFLAGS
303         CCFLAGS=SDK_FLAGS+CCFLAGS
304         CXXFLAGS=SDK_FLAGS+CXXFLAGS
305
306 #Intel Macs are CoreDuo and Up  
307 if MACOSX_ARCHITECTURE == 'i386' or MACOSX_ARCHITECTURE == 'x86_64':
308         REL_CFLAGS = ['-O2','-ftree-vectorize','-msse','-msse2','-msse3','-mfpmath=sse']
309         REL_CCFLAGS = ['-O2','-ftree-vectorize','-msse','-msse2','-msse3','-mfpmath=sse']
310 else:
311         CFLAGS = CFLAGS+['-fno-strict-aliasing']
312         CCFLAGS =  CCFLAGS+['-fno-strict-aliasing']
313         CXXFLAGS = CXXFLAGS+['-fno-strict-aliasing']
314         REL_CFLAGS = ['-O2']
315         REL_CCFLAGS = ['-O2']
316
317 # Intel 64bit Macs are Core2Duo and up
318 if MACOSX_ARCHITECTURE == 'x86_64':
319         REL_CFLAGS = REL_CFLAGS+['-march=core2','-mssse3','-with-tune=core2','-enable-threads']
320         REL_CCFLAGS = REL_CCFLAGS+['-march=core2','-mssse3','-with-tune=core2','-enable-threads']
321
322 CC_WARN = ['-Wall']
323 C_WARN = ['-Wno-char-subscripts', '-Wpointer-arith', '-Wcast-align', '-Wdeclaration-after-statement', '-Wno-unknown-pragmas']
324 CXX_WARN = ['-Wno-invalid-offsetof', '-Wno-sign-compare']
325
326 ##FIX_STUBS_WARNINGS = -Wno-unused
327
328 ##LOPTS = --dynamic
329 ##DYNLDFLAGS = -shared $(LDFLAGS)
330
331 BF_PROFILE_CCFLAGS = ['-pg', '-g ']
332 BF_PROFILE_LINKFLAGS = ['-pg']
333 BF_PROFILE = False
334
335 BF_DEBUG = False
336 BF_DEBUG_CCFLAGS = ['-g']
337
338 #############################################################################
339 ###################           Output directories           ##################
340 #############################################################################
341
342 BF_BUILDDIR='../build/darwin'
343 BF_INSTALLDIR='../install/darwin'