blob: bc7ca36c945b5a59118554766dd45576936bd06f (
plain) (
blame)
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
|
--
-- dotnet.lua
-- Interface for the C# compilers, all of which are flag compatible.
-- Copyright (c) 2002-2009 Jason Perkins and the Premake project
--
premake.dotnet = { }
premake.dotnet.namestyle = "windows"
--
-- Translation of Premake flags into CSC flags
--
local flags =
{
FatalWarning = "/warnaserror",
Optimize = "/optimize",
OptimizeSize = "/optimize",
OptimizeSpeed = "/optimize",
Symbols = "/debug",
Unsafe = "/unsafe"
}
--
-- Return the default build action for a given file, based on the file extension.
--
function premake.dotnet.getbuildaction(fcfg)
local ext = path.getextension(fcfg.name):lower()
if fcfg.buildaction == "Compile" or ext == ".cs" then
return "Compile"
elseif fcfg.buildaction == "Embed" or ext == ".resx" then
return "EmbeddedResource"
elseif fcfg.buildaction == "Copy" or ext == ".asax" or ext == ".aspx" then
return "Content"
else
return "None"
end
end
--
-- Returns the compiler filename (they all use the same arguments)
--
function premake.dotnet.getcompilervar(cfg)
if (_OPTIONS.dotnet == "msnet") then
return "csc"
elseif (_OPTIONS.dotnet == "mono") then
return "mcs"
else
return "cscc"
end
end
--
-- Returns a list of compiler flags, based on the supplied configuration.
--
function premake.dotnet.getflags(cfg)
local result = table.translate(cfg.flags, flags)
return result
end
--
-- Translates the Premake kind into the CSC kind string.
--
function premake.dotnet.getkind(cfg)
if (cfg.kind == "ConsoleApp") then
return "Exe"
elseif (cfg.kind == "WindowedApp") then
return "WinExe"
elseif (cfg.kind == "SharedLib") then
return "Library"
end
end
|