Merging r42193 through r42349 from trunk into soc-2011-tomato
[blender.git] / build_files / scons / 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
25 if cmd_res[:1]=='7':
26     MAC_CUR_VER='10.3'
27 elif cmd_res[:1]=='8':
28     MAC_CUR_VER='10.4'
29 elif cmd_res[:1]=='9':
30     MAC_CUR_VER='10.5'
31 elif cmd_res[:2]=='10':
32     MAC_CUR_VER='10.6'
33 elif cmd_res[:2]=='11':
34     MAC_CUR_VER='10.7'
35 cmd = 'xcodebuild -version'
36 cmd_xcode=commands.getoutput(cmd)
37 XCODE_CUR_VER=cmd_xcode
38 cmd = 'xcodebuild -showsdks'
39 cmd_sdk=commands.getoutput(cmd)
40 MACOSX_SDK_CHECK=cmd_sdk
41
42 if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'ppc64':
43     USE_QTKIT=True # Carbon quicktime is not available for 64bit
44
45
46 # Default target OSX settings per architecture
47 # Can be customized
48
49 if MACOSX_ARCHITECTURE == 'ppc' and MAC_CUR_VER == '10.4':
50 # all releases are now made for 10.5 !
51 #   MAC_MIN_VERS = '10.3'
52 #   MACOSX_SDK='/Developer/SDKs/MacOSX10.3.9.sdk'
53 #   LCGDIR = '#../lib/darwin-6.1-powerpc'
54 #   CC = 'gcc-3.3'
55 #   CXX = 'g++-3.3'
56     MAC_MIN_VERS = '10.4'
57     MACOSX_DEPLOYMENT_TARGET = '10.4'
58     MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
59     LCGDIR = '#../lib/darwin-8.0.0-powerpc'
60     CC = 'gcc-4.0'
61     CXX = 'g++-4.0'
62 elif MACOSX_ARCHITECTURE == 'i386' and MAC_CUR_VER == '10.4':
63     MAC_MIN_VERS = '10.4'
64     MACOSX_DEPLOYMENT_TARGET = '10.4'
65     MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
66     LCGDIR = '#../lib/darwin-8.x.i386'
67     CC = 'gcc-4.0'
68     CXX = 'g++-4.0'
69 else :
70     if 'Mac OS X 10.5' in MACOSX_SDK_CHECK:
71         # OSX 10.5/6 with Xcode 3.x
72         MAC_MIN_VERS = '10.5'
73         MACOSX_DEPLOYMENT_TARGET = '10.5'
74         MACOSX_SDK='/Developer/SDKs/MacOSX10.5.sdk'
75         LCGDIR = '#../lib/darwin-9.x.universal'
76         CC = 'gcc-4.2'
77         CXX = 'g++-4.2'
78     else:
79         # OSX 10.6/7 with Xcode 4.x
80         MAC_MIN_VERS = '10.6'
81         MACOSX_DEPLOYMENT_TARGET = '10.6'
82         MACOSX_SDK='/Developer/SDKs/MacOSX10.6.sdk'
83         LCGDIR = '#../lib/darwin-9.x.universal'
84         CC = 'gcc-4.2'
85         CXX = 'g++-4.2'
86
87 LIBDIR = '${LCGDIR}'
88
89 #############################################################################
90 ###################          Dependency settings           ##################
91 #############################################################################
92
93 #Defaults openMP to true if compiler handles it ( only gcc 4.6.1 and newer )
94 # if your compiler does not have accurate suffix you may have to enable it by hand !
95 if CC.endswith('4.6.1'):
96     WITH_BF_OPENMP = True  # multithreading for fluids, cloth, sculpt and smoke
97 else:
98     WITH_BF_OPENMP = False
99
100 # enable ffmpeg  support
101 WITH_BF_FFMPEG = True  # -DWITH_FFMPEG
102 BF_FFMPEG = LIBDIR + '/ffmpeg'
103 BF_FFMPEG_INC = "${BF_FFMPEG}/include"
104 BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
105 BF_FFMPEG_LIB = 'avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore theora theoradec theoraenc vorbis vorbisenc vorbisfile ogg bz2'
106 #bz2 is a standard osx dynlib
107
108 BF_PYTHON_VERSION = '3.2'
109 WITH_OSX_STATICPYTHON = True
110
111 if WITH_OSX_STATICPYTHON:
112     # python 3.2 uses precompiled libraries in bf svn /lib by default
113
114     BF_PYTHON = LIBDIR + '/python'
115     BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
116     # BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
117     BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}'
118     BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}'
119     # BF_PYTHON_LINKFLAGS = ['-u', '_PyMac_Error', '-framework', 'System']
120 else:
121     # python 3.2 uses Python-framework additionally installed in /Library/Frameworks
122
123     BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/'
124     BF_PYTHON_INC = '${BF_PYTHON}${BF_PYTHON_VERSION}/include/python${BF_PYTHON_VERSION}m'
125     BF_PYTHON_BINARY = '${BF_PYTHON}${BF_PYTHON_VERSION}/bin/python${BF_PYTHON_VERSION}'
126     #BF_PYTHON_LIB = ''
127     BF_PYTHON_LIBPATH = '${BF_PYTHON}${BF_PYTHON_VERSION}/lib/python${BF_PYTHON_VERSION}/config-3.2m'
128
129 WITH_BF_OPENAL = True
130 #different lib must be used  following version of gcc
131 # for gcc 3.3
132 #BF_OPENAL = LIBDIR + '/openal'
133 # for gcc 3.4 and ulterior
134 if MAC_PROC == 'powerpc':
135     BF_OPENAL = '#../lib/darwin-8.0.0-powerpc/openal'
136 else :
137     BF_OPENAL = LIBDIR + '/openal'
138
139 WITH_BF_STATICOPENAL = False
140 BF_OPENAL_INC = '${BF_OPENAL}/include' # only headers from libdir needed for proper use of framework !!!!
141 #BF_OPENAL_LIB = 'openal'
142 #BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
143 # Warning, this static lib configuration is untested! users of this OS please confirm.
144 #BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
145
146 # Warning, this static lib configuration is untested! users of this OS please confirm.
147 BF_CXX = '/usr'
148 WITH_BF_STATICCXX = False
149 BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
150
151 # TODO - set proper paths here (add precompiled to lib/ ? )
152 WITH_BF_JACK = False
153 BF_JACK = '/usr'
154 BF_JACK_INC = '${BF_JACK}/include/jack'
155 BF_JACK_LIB = 'jack'
156 BF_JACK_LIBPATH = '${BF_JACK}/lib'
157
158 WITH_BF_SNDFILE = True
159 BF_SNDFILE = LIBDIR + '/sndfile'
160 BF_SNDFILE_INC = '${BF_SNDFILE}/include'
161 BF_SNDFILE_LIB = 'sndfile FLAC ogg vorbis vorbisenc'
162 BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib ${BF_FFMPEG}/lib' #ogg libs are stored in ffmpeg dir
163
164 WITH_BF_SDL = True
165 BF_SDL = LIBDIR + '/sdl' #$(shell sdl-config --prefix)
166 BF_SDL_INC = '${BF_SDL}/include' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
167 BF_SDL_LIB = 'SDL' #BF_SDL #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
168 BF_SDL_LIBPATH = '${BF_SDL}/lib'
169
170 WITH_BF_OPENEXR = True
171 WITH_BF_STATICOPENEXR = False
172 BF_OPENEXR = '${LCGDIR}/openexr'
173 BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR'
174 BF_OPENEXR_LIB = ' Iex Half IlmImf Imath IlmThread'
175 BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
176 # Warning, this static lib configuration is untested! users of this OS please confirm.
177 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'
178
179 WITH_BF_DDS = True
180
181 #Color Management System
182 WITH_BF_LCMS = False
183 BF_LCMS = LIBDIR + '/lcms'
184 BF_LCMS_INC = '${BF_LCMS}/include'
185 BF_LCMS_LIB = 'lcms'
186 BF_LCMS_LIBPATH = '${BF_LCMS}/lib'
187
188 WITH_BF_JPEG = True
189 BF_JPEG = LIBDIR + '/jpeg'
190 BF_JPEG_INC = '${BF_JPEG}/include'
191 BF_JPEG_LIB = 'jpeg'
192 BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
193
194 WITH_BF_PNG = True
195 BF_PNG = LIBDIR + '/png'
196 BF_PNG_INC = '${BF_PNG}/include'
197 BF_PNG_LIB = 'png'
198 BF_PNG_LIBPATH = '${BF_PNG}/lib'
199
200 WITH_BF_TIFF = True
201 BF_TIFF = LIBDIR + '/tiff'
202 BF_TIFF_INC = '${BF_TIFF}/include'
203 BF_TIFF_LIB = 'tiff'
204 BF_TIFF_LIBPATH = '${BF_TIFF}/lib'
205
206 WITH_BF_ZLIB = True
207 BF_ZLIB = '/usr'
208 BF_ZLIB_INC = '${BF_ZLIB}/include'
209 BF_ZLIB_LIB = 'z'
210
211 WITH_BF_INTERNATIONAL = True
212
213 BF_GETTEXT = LIBDIR + '/gettext'
214 BF_GETTEXT_INC = '${BF_GETTEXT}/include'
215 BF_GETTEXT_LIB = 'intl'
216 BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
217
218 WITH_BF_GAMEENGINE = True
219 WITH_BF_PLAYER = True
220 WITH_BF_OCEANSIM = True
221
222 WITH_BF_BULLET = True
223 BF_BULLET = '#extern/bullet2/src'
224 BF_BULLET_INC = '${BF_BULLET}'
225 BF_BULLET_LIB = 'extern_bullet'
226
227 WITH_BF_FFTW3 = True
228 BF_FFTW3 = LIBDIR + '/fftw3'
229 BF_FFTW3_INC = '${BF_FFTW3}/include'
230 BF_FFTW3_LIB = 'libfftw3'
231 BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
232
233 #WITH_BF_NSPR = True
234 #BF_NSPR = $(LIBDIR)/nspr
235 #BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
236 #BF_NSPR_LIB =
237
238 # Uncomment the following line to use Mozilla inplace of netscape
239 #CPPFLAGS += -DMOZ_NOT_NET
240 # Location of MOZILLA/Netscape header files...
241 #BF_MOZILLA = $(LIBDIR)/mozilla
242 #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
243 #BF_MOZILLA_LIB =
244 # Will fall back to look in BF_MOZILLA_INC/nspr and BF_MOZILLA_LIB
245 # if this is not set.
246 #
247 # Be paranoid regarding library creation (do not update archives)
248 #BF_PARANOID = True
249
250 # enable freetype2 support for text objects
251 BF_FREETYPE = LIBDIR + '/freetype'
252 BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
253 BF_FREETYPE_LIB = 'freetype'
254 BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
255
256 WITH_BF_QUICKTIME = True
257
258 WITH_BF_ICONV = True
259 BF_ICONV = '/usr'
260 BF_ICONV_INC = '${BF_ICONV}/include'
261 BF_ICONV_LIB = 'iconv'
262 #BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
263
264 # Mesa Libs should go here if your using them as well....
265 WITH_BF_STATICOPENGL = True
266 BF_OPENGL_LIB = 'GL GLU'
267 BF_OPENGL_LIBPATH = '/System/Library/Frameworks/OpenGL.framework/Libraries'
268 BF_OPENGL_LINKFLAGS = ['-framework', 'OpenGL']
269
270 #OpenCollada flags
271 WITH_BF_COLLADA = True
272 BF_COLLADA = '#source/blender/collada'
273 BF_COLLADA_INC = '${BF_COLLADA}'
274 BF_COLLADA_LIB = 'bf_collada'
275 BF_OPENCOLLADA = LIBDIR + '/opencollada'
276 BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include'
277 BF_OPENCOLLADA_LIB = 'OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils OpenCOLLADAStreamWriter MathMLSolver GeneratedSaxParser UTF xml2 buffer ftoa'
278 BF_OPENCOLLADA_LIBPATH = LIBDIR + '/opencollada'
279 BF_PCRE = LIBDIR + '/opencollada'
280 BF_PCRE_LIB = 'pcre'
281 BF_PCRE_LIBPATH = '${BF_PCRE}/lib'
282 #BF_EXPAT = '/usr'
283 #BF_EXPAT_LIB = 'expat'
284 #BF_EXPAT_LIBPATH = '/usr/lib'
285
286 # Cycles
287 WITH_BF_CYCLES = True
288
289 WITH_BF_OIIO = True
290 BF_OIIO = LIBDIR + '/openimageio'
291 BF_OIIO_INC = BF_OIIO + '/include'
292 BF_OIIO_LIB = 'OpenImageIO'
293 BF_OIIO_LIBPATH = BF_OIIO + '/lib'
294
295 WITH_BF_BOOST = True
296 BF_BOOST = LIBDIR + '/boost'
297 BF_BOOST_INC = BF_BOOST + '/include'
298 BF_BOOST_LIB = 'boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_system-mt boost_thread-mt'
299 BF_BOOST_LIBPATH = BF_BOOST + '/lib'
300
301 WITH_BF_CYCLES_CUDA_BINARIES = False
302 BF_CYCLES_CUDA_NVCC = '/usr/local/cuda/bin/nvcc'
303 BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21']
304
305 #Ray trace optimization
306 if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'i386':
307     WITH_BF_RAYOPTIMIZATION = True
308 else:
309     WITH_BF_RAYOPTIMIZATION = False
310 if MACOSX_ARCHITECTURE == 'i386':
311     BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse']
312 elif MACOSX_ARCHITECTURE == 'x86_64':
313     BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse','-msse2']
314
315 # SpaceNavigator and related 3D mice, driver must be 3DxWare 10 Beta 4 (Mac OS X) or later !
316 WITH_BF_3DMOUSE = True
317
318 #############################################################################
319 ###################  various compile settings and flags    ##################
320 #############################################################################
321
322 BF_QUIET = '1' # suppress verbose output
323
324 if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'ppc64':
325     ARCH_FLAGS = ['-m64']
326 else:
327     ARCH_FLAGS = ['-m32']
328
329 CFLAGS = []
330 CXXFLAGS = []
331 CCFLAGS = ['-pipe','-funsigned-char']
332
333 CPPFLAGS = list(ARCH_FLAGS)
334
335 if WITH_GHOST_COCOA:
336     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
337 else:
338     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
339
340 if WITH_BF_QUICKTIME:
341     if USE_QTKIT:
342         PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QTKit']
343     else:
344         PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QuickTime']
345
346 if not WITH_OSX_STATICPYTHON:
347     PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','Python']
348
349
350 #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
351 #for 10.7.sdk, SystemStubs needs to be excluded (lib doesn't exist anymore)
352 if MACOSX_DEPLOYMENT_TARGET == '10.7':
353     LLIBS = ['stdc++']
354 else:
355     LLIBS = ['stdc++', 'SystemStubs']
356
357 # some flags shuffling for different OS versions
358 if MAC_MIN_VERS == '10.3':
359     CCFLAGS = ['-fuse-cxa-atexit'] + CCFLAGS
360     PLATFORM_LINKFLAGS = ['-fuse-cxa-atexit'] + PLATFORM_LINKFLAGS
361     LLIBS.append('crt3.o')
362
363 if USE_SDK:
364     SDK_FLAGS=['-isysroot', MACOSX_SDK,'-mmacosx-version-min='+MAC_MIN_VERS,'-arch',MACOSX_ARCHITECTURE]
365     PLATFORM_LINKFLAGS = ['-mmacosx-version-min='+MAC_MIN_VERS,'-Wl','-isysroot',MACOSX_SDK,'-arch',MACOSX_ARCHITECTURE]+PLATFORM_LINKFLAGS
366     CCFLAGS=SDK_FLAGS+CCFLAGS
367     CXXFLAGS=SDK_FLAGS+CXXFLAGS
368
369 #Intel Macs are CoreDuo and Up
370 if MACOSX_ARCHITECTURE == 'i386' or MACOSX_ARCHITECTURE == 'x86_64':
371     REL_CFLAGS = []
372     REL_CXXFLAGS = []
373     REL_CCFLAGS = ['-DNDEBUG', '-O2','-ftree-vectorize','-msse','-msse2','-msse3','-mfpmath=sse']
374 else:
375     CCFLAGS += ['-fno-strict-aliasing']
376     REL_CFLAGS = []
377     REL_CXXFLAGS = []
378     REL_CCFLAGS = ['-DNDEBUG', '-O2']
379
380 # Intel 64bit Macs are Core2Duo and up
381 if MACOSX_ARCHITECTURE == 'x86_64':
382     REL_CCFLAGS += ['-march=core2','-mssse3','-with-tune=core2','-enable-threads']
383
384 CC_WARN = ['-Wall']
385 C_WARN = ['-Wno-char-subscripts', '-Wpointer-arith', '-Wcast-align', '-Wdeclaration-after-statement', '-Wno-unknown-pragmas', '-Wstrict-prototypes']
386 CXX_WARN = ['-Wno-invalid-offsetof', '-Wno-sign-compare']
387
388 ##FIX_STUBS_WARNINGS = -Wno-unused
389
390 ##LOPTS = --dynamic
391 ##DYNLDFLAGS = -shared $(LDFLAGS)
392
393 BF_PROFILE_CCFLAGS = ['-pg', '-g ']
394 BF_PROFILE_LINKFLAGS = ['-pg']
395 BF_PROFILE = False
396
397 BF_DEBUG = False
398 BF_DEBUG_CCFLAGS = ['-g', '-D_DEBUG']
399
400 #############################################################################
401 ###################           Output directories           ##################
402 #############################################################################
403
404 BF_BUILDDIR='../build/darwin'
405 BF_INSTALLDIR='../install/darwin'