0ffd9ca9cc649247986e37b5a81e56d52b49bea2
[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 WITH_BF_GAMEENGINE = True
93 WITH_BF_PLAYER = True
94 WITH_BF_OCEANSIM = True
95
96 WITH_BF_BULLET = True
97 BF_BULLET = '#extern/bullet2/src'
98 BF_BULLET_INC = '${BF_BULLET}'
99 BF_BULLET_LIB = 'extern_bullet'
100
101 WITH_BF_ELTOPO = False
102 BF_LAPACK = '/usr'
103 BF_LAPACK_LIB = 'lapack3gf blas clapack'
104 BF_LAPACK_LIBPATH = '${BF_LAPACK}/lib'
105
106 BF_FREETYPE = '/usr'
107 BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
108 BF_FREETYPE_LIB = 'freetype'
109 #BF_FREETYPE_LIB_STATIC = '${BF_FREETYPE}/lib/libfreetype.a'
110
111 WITH_BF_QUICKTIME = False
112 BF_QUICKTIME = '/usr/local'
113 BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
114
115 WITH_BF_ICONV = False
116 BF_ICONV = LIBDIR + "/iconv"
117 BF_ICONV_INC = '${BF_ICONV}/include'
118 BF_ICONV_LIB = 'iconv'
119 BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
120
121 WITH_BF_BINRELOC = True
122
123 # enable ffmpeg  support
124 WITH_BF_FFMPEG = True
125 BF_FFMPEG = LIBDIR + '/ffmpeg'
126 if os.path.exists(LCGDIR + '/ffmpeg'):
127     WITH_BF_STATICFFMPEG = True
128     BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libswscale.a ' + \
129         '${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ${BF_FFMPEG_LIBPATH}/libavutil.a ' + \
130         '${BF_FFMPEG_LIBPATH}/libxvidcore.a ${BF_FFMPEG_LIBPATH}/libx264.a ${BF_FFMPEG_LIBPATH}/libmp3lame.a ' + \
131         '${BF_FFMPEG_LIBPATH}/libvpx.a ${BF_FFMPEG_LIBPATH}/libvorbis.a ${BF_FFMPEG_LIBPATH}/libogg.a ' + \
132         '${BF_FFMPEG_LIBPATH}/libvorbisenc.a ${BF_FFMPEG_LIBPATH}/libtheora.a ' + \
133         '${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ${BF_FFMPEG_LIBPATH}/liborc-0.4.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a ' + \
134         '${BF_FFMPEG_LIBPATH}/libfaad.a'
135 else:
136     BF_FFMPEG = '/usr'
137 BF_FFMPEG_LIB = 'avformat avcodec swscale avutil avdevice'
138 BF_FFMPEG_INC = '${BF_FFMPEG}/include'
139 BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
140 #WITH_BF_STATICFFMPEG = True
141 #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'
142
143 # enable ogg, vorbis and theora in ffmpeg
144 WITH_BF_OGG = False
145 BF_OGG = '/usr'
146 BF_OGG_INC = '${BF_OGG}/include'
147 BF_OGG_LIB = 'ogg vorbis vorbisenc theoraenc theoradec'
148
149 WITH_BF_OPENJPEG = True 
150 BF_OPENJPEG = '#extern/libopenjpeg'
151 BF_OPENJPEG_LIB = ''
152 BF_OPENJPEG_INC = '${BF_OPENJPEG}'
153 BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
154
155 WITH_BF_FFTW3 = False
156 WITH_BF_STATICFFTW3 = False
157 BF_FFTW3 = '/usr'
158 BF_FFTW3_INC = '${BF_FFTW3}/include'
159 BF_FFTW3_LIB = 'fftw3'
160 BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
161 BF_FFTW3_LIB_STATIC = '${BF_FFTW3_LIBPATH}/libfftw3.a'
162
163 WITH_BF_REDCODE = False  
164 BF_REDCODE = '#extern/libredcode'
165 BF_REDCODE_LIB = ''
166 # BF_REDCODE_INC = '${BF_REDCODE}/include'
167 BF_REDCODE_INC = '${BF_REDCODE}/../' #C files request "libredcode/format.h" which is in "#extern/libredcode/format.h", stupid but compiles for now.
168 BF_REDCODE_LIBPATH='${BF_REDCODE}/lib'
169
170 # Mesa Libs should go here if your using them as well....
171 WITH_BF_STATICOPENGL = False
172 BF_OPENGL = '/usr'
173 BF_OPENGL_INC = '${BF_OPENGL}/include'
174 BF_OPENGL_LIB = 'GL GLU X11 Xi'
175 BF_OPENGL_LIBPATH = '/usr/X11R6/lib'
176 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'
177
178 WITH_BF_COLLADA = False
179 BF_COLLADA = '#source/blender/collada'
180 BF_COLLADA_INC = '${BF_COLLADA}'
181 BF_COLLADA_LIB = 'bf_collada'
182 BF_OPENCOLLADA = '/usr'
183 BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}'
184 BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver pcre buffer ftoa'
185 BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib'
186 BF_PCRE = ''
187 BF_PCRE_LIB = 'pcre'
188 BF_PCRE_LIBPATH = '/usr/lib'
189 BF_EXPAT = '/usr'
190 BF_EXPAT_LIB = 'expat'
191 BF_EXPAT_LIBPATH = '/usr/lib'
192
193 WITH_BF_JEMALLOC = False
194 WITH_BF_STATICJEMALLOC = False
195 BF_JEMALLOC = '/usr'
196 BF_JEMALLOC_INC = '${BF_JEMALLOC}/include'
197 BF_JEMALLOC_LIBPATH = '${BF_JEMALLOC}/lib'
198 BF_JEMALLOC_LIB = 'jemalloc'
199 BF_JEMALLOC_LIB_STATIC = '${BF_JEMALLOC_LIBPATH}/libjemalloc.a'
200
201 WITH_BF_OIIO = True
202 WITH_BF_STATICOIIO = False
203 BF_OIIO = LIBDIR + '/oiio'
204 if not os.path.exists(LCGDIR + '/oiio'):
205     WITH_BF_OIIO = False
206     BF_OIIO = '/usr'
207 BF_OIIO_INC = '${BF_OIIO}/include'
208 BF_OIIO_LIB = 'OpenImageIO'
209 BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
210
211 WITH_BF_OCIO = True
212 WITH_BF_STATICOCIO = False
213 BF_OCIO = LIBDIR + '/ocio'
214 if not os.path.exists(LCGDIR + '/ocio'):
215     WITH_BF_OCIO = False
216     BF_OCIO = '/usr'
217 BF_OCIO_INC = '${BF_OCIO}/include'
218 BF_OCIO_LIB = 'OpenColorIO yaml-cpp tinyxml'
219 BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
220
221 WITH_BF_BOOST = True
222 WITH_BF_STATICBOOST = False
223 BF_BOOST = LIBDIR + '/boost'
224 if not os.path.exists(LCGDIR + '/boost'):
225     WITH_BF_BOOST = False
226     BF_BOOST = '/usr'
227 BF_BOOST_INC = '${BF_BOOST}/include'
228 BF_BOOST_LIB = 'boost_date_time boost_filesystem boost_regex boost_system boost_thread'
229 BF_BOOST_LIB_INTERNATIONAL = 'boost_locale'
230 BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
231
232 WITH_BF_CYCLES = WITH_BF_OIIO and WITH_BF_BOOST
233
234 WITH_BF_CYCLES_CUDA_BINARIES = False
235 BF_CYCLES_CUDA_NVCC = '/usr/local/cuda/bin/nvcc'
236 BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21', 'sm_30']
237
238 WITH_BF_OPENMP = True
239
240 #Ray trace optimization
241 WITH_BF_RAYOPTIMIZATION = True
242 BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse','-pthread']
243
244 #SpaceNavigator and friends
245 WITH_BF_3DMOUSE = True
246 WITH_BF_STATIC3DMOUSE = False
247 BF_3DMOUSE = '/usr'
248 BF_3DMOUSE_INC = '${BF_3DMOUSE}/include'
249 BF_3DMOUSE_LIBPATH = '${BF_3DMOUSE}/lib'
250 BF_3DMOUSE_LIB = 'spnav'
251 BF_3DMOUSE_LIB_STATIC = '${BF_3DMOUSE_LIBPATH}/libspnav.a'
252
253 ##
254 CC = 'gcc'
255 CXX = 'g++'
256 ##ifeq ($CPU),alpha)
257 ##   CFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing -mieee
258
259 CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing','-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64','-D_LARGEFILE64_SOURCE']
260 CXXFLAGS = []
261
262 CPPFLAGS = []
263 # g++ 4.6, only needed for bullet
264 CXXFLAGS += ['-fpermissive']
265 if WITH_BF_FFMPEG:
266     # libavutil needs UINT64_C()
267     CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ]
268 REL_CFLAGS = []
269 REL_CXXFLAGS = []
270 REL_CCFLAGS = ['-DNDEBUG', '-O2']
271 ##BF_DEPEND = True
272 ##
273 ##AR = ar
274 ##ARFLAGS = ruv
275 ##ARFLAGSQUIET = ru
276 ##
277 C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement', '-Wunused-parameter', '-Wstrict-prototypes', '-Werror=declaration-after-statement', '-Werror=implicit-function-declaration', '-Werror=return-type']
278 CC_WARN = ['-Wall']
279 CXX_WARN = ['-Wno-invalid-offsetof', '-Wno-sign-compare']
280
281
282 ##FIX_STUBS_WARNINGS = -Wno-unused
283
284 LLIBS = ['util', 'c', 'm', 'dl', 'pthread', 'stdc++']
285 ##LOPTS = --dynamic
286 ##DYNLDFLAGS = -shared $(LDFLAGS)
287
288 BF_PROFILE = False
289 BF_PROFILE_CCFLAGS = ['-pg','-g']
290 BF_PROFILE_LINKFLAGS = ['-pg']
291
292 BF_DEBUG = False
293 BF_DEBUG_CCFLAGS = ['-g', '-D_DEBUG']
294
295 BF_BUILDDIR = '../build/linux'
296 BF_INSTALLDIR='../install/linux'
297
298 #Link against pthread
299 PLATFORM_LINKFLAGS = ['-pthread']
300