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