- bugfix (user supplied fix) [#20745] makesrna with rename error.
[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 BF_PYTHON_VERSION = '3.1'
34
35 if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'ppc64':
36         USE_QTKIT=True # Carbon quicktime is not available for 64bit
37
38
39 # Default target OSX settings per architecture
40 # Can be customized
41
42 if MACOSX_ARCHITECTURE == 'ppc':
43 # ppc release are now made for 10.4
44 #       MAC_MIN_VERS = '10.3'
45 #       MACOSX_SDK='/Developer/SDKs/MacOSX10.3.9.sdk'
46 #       LCGDIR = '#../lib/darwin-6.1-powerpc'
47 #       CC = 'gcc-3.3'
48 #       CXX = 'g++-3.3'
49         MAC_MIN_VERS = '10.4'
50         MACOSX_DEPLOYMENT_TARGET = '10.4'
51         MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
52         LCGDIR = '#../lib/darwin-8.0.0-powerpc'
53         CC = 'gcc-4.0'
54         CXX = 'g++-4.0'
55 elif MACOSX_ARCHITECTURE == 'i386':
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.x.i386'
60         CC = 'gcc-4.0'
61         CXX = 'g++-4.0'
62 else :
63         MAC_MIN_VERS = '10.5'
64         MACOSX_DEPLOYMENT_TARGET = '10.5'
65         MACOSX_SDK='/Developer/SDKs/MacOSX10.5.sdk'
66         LCGDIR = '#../lib/darwin-9.x.universal'
67         CC = 'gcc-4.2'
68         CXX = 'g++-4.2'
69
70 LIBDIR = '${LCGDIR}'
71
72 #############################################################################
73 ###################          Dependency settings           ##################
74 #############################################################################
75
76 # enable ffmpeg  support
77 WITH_BF_FFMPEG = True  # -DWITH_FFMPEG
78 FFMPEG_PRECOMPILED = True
79 if FFMPEG_PRECOMPILED:
80         # use precompiled ffmpeg in /lib
81         BF_FFMPEG = LIBDIR + '/ffmpeg'
82         BF_FFMPEG_INC = "#extern/ffmpeg"
83         BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
84         BF_FFMPEG_LIB = 'avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore'
85 else:
86         # use ffmpeg in extern
87         BF_FFMPEG = "#extern/ffmpeg"
88         BF_FFMPEG_INC = '${BF_FFMPEG}'
89         if USE_SDK==True:
90                 BF_FFMPEG_EXTRA = '-isysroot '+MACOSX_SDK+' -mmacosx-version-min='+MAC_MIN_VERS
91         BF_XVIDCORE_CONFIG = '--disable-assembly --disable-mmx' # currently causes errors, even with yasm installed
92         BF_X264_CONFIG = '--disable-pthread --disable-asm'
93
94 if BF_PYTHON_VERSION=='3.1':
95         # python 3.1 uses precompiled libraries in bf svn /lib by default
96
97         BF_PYTHON = LIBDIR + '/python'
98         BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
99         # BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
100         BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}'
101         BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}'
102         # BF_PYTHON_LINKFLAGS = ['-u', '_PyMac_Error', '-framework', 'System']
103 else:
104         # python 2.5 etc. uses built-in framework
105
106         # python.org libs install in /library we want to use that for 2.5 
107         #
108         # if you want py2.5 on leopard without installing
109         # change value to BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/'
110         # BEWARE: in that case it will work only on leopard
111
112         BF_PYTHON = '/System/Library/Frameworks/Python.framework/Versions/'
113
114         BF_PYTHON_INC = '${BF_PYTHON}${BF_PYTHON_VERSION}/include/python${BF_PYTHON_VERSION}'
115         BF_PYTHON_BINARY = '${BF_PYTHON}${BF_PYTHON_VERSION}/bin/python${BF_PYTHON_VERSION}'
116         BF_PYTHON_LIB = ''
117         BF_PYTHON_LIBPATH = '${BF_PYTHON}${BF_PYTHON_VERSION}/lib/python${BF_PYTHON_VERSION}/config'
118         BF_PYTHON_LINKFLAGS = ['-u','_PyMac_Error','-framework','System','-framework','Python']
119         if MAC_CUR_VER=='10.3' or  MAC_CUR_VER=='10.4':
120                 BF_PYTHON_LINKFLAGS = ['-u', '__dummy']+BF_PYTHON_LINKFLAGS
121
122         
123 WITH_BF_OPENMP = '0'  # multithreading for fluids, cloth and smoke ( only works with ICC atm )
124
125 WITH_BF_OPENAL = True
126 #different lib must be used  following version of gcc
127 # for gcc 3.3
128 #BF_OPENAL = LIBDIR + '/openal'
129 # for gcc 3.4 and ulterior
130 if MAC_PROC == 'powerpc':
131         BF_OPENAL = '#../lib/darwin-8.0.0-powerpc/openal'
132 else :
133         BF_OPENAL = LIBDIR + '/openal'
134
135 WITH_BF_STATICOPENAL = False
136 BF_OPENAL_INC = '${BF_OPENAL}/include' # only headers from libdir needed for proper use of framework !!!!
137 #BF_OPENAL_LIB = 'openal'
138 #BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
139 # Warning, this static lib configuration is untested! users of this OS please confirm.
140 #BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
141
142 # Warning, this static lib configuration is untested! users of this OS please confirm.
143 BF_CXX = '/usr'
144 WITH_BF_STATICCXX = False
145 BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
146
147 BF_LIBSAMPLERATE = LIBDIR + '/samplerate'
148 BF_LIBSAMPLERATE_INC = '${BF_LIBSAMPLERATE}/include'
149 BF_LIBSAMPLERATE_LIB = 'samplerate'
150 BF_LIBSAMPLERATE_LIBPATH = '${BF_LIBSAMPLERATE}/lib'
151
152 # TODO - set proper paths here (add precompiled to lib/ ? )
153 WITH_BF_JACK = False
154 BF_JACK = '/usr'
155 BF_JACK_INC = '${BF_JACK}/include/jack'
156 BF_JACK_LIB = 'jack'
157 BF_JACK_LIBPATH = '${BF_JACK}/lib'
158
159 WITH_BF_SNDFILE = True
160 BF_SNDFILE = LIBDIR + '/sndfile'
161 BF_SNDFILE_INC = '${BF_SNDFILE}/include'
162 BF_SNDFILE_LIB = 'sndfile'
163 BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib'
164
165 WITH_BF_SDL = True
166 BF_SDL = LIBDIR + '/sdl' #$(shell sdl-config --prefix)
167 BF_SDL_INC = '${BF_SDL}/include' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
168 BF_SDL_LIB = 'SDL' #BF_SDL #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
169 BF_SDL_LIBPATH = '${BF_SDL}/lib'
170
171 WITH_BF_OPENEXR = True
172 WITH_BF_STATICOPENEXR = False
173 BF_OPENEXR = '${LCGDIR}/openexr'
174 BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR'
175 BF_OPENEXR_LIB = ' Iex Half IlmImf Imath IlmThread'
176 BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
177 # Warning, this static lib configuration is untested! users of this OS please confirm.
178 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'
179
180 WITH_BF_DDS = True
181
182 WITH_BF_JPEG = True
183 BF_JPEG = LIBDIR + '/jpeg'
184 BF_JPEG_INC = '${BF_JPEG}/include'
185 BF_JPEG_LIB = 'jpeg'
186 BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
187
188 WITH_BF_PNG = True
189 BF_PNG = LIBDIR + '/png'
190 BF_PNG_INC = '${BF_PNG}/include'
191 BF_PNG_LIB = 'png'
192 BF_PNG_LIBPATH = '${BF_PNG}/lib'
193
194 BF_TIFF = LIBDIR + '/tiff'
195 BF_TIFF_INC = '${BF_TIFF}/include'
196
197 WITH_BF_ZLIB = True
198 BF_ZLIB = '/usr'
199 BF_ZLIB_INC = '${BF_ZLIB}/include'
200 BF_ZLIB_LIB = 'z'
201
202 WITH_BF_INTERNATIONAL = True
203
204 BF_GETTEXT = LIBDIR + '/gettext'
205 BF_GETTEXT_INC = '${BF_GETTEXT}/include'
206 BF_GETTEXT_LIB = 'intl'
207 BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
208
209 WITH_BF_GAMEENGINE=True
210 WITH_BF_PLAYER = False
211
212 WITH_BF_BULLET = True
213 BF_BULLET = '#extern/bullet2/src'
214 BF_BULLET_INC = '${BF_BULLET}'
215 BF_BULLET_LIB = 'extern_bullet'
216
217 WITH_BF_FFTW3 = True
218 BF_FFTW3 = LIBDIR + '/fftw3'
219 BF_FFTW3_INC = '${BF_FFTW3}/include'
220 BF_FFTW3_LIB = 'libfftw3'
221 BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
222
223 #WITH_BF_NSPR = True
224 #BF_NSPR = $(LIBDIR)/nspr
225 #BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
226 #BF_NSPR_LIB = 
227
228 # Uncomment the following line to use Mozilla inplace of netscape
229 #CPPFLAGS += -DMOZ_NOT_NET
230 # Location of MOZILLA/Netscape header files...
231 #BF_MOZILLA = $(LIBDIR)/mozilla
232 #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
233 #BF_MOZILLA_LIB =
234 # Will fall back to look in BF_MOZILLA_INC/nspr and BF_MOZILLA_LIB
235 # if this is not set.
236 #
237 # Be paranoid regarding library creation (do not update archives)
238 #BF_PARANOID = True
239
240 # enable freetype2 support for text objects
241 BF_FREETYPE = LIBDIR + '/freetype'
242 BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
243 BF_FREETYPE_LIB = 'freetype'
244 BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
245
246 WITH_BF_QUICKTIME = True
247
248 WITH_BF_ICONV = True
249 BF_ICONV = '/usr'
250 BF_ICONV_INC = '${BF_ICONV}/include'
251 BF_ICONV_LIB = 'iconv'
252 #BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
253
254 # Mesa Libs should go here if your using them as well....
255 WITH_BF_STATICOPENGL = True
256 BF_OPENGL_LIB = 'GL GLU'
257 BF_OPENGL_LIBPATH = '/System/Library/Frameworks/OpenGL.framework/Libraries'
258 BF_OPENGL_LINKFLAGS = ['-framework', 'OpenGL']
259
260 #OpenCollada flags
261 WITH_BF_COLLADA = False
262 BF_COLLADA = '#source/blender/collada'
263 BF_COLLADA_INC = '${BF_COLLADA}'
264 BF_COLLADA_LIB = 'bf_collada'
265 BF_OPENCOLLADA = LIBDIR + '/opencollada'
266 BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include'
267 BF_OPENCOLLADA_LIB = 'OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils OpenCOLLADAStreamWriter MathMLSolver GeneratedSaxParser UTF xml2'
268 BF_OPENCOLLADA_LIBPATH = LIBDIR + '/opencollada'
269 BF_PCRE = LIBDIR + '/opencollada'
270 BF_PCRE_LIB = 'pcre'
271 BF_PCRE_LIBPATH = '${BF_PCRE}/lib'
272 #BF_EXPAT = '/usr'
273 #BF_EXPAT_LIB = 'expat'
274 #BF_EXPAT_LIBPATH = '/usr/lib'
275
276 #Ray trace optimization
277 WITH_BF_RAYOPTIMIZATION = False
278 if MACOSX_ARCHITECTURE == 'i386':
279     BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse']
280 elif MACOSX_ARCHITECTURE == 'x86_64':
281     BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse','-msse2']
282     
283
284 #############################################################################
285 ###################  various compile settings and flags    ##################
286 #############################################################################
287
288 BF_QUIET = '1' # suppress verbose output
289
290 if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'ppc64':
291         ARCH_FLAGS = ['-m64']
292 else:
293         ARCH_FLAGS = ['-m32']
294
295 CFLAGS = ['-pipe','-funsigned-char']+ARCH_FLAGS
296
297 CPPFLAGS = ['-fpascal-strings']+ARCH_FLAGS
298 CCFLAGS = ['-pipe','-funsigned-char','-fpascal-strings']+ARCH_FLAGS
299 CXXFLAGS = ['-pipe','-funsigned-char', '-fpascal-strings']+ARCH_FLAGS
300
301 if WITH_GHOST_COCOA==True:
302         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
303 else:
304         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
305
306 if WITH_BF_QUICKTIME == True:
307         if USE_QTKIT == True:
308                 PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QTKit']
309         else:
310                 PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QuickTime']
311
312 #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
313 LLIBS = ['stdc++', 'SystemStubs']
314
315 # some flags shuffling for different Os versions
316 if MAC_MIN_VERS == '10.3':
317         CFLAGS = ['-fuse-cxa-atexit']+CFLAGS
318         CXXFLAGS = ['-fuse-cxa-atexit']+CXXFLAGS
319         PLATFORM_LINKFLAGS = ['-fuse-cxa-atexit']+PLATFORM_LINKFLAGS
320         LLIBS.append('crt3.o')
321         
322 if USE_SDK==True:
323         SDK_FLAGS=['-isysroot', MACOSX_SDK,'-mmacosx-version-min='+MAC_MIN_VERS,'-arch',MACOSX_ARCHITECTURE]    
324         PLATFORM_LINKFLAGS = ['-mmacosx-version-min='+MAC_MIN_VERS,'-Wl','-isysroot',MACOSX_SDK,'-arch',MACOSX_ARCHITECTURE]+PLATFORM_LINKFLAGS
325         CCFLAGS=SDK_FLAGS+CCFLAGS
326         CXXFLAGS=SDK_FLAGS+CXXFLAGS
327         
328 if MACOSX_ARCHITECTURE == 'i386' or MACOSX_ARCHITECTURE == 'x86_64':
329         REL_CFLAGS = ['-O2','-ftree-vectorize','-msse','-msse2','-msse3']
330         REL_CCFLAGS = ['-O2','-ftree-vectorize','-msse','-msse2','-msse3']
331 else:
332         CFLAGS = CFLAGS+['-fno-strict-aliasing']
333         CCFLAGS =  CCFLAGS+['-fno-strict-aliasing']
334         CXXFLAGS = CXXFLAGS+['-fno-strict-aliasing']
335         REL_CFLAGS = ['-O2']
336         REL_CCFLAGS = ['-O2']
337
338 # add -mssse3 for intel 64bit archs
339 if MACOSX_ARCHITECTURE == 'x86_64':
340         REL_CFLAGS = REL_CFLAGS+['-mssse3']
341         REL_CCFLAGS = REL_CCFLAGS+['-mssse3']
342
343 ##BF_DEPEND = True
344 ##
345 ##AR = ar
346 ##ARFLAGS = ruv
347 ##ARFLAGSQUIET = ru
348 ##
349 #C_WARN = ['-Wdeclaration-after-statement']
350
351 CC_WARN = ['-Wall']
352
353 ##FIX_STUBS_WARNINGS = -Wno-unused
354
355 ##LOPTS = --dynamic
356 ##DYNLDFLAGS = -shared $(LDFLAGS)
357
358 BF_PROFILE_CCFLAGS = ['-pg', '-g ']
359 BF_PROFILE_LINKFLAGS = ['-pg']
360 BF_PROFILE = False
361
362 BF_DEBUG = False
363 BF_DEBUG_CCFLAGS = ['-g']
364
365 #############################################################################
366 ###################           Output directories           ##################
367 #############################################################################
368
369 BF_BUILDDIR='../build/darwin'
370 BF_INSTALLDIR='../install/darwin'