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