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