A few C# fixes (#717)
* small C# fixes (#87) * three small c# bug fixes - hint paths now work with extended assembly names - shared lib projects can now include App files (purely for editing) - explict error message is output when attempting to generate a C# + StaticLib project. * Fix typo. * added perfile support for clr, exceptionhandling and basicruntimechecks for vs (#89)
This commit is contained in:
parent
5a3593a824
commit
4670158d85
@ -343,7 +343,12 @@
|
||||
|
||||
if decorated:find("/", nil, true) then
|
||||
_x(2,'<Reference Include="%s">', name)
|
||||
_x(3,'<HintPath>%s</HintPath>', path.appendextension(path.translate(decorated), ".dll"))
|
||||
local decPath, decVars = decorated:match("(.-),")
|
||||
if not decPath then
|
||||
decPath = decorated
|
||||
end
|
||||
|
||||
_x(3,'<HintPath>%s</HintPath>', path.appendextension(path.translate(decPath), ".dll"))
|
||||
|
||||
if not config.isCopyLocal(prj, original, true) then
|
||||
_p(3,"<Private>False</Private>")
|
||||
|
@ -659,7 +659,10 @@
|
||||
m.enableEnhancedInstructionSet,
|
||||
m.additionalCompileOptions,
|
||||
m.disableSpecificWarnings,
|
||||
m.treatSpecificWarningsAsErrors
|
||||
m.treatSpecificWarningsAsErrors,
|
||||
m.basicRuntimeChecks,
|
||||
m.exceptionHandling,
|
||||
m.compileAsManaged,
|
||||
}
|
||||
else
|
||||
return {
|
||||
@ -961,13 +964,34 @@
|
||||
end
|
||||
|
||||
|
||||
function m.isClrMixed(prj)
|
||||
-- check to see if any files are marked with clr
|
||||
local isMixed = false
|
||||
if not prj.clr or prj.clr == p.OFF then
|
||||
if prj._isClrMixed ~= nil then
|
||||
isMixed = prj._isClrMixed
|
||||
else
|
||||
table.foreachi(prj._.files, function(file)
|
||||
for cfg in p.project.eachconfig(prj) do
|
||||
local fcfg = p.fileconfig.getconfig(file, cfg)
|
||||
if fcfg and fcfg.clr and fcfg.clr ~= p.OFF then
|
||||
isMixed = true
|
||||
end
|
||||
end
|
||||
end)
|
||||
prj._isClrMixed = isMixed -- cache the results
|
||||
end
|
||||
end
|
||||
return isMixed
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Generate the list of project dependencies.
|
||||
--
|
||||
|
||||
m.elements.projectReferences = function(prj, ref)
|
||||
if prj.clr ~= p.OFF then
|
||||
if prj.clr ~= p.OFF or (m.isClrMixed(prj) and ref and ref.kind ~=p.STATICLIB) then
|
||||
return {
|
||||
m.referenceProject,
|
||||
m.referencePrivate,
|
||||
@ -1075,10 +1099,24 @@
|
||||
end
|
||||
|
||||
|
||||
function m.basicRuntimeChecks(cfg)
|
||||
local runtime = config.getruntime(cfg)
|
||||
if cfg.flags.NoRuntimeChecks or (config.isOptimizedBuild(cfg) and runtime:endswith("Debug")) then
|
||||
m.element("BasicRuntimeChecks", nil, "Default")
|
||||
function m.compileAsManaged(fcfg, condition)
|
||||
if fcfg.clr and fcfg ~= p.OFF then
|
||||
m.element("CompileAsManaged", condition, "true")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function m.basicRuntimeChecks(cfg, condition)
|
||||
local prjcfg, filecfg = p.config.normalize(cfg)
|
||||
local runtime = config.getruntime(prjcfg)
|
||||
if filecfg then
|
||||
if filecfg.flags.NoRuntimeChecks or (config.isOptimizedBuild(filecfg) and runtime:endswith("Debug")) then
|
||||
m.element("BasicRuntimeChecks", condition, "Default")
|
||||
end
|
||||
else
|
||||
if prjcfg.flags.NoRuntimeChecks or (config.isOptimizedBuild(prjcfg) and runtime:endswith("Debug")) then
|
||||
m.element("BasicRuntimeChecks", nil, "Default")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -1277,12 +1315,11 @@
|
||||
end
|
||||
|
||||
|
||||
function m.exceptionHandling(cfg)
|
||||
local value
|
||||
function m.exceptionHandling(cfg, condition)
|
||||
if cfg.exceptionhandling == p.OFF then
|
||||
m.element("ExceptionHandling", nil, "false")
|
||||
m.element("ExceptionHandling", condition, "false")
|
||||
elseif cfg.exceptionhandling == "SEH" then
|
||||
m.element("ExceptionHandling", nil, "Async")
|
||||
m.element("ExceptionHandling", condition, "Async")
|
||||
end
|
||||
end
|
||||
|
||||
@ -1648,8 +1685,10 @@
|
||||
if isMakefile then
|
||||
m.element("Keyword", nil, "MakeFileProj")
|
||||
else
|
||||
if isManaged then
|
||||
if isManaged or m.isClrMixed(prj) then
|
||||
m.targetFramework(prj)
|
||||
end
|
||||
if isManaged then
|
||||
m.element("Keyword", nil, "ManagedCProj")
|
||||
else
|
||||
m.element("Keyword", nil, "Win32Proj")
|
||||
|
@ -50,7 +50,11 @@
|
||||
info.action = "Resource"
|
||||
elseif ext == ".xaml" then
|
||||
if fcfg.buildaction == "Application" or path.getbasename(fname) == "App" then
|
||||
info.action = "ApplicationDefinition"
|
||||
if fcfg.project.kind == premake.SHAREDLIB then
|
||||
info.action = "None"
|
||||
else
|
||||
info.action = "ApplicationDefinition"
|
||||
end
|
||||
else
|
||||
info.action = "Page"
|
||||
end
|
||||
@ -281,6 +285,8 @@
|
||||
return "WinExe"
|
||||
elseif (cfg.kind == "SharedLib") then
|
||||
return "Library"
|
||||
else
|
||||
error("invalid dotnet kind " .. cfg.kind .. ". Valid kinds are ConsoleApp, WindowsApp, SharedLib")
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user