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