-
-
Notifications
You must be signed in to change notification settings - Fork 651
Expand file tree
/
Copy pathsnc.lua
More file actions
149 lines (119 loc) · 2.92 KB
/
Copy pathsnc.lua
File metadata and controls
149 lines (119 loc) · 2.92 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
--
-- snc.lua
-- Provides Sony SNC-specific configuration strings.
-- Copyright (c) 2010-2016 Jess Perkins and the Premake project
--
local p = premake
p.tools.snc = {}
local snc = p.tools.snc
local gcc = p.tools.gcc
--
-- Retrieve the CFLAGS for a specific configuration.
--
snc.shared = {
fatalwarnings = {
All = "-Xquit=2",
},
optimize = {
Off = "-O0",
On = "-O1",
Debug = "-Od",
Full = "-O3",
Size = "-Os",
Speed = "-O2",
},
warnings = {
Extra = "-Xdiag=2",
}
}
snc.cflags = {
}
function snc.getcflags(cfg)
local shared = p.config.mapFlags(cfg, snc.shared)
local cflags = p.config.mapFlags(cfg, snc.cflags)
local flags = table.join(shared, cflags, snc.getwarnings(cfg))
return flags
end
--
-- Retrieve the CXXFLAGS for a specific configuration.
--
snc.cxxflags = {
exceptionhandling = {
Default = "-Xc+=exceptions",
On = "-Xc+=exceptions",
SEH = "-Xc-=exceptions",
},
rtti = {
Default = "-Xc+=rtti",
On = "-Xc+=rtti",
SEH = "-Xc-=rtti",
}
}
function snc.getcxxflags(cfg)
local shared = config.mapFlags(cfg, snc.shared)
local cxxflags = config.mapFlags(cfg, snc.cxxflags)
local flags = table.join(shared, cxxflags, snc.getwarnings(cfg))
return flags
end
--
-- Returns a list of forced include files, decorated for the compiler
-- command line.
--
-- @param cfg
-- The project configuration.
-- @return
-- An array of force include files with the appropriate flags.
--
function snc.getforceincludes(cfg)
-- Just pass through to GCC for now
local flags = gcc.getforceincludes(cfg)
return flags
end
--
-- Retrieve the LDFLAGS for a specific configuration.
--
function snc.getldflags(cfg)
local flags = { }
if not (cfg.symbols == p.ON) then
table.insert(flags, "-s")
end
return flags
end
--
-- These are the same as GCC
--
snc.getcppflags = gcc.getcppflags
snc.getdefines = gcc.getdefines
snc.getincludedirs = gcc.getincludedirs
snc.getrunpathdirs = gcc.getrunpathdirs
snc.getLibraryDirectories = gcc.getLibraryDirectories
snc.getlinks = gcc.getlinks
--
-- Returns makefile-specific configuration rules.
--
function snc.getmakesettings(cfg)
return nil
end
--
-- Retrieves the executable command name for a tool, based on the
-- provided configuration and the operating environment.
--
-- @param cfg
-- The configuration to query.
-- @param tool
-- The tool to fetch, one of "cc" for the C compiler, "cxx" for
-- the C++ compiler, or "ar" for the static linker.
-- @return
-- The executable command name for a tool, or nil if the system's
-- default value should be used.
--
snc.tools = {
}
function snc.gettoolname(cfg, tool)
-- Check toolsetpaths first
if cfg.toolsetpaths and cfg.toolsetpaths[cfg.toolset] and cfg.toolsetpaths[cfg.toolset][tool] then
return cfg.toolsetpaths[cfg.toolset][tool]
end
local names = snc.tools[cfg.architecture] or snc.tools[cfg.system] or {}
return names[tool]
end