Mac / COCOA :
[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
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 MAC_PROC == 'powerpc':
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 MAC_PROC == 'powerpc' 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 = False
251
252 #############################################################################
253 ###################  various compile settings and flags    ##################
254 #############################################################################
255
256 BF_QUIET = '1' # suppress verbose output
257
258 if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'ppc64':
259         ARCH_FLAGS = ['-m64']
260 else:
261         ARCH_FLAGS = ['-m32']
262
263 CFLAGS = ['-pipe','-funsigned-char']+ARCH_FLAGS
264
265 CPPFLAGS = ['-fpascal-strings']+ARCH_FLAGS
266 CCFLAGS = ['-pipe','-funsigned-char','-fpascal-strings']+ARCH_FLAGS
267 CXXFLAGS = ['-pipe','-funsigned-char', '-fpascal-strings']+ARCH_FLAGS
268
269 if WITH_GHOST_COCOA==True:
270         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
271 else:
272         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
273
274 if WITH_BF_QUICKTIME == True:
275         PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QuickTime']
276
277 #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
278 LLIBS = ['stdc++', 'SystemStubs']
279
280 # some flags shuffling for different Os versions
281 if MAC_MIN_VERS == '10.3':
282         CFLAGS = ['-fuse-cxa-atexit']+CFLAGS
283         CXXFLAGS = ['-fuse-cxa-atexit']+CXXFLAGS
284         PLATFORM_LINKFLAGS = ['-fuse-cxa-atexit']+PLATFORM_LINKFLAGS
285         LLIBS.append('crt3.o')
286         
287 if USE_SDK==True:
288         SDK_FLAGS=['-isysroot', MACOSX_SDK,'-mmacosx-version-min='+MAC_MIN_VERS]        
289         PLATFORM_LINKFLAGS = ['-mmacosx-version-min='+MAC_MIN_VERS,'-Wl','-syslibroot '+MACOSX_SDK]+PLATFORM_LINKFLAGS
290         CCFLAGS=SDK_FLAGS+CCFLAGS
291         CXXFLAGS=SDK_FLAGS+CXXFLAGS
292         
293 if MACOSX_ARCHITECTURE == 'i386' or MACOSX_ARCHITECTURE == 'x86_64':
294         REL_CFLAGS = ['-O2','-ftree-vectorize','-msse','-msse2','-msse3']
295         REL_CCFLAGS = ['-O2','-ftree-vectorize','-msse','-msse2','-msse3']
296 else:
297         CFLAGS = CFLAGS+['-fno-strict-aliasing']
298         CCFLAGS =  CCFLAGS+['-fno-strict-aliasing']
299         CXXFLAGS = CXXFLAGS+['-fno-strict-aliasing']
300         REL_CFLAGS = ['-O2']
301         REL_CCFLAGS = ['-O2']
302
303 # add -mssse3 for intel 64bit archs
304 if MACOSX_ARCHITECTURE == 'x86_64':
305         REL_CFLAGS = REL_CFLAGS+['-mssse3']
306         REL_CCFLAGS = REL_CCFLAGS+['-mssse3']
307
308 ##BF_DEPEND = True
309 ##
310 ##AR = ar
311 ##ARFLAGS = ruv
312 ##ARFLAGSQUIET = ru
313 ##
314 #C_WARN = ['-Wdeclaration-after-statement']
315
316 CC_WARN = ['-Wall']
317
318 ##FIX_STUBS_WARNINGS = -Wno-unused
319
320 ##LOPTS = --dynamic
321 ##DYNLDFLAGS = -shared $(LDFLAGS)
322
323 BF_PROFILE_CCFLAGS = ['-pg', '-g ']
324 BF_PROFILE_LINKFLAGS = ['-pg']
325 BF_PROFILE = False
326
327 BF_DEBUG = False
328 BF_DEBUG_CCFLAGS = ['-g']
329
330 #############################################################################
331 ###################           Output directories           ##################
332 #############################################################################
333
334 BF_BUILDDIR='../build/darwin'
335 BF_INSTALLDIR='../install/darwin'