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