-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSConsBuildOptions
More file actions
111 lines (92 loc) · 4.46 KB
/
SConsBuildOptions
File metadata and controls
111 lines (92 loc) · 4.46 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import os
import sys
Import("environment")
use_intel_cc = False
tools_overridden = {
"CC":False,
"CXX":False,
"LINK":False,
"AR":False,
"RANLIB":False,
"AS":False
}
tools_default = {
"CC":"gcc",
"CXX":"g++",
"LINK":"ld",
"AR":"ar",
"RANLIB":"ranlib",
"AS":"yasm"
}
tool_prefix=""
AddOption('--use-intel-cc', dest="use-intel-cc", nargs=1, action='store', help=
"""Uses the Intel C/C++ compiler.
This is preferred over --use-cc=icc because we have specific flags in our build for the Intel compiler.""")
AddOption('--tool-prefix', dest="tool-prefix", nargs=1, action='store', help=
"""Sets a new prefix for the toolchain to use. This is useful for cross-compiling.
For instance, a value of 'sh4-elf' will make the C compiler 'sh4-elf-gcc', the archiver 'sh4-elf-ar', etc.""")
AddOption('--use-cc', dest="use-cc", nargs=1, action='store', help="Sets a new C compiler to use")
AddOption('--use-cxx', dest="use-cxx", nargs=1, action='store', help="Sets a new C++ compiler to use")
AddOption('--use-link', dest="use-link", nargs=1, action='store', help="Alias for --use-ld")
AddOption('--use-ld', dest="use-link", nargs=1, action='store', help="Sets a new linker to use")
AddOption('--use-ar', dest="use-ar", nargs=1, action='store', help="Sets a new archiver to use")
AddOption('--use-ranlib',dest="use-ranlib",nargs=1, action='store', help="Sets a new archive indexer to use")
AddOption('--use-as', dest="use-as", nargs=1, action='store', help="Sets a new assembler to use")
AddOption('--clear-all-tool-flags', dest="clear-flags", nargs=1, action='store', help="Clears all predetermined CC, CXX, and LD/LINK flags.")
AddOption('--extra-cc-flags', dest="extra-cc", nargs=1, action='store', help=
"""Adds flags to use with the C compiler and the C++ compiler.
These are applied after --clear-all-flags is applied but before --extra-c-flags and --extra-cxx-flags""")
AddOption('--extra-c-flags', dest="extra-c", nargs=1, action='store',
help="Adds flags to use with the C compiler. These are applied after --clear-all-flags")
AddOption('--extra-cxx-flags', dest="extra-cxx", nargs=1, action='store',
help="Adds flags to use with the C++ compiler. These are applied after --clear-all-flags")
AddOption('--extra-ld-flags', dest="extra-link", nargs=1, action='store',
help="Adds flags to use with the linker compiler. These are applied after --clear-all-flags")
AddOption('--extra-link-flags', dest="extra-link", nargs=1, action='store', help="Alias for --extra-ld-flags")
AddOption('--audio-driver', dest="audio-drv", nargs=1, action='store', help="Sets the audio driver. Current options are OpenAL, Haiku, and sndio.")
AddOption('--disable-sndio', dest="no-sndio", nargs=1, action='store',
help="Disables sndio support even when detected. Useful for Linux with both OpenAL and sndio installed..")
if GetOption('use-intel-cc') == 'y':
use_intel_cc = True
def OptionForOverride(x):
val = GetOption("use-" + x)
if val:
tools_overridden[x.upper()] = val
if GetOption("tool-prefix"):
tool_prefix = GetOption("tool-prefix")
if os.name=="posix" and (not GetOption("clear-flags") == 'y'):
environment.Append(
CFLAGS = " -ansi -Wno-long-long -Os ",
CXXFLAGS = " -std=c++11 -fno-rtti -fno-exceptions -Os ",
LINKFLAGS = " -g ")
environment.Prepend(CCFLAGS = " -pedantic -Wall -Werror -g -fstrict-aliasing -pipe ")
if not use_intel_cc:
environment.Prepend(CCFLAGS = " -Wno-unused-result ")
if not sys.platform.startswith("cyg") and not sys.platform=="msys":
environment.Prepend(CCFLAGS = " -fPIC ")
if False and sys.platform == "darwin":
XFlag = " -arch x86_64 -arch i586 "
environment.Append(CCFLAGS = XFlag, LINKFLAGS = XFlag)
for fix in ["cc", "c", "cxx", "link"]:
val = GetOption("extra-" + fix)
e = fix.upper() + "FLAGS"
if val:
environment[e] = environment[e] + " " + val + " "
if use_intel_cc:
environment.Replace(CC = "icc")
if tool_prefix:
if not tool_prefix.endswith('-'):
tool_prefix = tool_prefix + '-'
for key, _ in tools_overridden.iteritems():
tools_overridden[key] = tool_prefix + tools_default[key]
else:
OptionForOverride("cc")
OptionForOverride("cxx")
OptionForOverride("link")
OptionForOverride("ar")
OptionForOverride("ranlib")
OptionForOverride("as")
for key, value in tools_overridden.iteritems():
if value:
environment[key] = value
Return("environment")