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