19
19
BV.Targets = COMMAND_LINE_TARGETS
21
21
############################################
22
# Dependency libraries
22
# Dependency libraries & Settings
25
RequiredLibs = ['glibmm-2.4', 'libxml++-2.6', 'mjpegtools', 'GraphicsMagick++', 'gtkmm-2.4']
25
RequiredLibs = ['glibmm-2.4', 'libxml++-2.6', 'gtkmm-2.4']
27
27
# define path to libs
28
28
def SetLibraries(config, user_options_dict):
34
34
# we make arg's tuple from list
35
35
args = tuple([ (BV.MakeDictName(lib),) for lib in RequiredLibs ])
36
36
user_options.AddVariables(*args)
39
# legacy stuff (support for GM is hard => trash)
42
# 2. uncomment in src/SConscript
43
BuildMcomposite = False
45
RequiredLibs.extend(['mjpegtools', 'GraphicsMagick++'])
48
IsThreadedBuild = False
49
ThreadOpt = ['-pthread']
38
51
############################################
42
55
cxx_warn_flags = []
43
56
debug_flags = ['-g', '-O0']
44
57
release_flags = ['-O2']
45
profile_flags = ['-g'] #['-pg']
48
60
def CalcCommonFlags():
49
61
if BV.IsReenter(CalcCommonFlags):
52
global common_warn_flags, cxx_warn_flags, profile_flags, defines
64
global common_warn_flags, cxx_warn_flags, debug_flags, defines
53
65
if BV.IsGccCompiler():
55
67
common_warn_flags = ['-ansi']
60
72
# CXXCOM = $CXX -o $TARGET -c $CCFLAGS $CXXFLAGS ...
61
73
cxx_warn_flags = ['-Wall', '-W', '-Wno-reorder'] # -W == -Wextra
74
# Oh, GCC! Just give me the speed. If you don't stop getting slower, I'll go to Clang.
75
debug_flags += ['-pipe']
76
elif BV.IsClangCompiler():
77
common_warn_flags = ['-ansi']
79
'-Wall', '-Wno-reorder',
80
'-Wno-unused-variable' # many Boost code throws it like "boost::lambda::_1"
63
82
elif BV.Cc == 'como' or BV.Cxx == 'como':
81
100
'--diag_suppress=611,21,815,414',
83
102
cxx_warn_flags = []
85
103
# policy: no XOPEN things meanwhile.
87
105
('_POSIX_C_SOURCE','200112L'), # fdopen(), fileno(), ...
146
168
def ParseVariables(user_options):
147
169
user_options.AddVariables (
148
(EnumVariable ('BUILD_CFG',
170
(EnumVariable('BUILD_CFG',
149
171
'Select release or debug build.',
150
172
'release', allowed_values = ('release', 'debug'))),
151
173
('BUILD_DIR', 'Target directory for intermediate files.',
153
(BoolVariable ('BUILD_PROFILE',
154
#'Set to 1 if you want to compile in profiling information (gprof).',
155
'Set to 1 if you want to compile in profiling information (just -g for oprofile, not for gprof).',
157
(BoolVariable ('BUILD_BRIEF',
175
(BoolVariable('BUILD_BRIEF',
158
176
'Set to 1 if you want brief compiling/linking output.',
160
(BoolVariable ('BUILD_QUICK',
161
'Set to 1 if you want to reduce building time using: \n' +
162
'\t1) PCH - precompiled headers \n' +
163
'\t2) some SCons perfomance tuning.\t\t\t',
178
(EnumVariable('BUILD_QUICK',
179
"Set to 'true' if you want to reduce building time using: \n"
180
"\t1) PCH - precompiled headers \n"
181
"\t2) some SCons perfomance tuning.\n"
182
"\t'auto' implies true for debug build and false for release one.",
183
'auto', allowed_values = ('auto', 'false', 'true'))),
165
184
('PREFIX', 'Change the default install directory.', '/usr/local'),
166
185
('DESTDIR', 'Set the intermediate install directory.', ''),
167
186
('CC', 'C compiler.'),
169
188
('CFLAGS', 'Extra C Compiler flags (for C++ too).', ''),
170
189
('CXXFLAGS','Extra C++ Compiler flags.', ''),
171
190
('LDFLAGS', 'Extra Linker flags.', ''),
172
(BoolVariable ('TEST',
173
'Set to 1 if you want to run tests for checking your build.',
175
(BoolVariable ('TEST_BUILD',
176
'Set to 1 if you want to build tests (for developers).',
178
(BoolVariable ('USE_EXT_BOOST',
191
(BoolVariable('TEST',
192
'Set to 1 if you want to build and run tests.',
194
(BoolVariable('USE_EXT_BOOST',
179
195
'Leave this setting 0 to use embedded Boost library version (recommended).',
181
197
('BOOST_INCLUDE', 'Set to include path for external(not embedded) version of the Boost library.', ''),
182
198
('BOOST_LIBPATH', 'Set to library dir path for external(not embedded) version of the Boost library.', ''),
183
199
('DVDREAD_INCLUDE', 'Set to include path for libdvdread header files.', ''),
184
200
('DVDREAD_LIBPATH', 'Set to library path where the libdvdread is located.', ''),
202
(BoolVariable('TEST_BUILD',
203
'Set to 1 if you want to build with tests (all).',
186
206
# we need to add 'lib dict vars' user_options to load in user_options_env
187
207
AddLibOptions(user_options)
190
user_options.AddVariables( ('IS_GCC',), ('CONFIGURATION',) )
210
def add_calc_variables(*lst):
211
lst = ((name,) for name in lst)
212
user_options.AddVariables( *lst )
213
add_calc_variables('IS_GCC', 'IS_CLANG', 'CONFIGURATION')
192
215
# make help (scons -h)
193
216
user_options_env = Environment(ENV = os.environ, options = user_options)
196
219
global user_options_dict
197
220
user_options_dict = user_options_env.Dictionary()
198
221
# must be later than assigning
222
BV.InitUOD(user_options_dict)
199
223
Export('user_options_dict')
200
BV.UserOptDict = user_options_dict
201
224
user_options_dict['AdjustConfigOptions'] = AdjustConfigOptions
203
226
# fill in BuildVars
204
227
BV.BuildCfg = user_options_dict['BUILD_CFG']
205
228
BV.BuildDir = user_options_dict['BUILD_DIR']
206
BV.BuildProfile = user_options_dict['BUILD_PROFILE']
207
229
BV.BuildBrief = user_options_dict['BUILD_BRIEF']
209
231
BV.Cc = user_options_dict['CC']
240
262
user_options = Variables(None, BV.Args)
241
263
ParseVariables(user_options)
265
def write_dict_value(name):
266
config.write('%s = %r\n' % (name, user_options_dict[name]))
244
269
config = open(BV.CfgFile, 'w')
246
271
config.write("# Options for building Atom project\n")
247
272
config.write('BUILD_CFG = %r\n' % (BV.BuildCfg))
248
273
config.write('BUILD_DIR = %r\n' % (BV.BuildDir))
249
config.write('BUILD_PROFILE = %r\n' % (BV.BuildProfile))
250
274
config.write('BUILD_BRIEF = %r\n' % (BV.BuildBrief))
251
config.write('BUILD_QUICK = %r\n' % (user_options_dict['BUILD_QUICK']))
252
config.write('PREFIX = %r\n' % (user_options_dict['PREFIX']))
253
config.write('DESTDIR = %r\n' % (user_options_dict['DESTDIR']))
275
write_dict_value('BUILD_QUICK')
276
config.write('TEST = %r\n' % (BV.RunTests))
277
write_dict_value('PREFIX')
278
write_dict_value('DESTDIR')
255
280
config.write('\n# Compiler information\n')
256
281
config.write('CC = %r\n' % (BV.Cc))
259
284
config.write('CXXFLAGS = %r\n' % (BV.CxxFlags))
260
285
config.write('LDFLAGS = %r\n' % (BV.LdFlags))
262
config.write('\n# Test options\n')
263
config.write('TEST = %r\n' % (BV.RunTests))
264
config.write('TEST_BUILD = %r\n' % (BV.BuildTests))
266
287
config.write('\n# Boost library\n')
267
config.write('USE_EXT_BOOST = %r\n' % (user_options_dict['USE_EXT_BOOST']))
268
config.write('BOOST_INCLUDE = %r\n' % (user_options_dict['BOOST_INCLUDE']))
269
config.write('BOOST_LIBPATH = %r\n' % (user_options_dict['BOOST_LIBPATH']))
288
write_dict_value('USE_EXT_BOOST')
289
write_dict_value('BOOST_INCLUDE')
290
write_dict_value('BOOST_LIBPATH')
271
292
config.write('\n# libdvdread library\n')
272
config.write('DVDREAD_INCLUDE = %r\n' % (user_options_dict['DVDREAD_INCLUDE']))
273
config.write('DVDREAD_LIBPATH = %r\n' % (user_options_dict['DVDREAD_LIBPATH']))
293
write_dict_value('DVDREAD_INCLUDE')
294
write_dict_value('DVDREAD_LIBPATH')
275
296
config.write('\n### Calculated data ###\n')
276
297
SConscript('Autoconfig')
278
config.write('\nIS_GCC = %r\n' % (user_options_dict['IS_GCC']))
300
write_dict_value('IS_GCC')
301
write_dict_value('IS_CLANG')
280
303
config.write('\n# Configuration\n')
281
config.write('CONFIGURATION = %r\n' % (user_options_dict['CONFIGURATION']))
304
write_dict_value('CONFIGURATION')
283
306
SetLibraries(config, user_options_dict)
308
config.write('\n# Undocumented\n')
309
# this one has only one purpose I can say: just build all
310
# to test/profile SCons speed
311
config.write('TEST_BUILD = %r\n' % (BV.BuildTests))
287
315
# something went wrong, remove config and exit/raise
291
319
# raise is better, we'll see the error and its location
294
BuildDir(BV.BuildDir, '.', duplicate=0)
322
# optimization: checking files as make
323
Decider('timestamp-newer')
324
BV.VariantDir(BV.BuildDir, '.', duplicate=0)
296
326
def GenerateBaseConfigH(target, source, env):
297
327
cfg_file = open(target[0].path, 'w')
333
363
# :TODO: remake via gcc' -include option, see "build todos"
334
364
# need for shared_ptr speed (to use quick heap implementation
335
365
# for ref count holding)
336
prj_defines = ['BOOST_SP_USE_QUICK_ALLOCATOR']
367
'BOOST_SP_USE_QUICK_ALLOCATOR',
368
'BOOST_SYSTEM_NO_DEPRECATED' # remove warnings for 'boost::system::posix_category' defined but not used ...
337
370
if not BV.IsDebugCfg():
338
371
prj_defines += ['NDEBUG']
349
382
# 4 get lib dicts
350
383
GetDict = BV.GetDict
353
mjpeg_dict = GetDict('mjpegtools')
354
gm_dict = GetDict('GraphicsMagick++')
355
gtk2mm_dict = GetDict('gtkmm-2.4')
386
dct = GetDict('gtkmm-2.4')
387
if not IsThreadedBuild:
388
# make happy gdb (debugger) by linking with multithreaded libc (in advance),
389
# cause it doesn't like singlethreaded app turns into multithreaded one
390
# in runtime (gtk shared libraries've become multithreaded)
391
dct['LINKFLAGS'] = dct.get('LINKFLAGS', []) + ThreadOpt
394
gtk2mm_dict = GetGtkmmDict()
356
395
libxmlpp_dict = GetDict('libxml++-2.6')
358
397
############################################
374
# Depends on ext: Boost, boost-logging, Boost.Filesystem
413
# Depends on ext: Boost, boost-logging, Boost.Filesystem&System
376
415
mlib_env = boost_env.Clone()
377
416
mlib_env.Append(CPPPATH = ['#libs/boost-logging']) #, LIBS = ['pthread']))
378
mlib_env.Append( LIBS = ['boost_filesystem'] )
417
# libboost_system.a linking is needed only for static builds
418
mlib_env.Append( LIBS = ['boost_filesystem', 'boost_system', 'boost_regex'] )
379
419
Export('mlib_env')
404
444
Export('mdemux_env')
450
# Depends on ext: Boost.Test
452
mdemux_tests_env = mdemux_env.Clone()
453
mdemux_tests_env.AppendUnique(**boost_test_dict)
454
Export('mdemux_tests_env')
409
459
# Depends on: mlib
410
460
# Depends on ext: glibmm-2.4, libxml++-2.6
423
473
mbase_tests_env.AppendUnique(**boost_test_dict)
424
474
Export('mbase_tests_env')
429
# Depends on: mlib, mproject
430
# Depends on ext: boost, mjpegtools, GraphicsMagick++
432
mcomposite_env = mbase_env.Clone()
433
mcomposite_env.AppendUnique(**user_options_dict['LIBMPEG2_DICT'])
434
mcomposite_env.AppendUnique(**mjpeg_dict)
435
mcomposite_env.AppendUnique(**gm_dict)
436
Export('mcomposite_env')
441
# Depends on: mcomposite, mlib/tests
443
mcomposite_tests_env = mcomposite_env.Clone()
444
mcomposite_tests_env.AppendUnique(**boost_test_dict)
445
Export('mcomposite_tests_env')
450
# Depends on: mcomposite
451
# Depends on ext: Boost.Test
453
mdemux_tests_env = mcomposite_env.Clone()
454
mdemux_tests_env.AppendUnique(**boost_test_dict)
455
mdemux_tests_env.AppendUnique(**user_options_dict['DVDREAD_DICT'])
456
Export('mdemux_tests_env')
481
498
mgui_tests_env.AppendUnique(**boost_test_dict)
482
499
Export('mgui_tests_env')
505
# Depends on: mlib, mbase
506
# Depends on ext: boost, mjpegtools, GraphicsMagick++
508
mcomposite_env = mbase_env.Clone()
509
mcomposite_env.AppendUnique(**user_options_dict['LIBMPEG2_DICT'])
510
mcomposite_env.AppendUnique(**GetDict('mjpegtools'))
511
mcomposite_env.AppendUnique(**GetDict('GraphicsMagick++'))
512
Export('mcomposite_env')
517
# Depends on: mcomposite, mlib/tests
519
mcomposite_tests_env = mcomposite_env.Clone()
520
mcomposite_tests_env.AppendUnique(**boost_test_dict)
521
Export('mcomposite_tests_env')