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