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