Beta -> Alpha ;)
[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 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         MAC_MIN_VERS = '10.3'
44         MACOSX_SDK='/Developer/SDKs/MacOSX10.3.9.sdk'
45         LCGDIR = '#../lib/darwin-6.1-powerpc'
46         CC = 'gcc-3.3'
47         CXX = 'g++-3.3'
48 elif MACOSX_ARCHITECTURE == 'i386':
49         MAC_MIN_VERS = '10.4'
50         MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
51         LCGDIR = '#../lib/darwin-8.x.i386'
52         CC = 'gcc-4.0'
53         CXX = 'g++-4.0'
54 else :
55         MAC_MIN_VERS = '10.5'
56         MACOSX_SDK='/Developer/SDKs/MacOSX10.5.sdk'
57         LCGDIR = '#../lib/darwin-9.x.universal'
58         CC = 'gcc-4.2'
59         CXX = 'g++-4.2'
60
61 LIBDIR = '${LCGDIR}'
62
63 #############################################################################
64 ###################          Dependency settings           ##################
65 #############################################################################
66
67 # enable ffmpeg  support
68 WITH_BF_FFMPEG = True  # -DWITH_FFMPEG
69 FFMPEG_PRECOMPILED = True
70 if FFMPEG_PRECOMPILED:
71         # use precompiled ffmpeg in /lib
72         BF_FFMPEG = LIBDIR + '/ffmpeg'
73         BF_FFMPEG_INC = "#extern/ffmpeg"
74         BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
75         BF_FFMPEG_LIB = 'avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore'
76 else:
77         # use ffmpeg in extern
78         BF_FFMPEG = "#extern/ffmpeg"
79         BF_FFMPEG_INC = '${BF_FFMPEG}'
80         if USE_SDK==True:
81                 BF_FFMPEG_EXTRA = '-isysroot '+MACOSX_SDK+' -mmacosx-version-min='+MAC_MIN_VERS
82         BF_XVIDCORE_CONFIG = '--disable-assembly --disable-mmx' # currently causes errors, even with yasm installed
83         BF_X264_CONFIG = '--disable-pthread --disable-asm'
84
85 if BF_PYTHON_VERSION=='3.1':
86         # python 3.1 uses precompiled libraries in bf svn /lib by default
87
88         BF_PYTHON = LIBDIR + '/python'
89         BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
90         # BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
91         BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}'
92         BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}'
93         # BF_PYTHON_LINKFLAGS = ['-u', '_PyMac_Error', '-framework', 'System']
94 else:
95         # python 2.5 etc. uses built-in framework
96
97         # python.org libs install in /library we want to use that for 2.5 
98         #
99         # if you want py2.5 on leopard without installing
100         # change value to BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/'
101         # BEWARE: in that case it will work only on leopard
102
103         BF_PYTHON = '/System/Library/Frameworks/Python.framework/Versions/'
104
105         BF_PYTHON_INC = '${BF_PYTHON}${BF_PYTHON_VERSION}/include/python${BF_PYTHON_VERSION}'
106         BF_PYTHON_BINARY = '${BF_PYTHON}${BF_PYTHON_VERSION}/bin/python${BF_PYTHON_VERSION}'
107         BF_PYTHON_LIB = ''
108         BF_PYTHON_LIBPATH = '${BF_PYTHON}${BF_PYTHON_VERSION}/lib/python${BF_PYTHON_VERSION}/config'
109         BF_PYTHON_LINKFLAGS = ['-u','_PyMac_Error','-framework','System','-framework','Python']
110         if MAC_CUR_VER=='10.3' or  MAC_CUR_VER=='10.4':
111                 BF_PYTHON_LINKFLAGS = ['-u', '__dummy']+BF_PYTHON_LINKFLAGS
112
113         
114 WITH_BF_OPENMP = '0'  # multithreading for fluids, cloth and smoke ( only works with ICC atm )
115
116 WITH_BF_OPENAL = True
117 #different lib must be used  following version of gcc
118 # for gcc 3.3
119 #BF_OPENAL = LIBDIR + '/openal'
120 # for gcc 3.4 and ulterior
121 if MAC_PROC == 'powerpc':
122         BF_OPENAL = '#../lib/darwin-8.0.0-powerpc/openal'
123 else :
124         BF_OPENAL = LIBDIR + '/openal'
125
126 WITH_BF_STATICOPENAL = False
127 BF_OPENAL_INC = '${BF_OPENAL}/include' # only headers from libdir needed for proper use of framework !!!!
128 #BF_OPENAL_LIB = 'openal'
129 #BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
130 # Warning, this static lib configuration is untested! users of this OS please confirm.
131 #BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
132
133 # Warning, this static lib configuration is untested! users of this OS please confirm.
134 BF_CXX = '/usr'
135 WITH_BF_STATICCXX = False
136 BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
137
138 BF_LIBSAMPLERATE = LIBDIR + '/samplerate'
139 BF_LIBSAMPLERATE_INC = '${BF_LIBSAMPLERATE}/include'
140 BF_LIBSAMPLERATE_LIB = 'samplerate'
141 BF_LIBSAMPLERATE_LIBPATH = '${BF_LIBSAMPLERATE}/lib'
142
143 # TODO - set proper paths here (add precompiled to lib/ ? )
144 WITH_BF_JACK = False
145 BF_JACK = '/usr'
146 BF_JACK_INC = '${BF_JACK}/include/jack'
147 BF_JACK_LIB = 'jack'
148 BF_JACK_LIBPATH = '${BF_JACK}/lib'
149
150 WITH_BF_SNDFILE = False
151 BF_SNDFILE = LIBDIR + '/sndfile'
152 BF_SNDFILE_INC = '${BF_SNDFILE}/include'
153 BF_SNDFILE_LIB = 'sndfile'
154 BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib'
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 WITH_BF_JPEG = True
174 BF_JPEG = LIBDIR + '/jpeg'
175 BF_JPEG_INC = '${BF_JPEG}/include'
176 BF_JPEG_LIB = 'jpeg'
177 BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
178
179 WITH_BF_PNG = True
180 BF_PNG = LIBDIR + '/png'
181 BF_PNG_INC = '${BF_PNG}/include'
182 BF_PNG_LIB = 'png'
183 BF_PNG_LIBPATH = '${BF_PNG}/lib'
184
185 BF_TIFF = LIBDIR + '/tiff'
186 BF_TIFF_INC = '${BF_TIFF}/include'
187
188 WITH_BF_ZLIB = True
189 BF_ZLIB = '/usr'
190 BF_ZLIB_INC = '${BF_ZLIB}/include'
191 BF_ZLIB_LIB = 'z'
192
193 WITH_BF_INTERNATIONAL = True
194
195 BF_GETTEXT = LIBDIR + '/gettext'
196 BF_GETTEXT_INC = '${BF_GETTEXT}/include'
197 BF_GETTEXT_LIB = 'intl'
198 BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
199
200 WITH_BF_GAMEENGINE=True
201 WITH_BF_PLAYER = False
202
203 WITH_BF_BULLET = True
204 BF_BULLET = '#extern/bullet2/src'
205 BF_BULLET_INC = '${BF_BULLET}'
206 BF_BULLET_LIB = 'extern_bullet'
207
208 WITH_BF_FFTW3 = False
209 BF_FFTW3 = LIBDIR + '/fftw3'
210 BF_FFTW3_INC = '${BF_FFTW3}/include'
211 BF_FFTW3_LIB = 'libfftw3'
212 BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
213
214 #WITH_BF_NSPR = True
215 #BF_NSPR = $(LIBDIR)/nspr
216 #BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
217 #BF_NSPR_LIB = 
218
219 # Uncomment the following line to use Mozilla inplace of netscape
220 #CPPFLAGS += -DMOZ_NOT_NET
221 # Location of MOZILLA/Netscape header files...
222 #BF_MOZILLA = $(LIBDIR)/mozilla
223 #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
224 #BF_MOZILLA_LIB =
225 # Will fall back to look in BF_MOZILLA_INC/nspr and BF_MOZILLA_LIB
226 # if this is not set.
227 #
228 # Be paranoid regarding library creation (do not update archives)
229 #BF_PARANOID = True
230
231 # enable freetype2 support for text objects
232 BF_FREETYPE = LIBDIR + '/freetype'
233 BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
234 BF_FREETYPE_LIB = 'freetype'
235 BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
236
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         if USE_QTKIT == True:
291                 PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QTKit']
292         else:
293                 PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QuickTime']
294
295 #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
296 LLIBS = ['stdc++', 'SystemStubs']
297
298 # some flags shuffling for different Os versions
299 if MAC_MIN_VERS == '10.3':
300         CFLAGS = ['-fuse-cxa-atexit']+CFLAGS
301         CXXFLAGS = ['-fuse-cxa-atexit']+CXXFLAGS
302         PLATFORM_LINKFLAGS = ['-fuse-cxa-atexit']+PLATFORM_LINKFLAGS
303         LLIBS.append('crt3.o')
304         
305 if USE_SDK==True:
306         SDK_FLAGS=['-isysroot', MACOSX_SDK,'-mmacosx-version-min='+MAC_MIN_VERS]        
307         PLATFORM_LINKFLAGS = ['-mmacosx-version-min='+MAC_MIN_VERS,'-Wl','-syslibroot '+MACOSX_SDK]+PLATFORM_LINKFLAGS
308         CCFLAGS=SDK_FLAGS+CCFLAGS
309         CXXFLAGS=SDK_FLAGS+CXXFLAGS
310         
311 if MACOSX_ARCHITECTURE == 'i386' or MACOSX_ARCHITECTURE == 'x86_64':
312         REL_CFLAGS = ['-O2','-ftree-vectorize','-msse','-msse2','-msse3']
313         REL_CCFLAGS = ['-O2','-ftree-vectorize','-msse','-msse2','-msse3']
314 else:
315         CFLAGS = CFLAGS+['-fno-strict-aliasing']
316         CCFLAGS =  CCFLAGS+['-fno-strict-aliasing']
317         CXXFLAGS = CXXFLAGS+['-fno-strict-aliasing']
318         REL_CFLAGS = ['-O2']
319         REL_CCFLAGS = ['-O2']
320
321 # add -mssse3 for intel 64bit archs
322 if MACOSX_ARCHITECTURE == 'x86_64':
323         REL_CFLAGS = REL_CFLAGS+['-mssse3']
324         REL_CCFLAGS = REL_CCFLAGS+['-mssse3']
325
326 ##BF_DEPEND = True
327 ##
328 ##AR = ar
329 ##ARFLAGS = ruv
330 ##ARFLAGSQUIET = ru
331 ##
332 #C_WARN = ['-Wdeclaration-after-statement']
333
334 CC_WARN = ['-Wall']
335
336 ##FIX_STUBS_WARNINGS = -Wno-unused
337
338 ##LOPTS = --dynamic
339 ##DYNLDFLAGS = -shared $(LDFLAGS)
340
341 BF_PROFILE_CCFLAGS = ['-pg', '-g ']
342 BF_PROFILE_LINKFLAGS = ['-pg']
343 BF_PROFILE = False
344
345 BF_DEBUG = False
346 BF_DEBUG_CCFLAGS = ['-g']
347
348 #############################################################################
349 ###################           Output directories           ##################
350 #############################################################################
351
352 BF_BUILDDIR='../build/darwin'
353 BF_INSTALLDIR='../install/darwin'