-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSConstruct
More file actions
79 lines (63 loc) · 2.29 KB
/
Copy pathSConstruct
File metadata and controls
79 lines (63 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import os, SCons.Script, sys
from scripts import formatted_output
env = Environment(ENV = {'PATH' : os.environ['PATH'],
'HOME' : os.environ['HOME'],
'TERM' : 'xterm'},
CXX='g++',
tools=['default'], toolpath=[''])
AddOption('--verbose',
action='store_true',
help='outputs full build commands',
default=False)
AddOption('--release',
action='store_true',
help='no debug, optimized compile',
default=False)
AddOption('--win64',
action='store_true',
help='cross-compiles for windows',
default=False)
Help("""
Type: 'scons [OPTIONS]' -> compiles program
OPTIONS:
'--verbose' -> outputs full build commands
'--release' -> compiles with -O2, and without debugging info
'--win64' -> cross-compiles program for win64 platform.
""")
if not GetOption('verbose'):
formatted_output.enableShortenedColoredOuput(env)
if GetOption('release'):
env['CCFLAGS'].extend(['-O2', '-DNDEBUG'])
build_type = 'release'
else:
env['CCFLAGS'].extend(['-O0', '-g', '-gdwarf-2'])
build_type = 'debug'
if GetOption('win64'):
env.Tool('crossmingw', toolpath = ['./scripts/'])
env['LINKFLAGS'].append('--static')
os_target = 'win'
else:
os_target = 'linux'
build_type_path = os_target + '/'+ build_type
env['base_vardir'] = '#build/' + build_type_path
env['base_exec_dir'] = '#/bin/' + build_type_path
env['base_lib_dir'] = '#/lib/' + build_type_path
vardir = env['base_vardir'] + '/src'
env['gccWarningFlags'] = [
'-Wall', '-Wextra', '-Wcast-align', '-Wcast-qual',
'-fpermissive',
'-Wconversion', '-Wdisabled-optimization',
'-Wfloat-equal', '-Wformat=2', '-Wimport', '-Winit-self',
'-Winline', '-Winvalid-pch', '-Wlong-long',
'-Wmissing-format-attribute', '-Wmissing-include-dirs',
'-Wmissing-noreturn', '-Wpacked', '-Wpointer-arith',
'-Wredundant-decls', '-Wshadow', '-Wstack-protector',
'-Wstrict-aliasing=2', '-Wunreachable-code',
'-Wunsafe-loop-optimizations', '-Wunused',
'-Wvariadic-macros', '-Wwrite-strings', '-pedantic',
'-pedantic-errors', '-Woverloaded-virtual',
'-Wswitch-enum'
]
Export('env')
env.VariantDir(vardir, 'src')
SConscript(vardir + '/SConscript')