small speedup for BM_SelectMode_Flush()
[blender.git] / build_files / scons / config / linux-config.py
1 # find library directory
2 import platform
3 import os
4 bitness = platform.architecture()[0]
5 if bitness == '64bit':
6     LCGDIR = '../lib/linux64'
7 else:
8     LCGDIR = '../lib/linux'
9 LIBDIR = "#${LCGDIR}"
10
11 BF_PYTHON_ABI_FLAGS = 'm'  # Most common for linux distros
12 BF_PYTHON = '/usr'
13 BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
14 BF_PYTHON_VERSION = '3.2'
15 WITH_BF_STATICPYTHON = False
16 BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}${BF_PYTHON_ABI_FLAGS}'
17 BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
18 BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}${BF_PYTHON_ABI_FLAGS}'  # BF_PYTHON+'/lib/python'+BF_PYTHON_VERSION+'/config/libpython'+BF_PYTHON_VERSION+'.a'
19 BF_PYTHON_LINKFLAGS = ['-Xlinker', '-export-dynamic']
20 BF_PYTHON_LIB_STATIC = '${BF_PYTHON}/lib/libpython${BF_PYTHON_VERSION}${BF_PYTHON_ABI_FLAGS}.a'
21
22 WITH_BF_OPENAL = True
23 WITH_BF_STATICOPENAL = False
24 BF_OPENAL = '/usr'
25 BF_OPENAL_INC = '${BF_OPENAL}/include'
26 BF_OPENAL_LIB = 'openal'
27 BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
28
29 BF_CXX = '/usr'
30 WITH_BF_STATICCXX = False
31 BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
32
33 WITH_BF_JACK = False
34 BF_JACK = '/usr'
35 BF_JACK_INC = '${BF_JACK}/include/jack'
36 BF_JACK_LIB = 'jack'
37 BF_JACK_LIBPATH = '${BF_JACK}/lib'
38
39 WITH_BF_SNDFILE = False
40 WITH_BF_STATICSNDFILE = False
41 BF_SNDFILE = '/usr'
42 BF_SNDFILE_INC = '${BF_SNDFILE}/include/sndfile'
43 BF_SNDFILE_LIB = 'sndfile'
44 BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib'
45 BF_SNDFILE_LIB_STATIC = '${BF_SNDFILE}/lib/libsndfile.a ${BF_OGG}/lib/libvorbis.a ${BF_OGG}/lib/libFLAC.a ${BF_OGG}/lib/libvorbisenc.a ${BF_OGG}/lib/libogg.a'
46
47 WITH_BF_SDL = True
48 BF_SDL = '/usr' #$(shell sdl-config --prefix)
49 BF_SDL_INC = '${BF_SDL}/include/SDL' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
50 BF_SDL_LIB = 'SDL' #BF_SDL #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
51
52 WITH_BF_OPENEXR = True
53 WITH_BF_STATICOPENEXR = False
54 BF_OPENEXR = '/usr'
55 # when compiling with your own openexr lib you might need to set...
56 # BF_OPENEXR_INC = '${BF_OPENEXR}/include/OpenEXR ${BF_OPENEXR}/include'
57
58 BF_OPENEXR_INC = '${BF_OPENEXR}/include/OpenEXR'
59 BF_OPENEXR_LIB = 'Half IlmImf Iex Imath '
60 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'
61 # BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
62
63
64 WITH_BF_DDS = True
65
66 WITH_BF_JPEG = True
67 BF_JPEG = '/usr'
68 BF_JPEG_INC = '${BF_JPEG}/include'
69 BF_JPEG_LIB = 'jpeg'
70
71 WITH_BF_PNG = True
72 BF_PNG = '/usr'
73 BF_PNG_INC = '${BF_PNG}/include'
74 BF_PNG_LIB = 'png'
75
76 WITH_BF_TIFF = True
77 BF_TIFF = '/usr'
78 BF_TIFF_INC = '${BF_TIFF}/include'
79 BF_TIFF_LIB = 'tiff'
80
81 WITH_BF_ZLIB = True
82 BF_ZLIB = '/usr'
83 BF_ZLIB_INC = '${BF_ZLIB}/include'
84 BF_ZLIB_LIB = 'z'
85
86 WITH_BF_INTERNATIONAL = True
87
88 BF_GETTEXT = '/usr'
89 BF_GETTEXT_INC = '${BF_GETTEXT}/include'
90 BF_GETTEXT_LIB = 'gettextlib'
91 BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
92 #WITH_BF_GETTEXT_STATIC = True
93 #BF_GETTEXT_LIB_STATIC = '${BF_GETTEXT}/lib/libgettextlib.a'
94
95 WITH_BF_GAMEENGINE = True
96 WITH_BF_PLAYER = True
97 WITH_BF_OCEANSIM = True
98
99 WITH_BF_BULLET = True
100 BF_BULLET = '#extern/bullet2/src'
101 BF_BULLET_INC = '${BF_BULLET}'
102 BF_BULLET_LIB = 'extern_bullet'
103
104 # enable freetype2 support for text objects
105 BF_FREETYPE = '/usr'
106 BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
107 BF_FREETYPE_LIB = 'freetype'
108 #BF_FREETYPE_LIB_STATIC = '${BF_FREETYPE}/lib/libfreetype.a'
109
110 WITH_BF_QUICKTIME = False # -DWITH_QUICKTIME
111 BF_QUICKTIME = '/usr/local'
112 BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
113
114 WITH_BF_ICONV = False
115 BF_ICONV = LIBDIR + "/iconv"
116 BF_ICONV_INC = '${BF_ICONV}/include'
117 BF_ICONV_LIB = 'iconv'
118 BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
119
120 WITH_BF_BINRELOC = True
121
122 # enable ffmpeg  support
123 WITH_BF_FFMPEG = True  # -DWITH_FFMPEG
124 BF_FFMPEG = LIBDIR + '/ffmpeg'
125 if os.path.exists(LCGDIR + '/ffmpeg'):
126     WITH_BF_STATICFFMPEG = True
127     BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libswscale.a ' + \
128         '${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ${BF_FFMPEG_LIBPATH}/libavutil.a ' + \
129         '${BF_FFMPEG_LIBPATH}/libxvidcore.a ${BF_FFMPEG_LIBPATH}/libx264.a ${BF_FFMPEG_LIBPATH}/libmp3lame.a ' + \
130         '${BF_FFMPEG_LIBPATH}/libvpx.a ${BF_FFMPEG_LIBPATH}/libvorbis.a ${BF_FFMPEG_LIBPATH}/libogg.a ' + \
131         '${BF_FFMPEG_LIBPATH}/libvorbisenc.a ${BF_FFMPEG_LIBPATH}/libtheora.a ' + \
132         '${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ${BF_FFMPEG_LIBPATH}/liborc-0.4.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a ' + \
133         '${BF_FFMPEG_LIBPATH}/libfaad.a'
134 else:
135     BF_FFMPEG = '/usr'
136 BF_FFMPEG_LIB = 'avformat avcodec swscale avutil avdevice'
137 BF_FFMPEG_INC = '${BF_FFMPEG}/include'
138 BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
139 #WITH_BF_STATICFFMPEG = True
140 #BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH/libavcodec.a ${BF_FFMPEG_LIBPATH}/libswscale.a ${BF_FFMPEG_LIBPATH}/libavutil.a ${BF_FFMPEG_LIBPATH}/libavdevice.a'
141
142 # enable ogg, vorbis and theora in ffmpeg
143 WITH_BF_OGG = False
144 BF_OGG = '/usr'
145 BF_OGG_INC = '${BF_OGG}/include'
146 BF_OGG_LIB = 'ogg vorbis vorbisenc theoraenc theoradec'
147
148 WITH_BF_OPENJPEG = True 
149 BF_OPENJPEG = '#extern/libopenjpeg'
150 BF_OPENJPEG_LIB = ''
151 BF_OPENJPEG_INC = '${BF_OPENJPEG}'
152 BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
153
154 WITH_BF_FFTW3 = False
155 WITH_BF_STATICFFTW3 = False
156 BF_FFTW3 = '/usr'
157 BF_FFTW3_INC = '${BF_FFTW3}/include'
158 BF_FFTW3_LIB = 'fftw3'
159 BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
160 BF_FFTW3_LIB_STATIC = '${BF_FFTW3_LIBPATH}/libfftw3.a'
161
162 WITH_BF_REDCODE = False  
163 BF_REDCODE = '#extern/libredcode'
164 BF_REDCODE_LIB = ''
165 # BF_REDCODE_INC = '${BF_REDCODE}/include'
166 BF_REDCODE_INC = '${BF_REDCODE}/../' #C files request "libredcode/format.h" which is in "#extern/libredcode/format.h", stupid but compiles for now.
167 BF_REDCODE_LIBPATH='${BF_REDCODE}/lib'
168
169 # Mesa Libs should go here if your using them as well....
170 WITH_BF_STATICOPENGL = False
171 BF_OPENGL = '/usr'
172 BF_OPENGL_INC = '${BF_OPENGL}/include'
173 BF_OPENGL_LIB = 'GL GLU X11 Xi'
174 BF_OPENGL_LIBPATH = '/usr/X11R6/lib'
175 BF_OPENGL_LIB_STATIC = '${BF_OPENGL_LIBPATH}/libGL.a ${BF_OPENGL_LIBPATH}/libGLU.a ${BF_OPENGL_LIBPATH}/libXxf86vm.a ${BF_OPENGL_LIBPATH}/libX11.a ${BF_OPENGL_LIBPATH}/libXi.a ${BF_OPENGL_LIBPATH}/libXext.a ${BF_OPENGL_LIBPATH}/libXxf86vm.a'
176
177 WITH_BF_COLLADA = False
178 BF_COLLADA = '#source/blender/collada'
179 BF_COLLADA_INC = '${BF_COLLADA}'
180 BF_COLLADA_LIB = 'bf_collada'
181 BF_OPENCOLLADA = '/usr'
182 BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}'
183 BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver pcre buffer ftoa'
184 BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib'
185 BF_PCRE = ''
186 BF_PCRE_LIB = 'pcre'
187 BF_PCRE_LIBPATH = '/usr/lib'
188 BF_EXPAT = '/usr'
189 BF_EXPAT_LIB = 'expat'
190 BF_EXPAT_LIBPATH = '/usr/lib'
191
192 WITH_BF_JEMALLOC = False
193 WITH_BF_STATICJEMALLOC = False
194 BF_JEMALLOC = '/usr'
195 BF_JEMALLOC_INC = '${BF_JEMALLOC}/include'
196 BF_JEMALLOC_LIBPATH = '${BF_JEMALLOC}/lib'
197 BF_JEMALLOC_LIB = 'jemalloc'
198 BF_JEMALLOC_LIB_STATIC = '${BF_JEMALLOC_LIBPATH}/libjemalloc.a'
199
200 WITH_BF_OIIO = True
201 WITH_BF_STATICOIIO = False
202 BF_OIIO = LIBDIR + '/oiio'
203 if not os.path.exists(LCGDIR + '/oiio'):
204     WITH_BF_OIIO = False
205     BF_OIIO = '/usr'
206 BF_OIIO_INC = BF_OIIO + '/include'
207 BF_OIIO_LIB = 'OpenImageIO'
208 BF_OIIO_LIBPATH = BF_OIIO + '/lib'
209
210 WITH_BF_BOOST = True
211 WITH_BF_STATICBOOST = False
212 BF_BOOST = LIBDIR + '/boost'
213 if not os.path.exists(LCGDIR + '/boost'):
214     WITH_BF_BOOST = False
215     BF_BOOST = '/usr'
216 BF_BOOST_INC = BF_BOOST + '/include'
217 BF_BOOST_LIB = 'boost_date_time boost_filesystem boost_regex boost_system boost_thread'
218 BF_BOOST_LIBPATH = BF_BOOST + '/lib'
219
220 WITH_BF_CYCLES = WITH_BF_OIIO and WITH_BF_BOOST
221
222 WITH_BF_CYCLES_CUDA_BINARIES = False
223 BF_CYCLES_CUDA_NVCC = '/usr/local/cuda/bin/nvcc'
224 BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21']
225
226 WITH_BF_OPENMP = True
227
228 #Ray trace optimization
229 WITH_BF_RAYOPTIMIZATION = True
230 BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse','-pthread']
231
232 #SpaceNavigator and friends
233 WITH_BF_3DMOUSE = True
234 WITH_BF_STATIC3DMOUSE = False
235 BF_3DMOUSE = '/usr'
236 BF_3DMOUSE_INC = '${BF_3DMOUSE}/include'
237 BF_3DMOUSE_LIBPATH = '${BF_3DMOUSE}/lib'
238 BF_3DMOUSE_LIB = 'spnav'
239 BF_3DMOUSE_LIB_STATIC = '${BF_3DMOUSE_LIBPATH}/libspnav.a'
240
241 ##
242 CC = 'gcc'
243 CXX = 'g++'
244 ##ifeq ($CPU),alpha)
245 ##   CFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing -mieee
246
247 CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing','-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64','-D_LARGEFILE64_SOURCE']
248 CXXFLAGS = []
249
250 CPPFLAGS = []
251 # g++ 4.6, only needed for bullet
252 CXXFLAGS += ['-fpermissive']
253 if WITH_BF_FFMPEG:
254     # libavutil needs UINT64_C()
255     CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ]
256 REL_CFLAGS = []
257 REL_CXXFLAGS = []
258 REL_CCFLAGS = ['-DNDEBUG', '-O2']
259 ##BF_DEPEND = True
260 ##
261 ##AR = ar
262 ##ARFLAGS = ruv
263 ##ARFLAGSQUIET = ru
264 ##
265 C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement', '-Wunused-parameter', '-Wstrict-prototypes', '-Werror=declaration-after-statement', '-Werror=implicit-function-declaration', '-Werror=return-type']
266 CC_WARN = ['-Wall']
267 CXX_WARN = ['-Wno-invalid-offsetof', '-Wno-sign-compare']
268
269
270 ##FIX_STUBS_WARNINGS = -Wno-unused
271
272 LLIBS = ['util', 'c', 'm', 'dl', 'pthread', 'stdc++']
273 ##LOPTS = --dynamic
274 ##DYNLDFLAGS = -shared $(LDFLAGS)
275
276 BF_PROFILE = False
277 BF_PROFILE_CCFLAGS = ['-pg','-g']
278 BF_PROFILE_LINKFLAGS = ['-pg']
279
280 BF_DEBUG = False
281 BF_DEBUG_CCFLAGS = ['-g', '-D_DEBUG']
282
283 BF_BUILDDIR = '../build/linux'
284 BF_INSTALLDIR='../install/linux'
285
286 #Link against pthread
287 PLATFORM_LINKFLAGS = ['-pthread']
288