** Merged branches/platforms (r735:741) Added x32 and x64 platform support for VS2005 and 2008
This commit is contained in:
parent
7760afe2e0
commit
a16cdf5fe5
@ -2,6 +2,7 @@
|
||||
4.1 (in progress)
|
||||
-----
|
||||
|
||||
- Added support for multiple target platforms
|
||||
- Bug 2564404: FatalWarnings has no effect with gmake target
|
||||
- Bug 2550759: pchheader option has wrong type
|
||||
- Support links and libdirs for Visual Studio static libraries
|
||||
|
@ -1,6 +1,7 @@
|
||||
solution "PremakeTestbox"
|
||||
configurations { "Debug", "Release" }
|
||||
|
||||
platforms { "x32", "x64" }
|
||||
|
||||
-- solution level configuration
|
||||
|
||||
configuration "Debug"
|
||||
|
@ -14,6 +14,7 @@
|
||||
"base/path.lua",
|
||||
"base/string.lua",
|
||||
"base/table.lua",
|
||||
"base/io.lua",
|
||||
"base/globals.lua",
|
||||
"base/template.lua",
|
||||
"base/project.lua",
|
||||
@ -25,6 +26,14 @@
|
||||
"tools/ow.lua",
|
||||
"base/validate.lua",
|
||||
"base/help.lua",
|
||||
"actions/vstudio/vs2002_solution.lua",
|
||||
"actions/vstudio/vs2002_csproj.lua",
|
||||
"actions/vstudio/vs2002_csproj_user.lua",
|
||||
"actions/vstudio/vs200x_vcproj.lua",
|
||||
"actions/vstudio/vs2003_solution.lua",
|
||||
"actions/vstudio/vs2005_solution.lua",
|
||||
"actions/vstudio/vs2005_csproj.lua",
|
||||
"actions/vstudio/vs2005_csproj_user.lua",
|
||||
}
|
||||
|
||||
|
||||
@ -39,14 +48,6 @@
|
||||
"actions/make/make_solution.tmpl",
|
||||
"actions/make/make_cpp.tmpl",
|
||||
"actions/make/make_csharp.tmpl",
|
||||
"actions/vstudio/vs2002_solution.tmpl",
|
||||
"actions/vstudio/vs2002_csproj.tmpl",
|
||||
"actions/vstudio/vs2002_csproj_user.tmpl",
|
||||
"actions/vstudio/vs2003_solution.tmpl",
|
||||
"actions/vstudio/vs2005_solution.tmpl",
|
||||
"actions/vstudio/vs2005_csproj.tmpl",
|
||||
"actions/vstudio/vs2005_csproj_user.tmpl",
|
||||
"actions/vstudio/vs200x_vcproj.tmpl",
|
||||
}
|
||||
|
||||
|
||||
|
@ -290,13 +290,13 @@
|
||||
valid_languages = { "C", "C++", "C#" },
|
||||
|
||||
solutiontemplates = {
|
||||
{ ".sln", _TEMPLATES.vs2002_solution },
|
||||
{ ".sln", premake.vs2002_solution },
|
||||
},
|
||||
|
||||
projecttemplates = {
|
||||
{ ".vcproj", _TEMPLATES.vs200x_vcproj, function(this) return this.language ~= "C#" end },
|
||||
{ ".csproj", _TEMPLATES.vs2002_csproj, function(this) return this.language == "C#" end },
|
||||
{ ".csproj.user", _TEMPLATES.vs2002_csproj_user, function(this) return this.language == "C#" end },
|
||||
{ ".vcproj", premake.vs200x_vcproj, function(this) return this.language ~= "C#" end },
|
||||
{ ".csproj", premake.vs2002_csproj, function(this) return this.language == "C#" end },
|
||||
{ ".csproj.user", premake.vs2002_csproj_user, function(this) return this.language == "C#" end },
|
||||
},
|
||||
|
||||
onclean = _VS.onclean,
|
||||
@ -313,13 +313,13 @@
|
||||
valid_languages = { "C", "C++", "C#" },
|
||||
|
||||
solutiontemplates = {
|
||||
{ ".sln", _TEMPLATES.vs2003_solution },
|
||||
{ ".sln", premake.vs2003_solution },
|
||||
},
|
||||
|
||||
projecttemplates = {
|
||||
{ ".vcproj", _TEMPLATES.vs200x_vcproj, function(this) return this.language ~= "C#" end },
|
||||
{ ".csproj", _TEMPLATES.vs2002_csproj, function(this) return this.language == "C#" end },
|
||||
{ ".csproj.user", _TEMPLATES.vs2002_csproj_user, function(this) return this.language == "C#" end },
|
||||
{ ".vcproj", premake.vs200x_vcproj, function(this) return this.language ~= "C#" end },
|
||||
{ ".csproj", premake.vs2002_csproj, function(this) return this.language == "C#" end },
|
||||
{ ".csproj.user", premake.vs2002_csproj_user, function(this) return this.language == "C#" end },
|
||||
},
|
||||
|
||||
onclean = _VS.onclean,
|
||||
@ -336,13 +336,13 @@
|
||||
valid_languages = { "C", "C++", "C#" },
|
||||
|
||||
solutiontemplates = {
|
||||
{ ".sln", _TEMPLATES.vs2005_solution },
|
||||
{ ".sln", premake.vs2005_solution },
|
||||
},
|
||||
|
||||
projecttemplates = {
|
||||
{ ".vcproj", _TEMPLATES.vs200x_vcproj, function(this) return this.language ~= "C#" end },
|
||||
{ ".csproj", _TEMPLATES.vs2005_csproj, function(this) return this.language == "C#" end },
|
||||
{ ".csproj.user", _TEMPLATES.vs2005_csproj_user, function(this) return this.language == "C#" end },
|
||||
{ ".vcproj", premake.vs200x_vcproj, function(this) return this.language ~= "C#" end },
|
||||
{ ".csproj", premake.vs2005_csproj, function(this) return this.language == "C#" end },
|
||||
{ ".csproj.user", premake.vs2005_csproj_user, function(this) return this.language == "C#" end },
|
||||
},
|
||||
|
||||
onclean = _VS.onclean,
|
||||
@ -359,13 +359,13 @@
|
||||
valid_languages = { "C", "C++", "C#" },
|
||||
|
||||
solutiontemplates = {
|
||||
{ ".sln", _TEMPLATES.vs2005_solution },
|
||||
{ ".sln", premake.vs2005_solution },
|
||||
},
|
||||
|
||||
projecttemplates = {
|
||||
{ ".vcproj", _TEMPLATES.vs200x_vcproj, function(this) return this.language ~= "C#" end },
|
||||
{ ".csproj", _TEMPLATES.vs2005_csproj, function(this) return this.language == "C#" end },
|
||||
{ ".csproj.user", _TEMPLATES.vs2005_csproj_user, function(this) return this.language == "C#" end },
|
||||
{ ".vcproj", premake.vs200x_vcproj, function(this) return this.language ~= "C#" end },
|
||||
{ ".csproj", premake.vs2005_csproj, function(this) return this.language == "C#" end },
|
||||
{ ".csproj.user", premake.vs2005_csproj_user, function(this) return this.language == "C#" end },
|
||||
},
|
||||
|
||||
onclean = _VS.onclean,
|
||||
|
143
src/actions/vstudio/vs2002_csproj.lua
Normal file
143
src/actions/vstudio/vs2002_csproj.lua
Normal file
@ -0,0 +1,143 @@
|
||||
--
|
||||
-- vs2002_csproj.lua
|
||||
-- Generate a Visual Studio 2002/2003 C# project.
|
||||
-- Copyright (c) 2009 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
--
|
||||
-- Figure out what elements a particular file need in its item block,
|
||||
-- based on its build action and any related files in the project.
|
||||
--
|
||||
local function getelements(prj, action, fname)
|
||||
|
||||
if action == "Compile" and fname:endswith(".cs") then
|
||||
return "SubTypeCode"
|
||||
end
|
||||
|
||||
if action == "EmbeddedResource" and fname:endswith(".resx") then
|
||||
-- is there a matching *.cs file?
|
||||
local basename = fname:sub(1, -6)
|
||||
local testname = path.getname(basename .. ".cs")
|
||||
if premake.findfile(prj, testname) then
|
||||
return "Dependency", testname
|
||||
end
|
||||
end
|
||||
|
||||
return "None"
|
||||
end
|
||||
|
||||
|
||||
|
||||
function premake.vs2002_csproj(prj)
|
||||
io.eol = "\r\n"
|
||||
io.printf('<VisualStudioProject>')
|
||||
|
||||
io.printf('\t<CSHARP')
|
||||
io.printf('\t\tProjectType = "Local"')
|
||||
io.printf('\t\tProductVersion = "%s"', iif(_ACTION == "vs2002", "7.0.9254", "7.10.3077"))
|
||||
io.printf('\t\tSchemaVersion = "%s"', iif(_ACTION == "vs2002", "1.0", "2.0"))
|
||||
io.printf('\t\tProjectGuid = "{%s}"', prj.uuid)
|
||||
io.printf('\t>')
|
||||
|
||||
io.printf('\t\t<Build>')
|
||||
|
||||
-- Write out project-wide settings
|
||||
io.printf('\t\t\t<Settings')
|
||||
io.printf('\t\t\t\tApplicationIcon = ""')
|
||||
io.printf('\t\t\t\tAssemblyKeyContainerName = ""')
|
||||
io.printf('\t\t\t\tAssemblyName = "%s"', prj.buildtarget.basename)
|
||||
io.printf('\t\t\t\tAssemblyOriginatorKeyFile = ""')
|
||||
io.printf('\t\t\t\tDefaultClientScript = "JScript"')
|
||||
io.printf('\t\t\t\tDefaultHTMLPageLayout = "Grid"')
|
||||
io.printf('\t\t\t\tDefaultTargetSchema = "IE50"')
|
||||
io.printf('\t\t\t\tDelaySign = "false"')
|
||||
if _ACTION == "vs2002" then
|
||||
io.printf('\t\t\t\tNoStandardLibraries = "false"')
|
||||
end
|
||||
io.printf('\t\t\t\tOutputType = "%s"', premake.csc.getkind(prj))
|
||||
if _ACTION == "vs2003" then
|
||||
io.printf('\t\t\t\tPreBuildEvent = ""')
|
||||
io.printf('\t\t\t\tPostBuildEvent = ""')
|
||||
end
|
||||
io.printf('\t\t\t\tRootNamespace = "%s"', prj.buildtarget.basename)
|
||||
if _ACTION == "vs2003" then
|
||||
io.printf('\t\t\t\tRunPostBuildEvent = "OnBuildSuccess"')
|
||||
end
|
||||
io.printf('\t\t\t\tStartupObject = ""')
|
||||
io.printf('\t\t\t>')
|
||||
|
||||
-- Write out configuration blocks
|
||||
for cfg in premake.eachconfig(prj) do
|
||||
io.printf('\t\t\t\t<Config')
|
||||
io.printf('\t\t\t\t\tName = "%s"', premake.esc(cfg.name))
|
||||
io.printf('\t\t\t\t\tAllowUnsafeBlocks = "%s"', iif(cfg.flags.Unsafe, "true", "false"))
|
||||
io.printf('\t\t\t\t\tBaseAddress = "285212672"')
|
||||
io.printf('\t\t\t\t\tCheckForOverflowUnderflow = "false"')
|
||||
io.printf('\t\t\t\t\tConfigurationOverrideFile = ""')
|
||||
io.printf('\t\t\t\t\tDefineConstants = "%s"', premake.esc(table.concat(cfg.defines, ";")))
|
||||
io.printf('\t\t\t\t\tDocumentationFile = ""')
|
||||
io.printf('\t\t\t\t\tDebugSymbols = "%s"', iif(cfg.flags.Symbols, "true", "false"))
|
||||
io.printf('\t\t\t\t\tFileAlignment = "4096"')
|
||||
io.printf('\t\t\t\t\tIncrementalBuild = "false"')
|
||||
if _ACTION == "vs2003" then
|
||||
io.printf('\t\t\t\t\tNoStdLib = "false"')
|
||||
io.printf('\t\t\t\t\tNoWarn = ""')
|
||||
end
|
||||
io.printf('\t\t\t\t\tOptimize = "%s"', iif(cfg.flags.Optimize or cfg.flags.OptimizeSize or cfg.flags.OptimizeSpeed, "true", "false"))
|
||||
io.printf('\t\t\t\t\tOutputPath = "%s"', premake.esc(cfg.buildtarget.directory))
|
||||
io.printf('\t\t\t\t\tRegisterForComInterop = "false"')
|
||||
io.printf('\t\t\t\t\tRemoveIntegerChecks = "false"')
|
||||
io.printf('\t\t\t\t\tTreatWarningsAsErrors = "%s"', iif(cfg.flags.FatalWarnings, "true", "false"))
|
||||
io.printf('\t\t\t\t\tWarningLevel = "4"')
|
||||
io.printf('\t\t\t\t/>')
|
||||
end
|
||||
io.printf('\t\t\t</Settings>')
|
||||
|
||||
-- List assembly references
|
||||
io.printf('\t\t\t<References>')
|
||||
for _, ref in ipairs(premake.getlinks(prj, "siblings", "object")) do
|
||||
io.printf('\t\t\t\t<Reference')
|
||||
io.printf('\t\t\t\t\tName = "%s"', ref.buildtarget.basename)
|
||||
io.printf('\t\t\t\t\tProject = "{%s}"', ref.uuid)
|
||||
io.printf('\t\t\t\t\tPackage = "{%s}"', _VS.tool(ref))
|
||||
io.printf('\t\t\t\t/>')
|
||||
end
|
||||
for _, linkname in ipairs(premake.getlinks(prj, "system", "fullpath")) do
|
||||
io.printf('\t\t\t\t<Reference')
|
||||
io.printf('\t\t\t\t\tName = "%s"', path.getbasename(linkname))
|
||||
io.printf('\t\t\t\t\tAssemblyName = "%s"', path.getname(linkname))
|
||||
if path.getdirectory(linkname) ~= "." then
|
||||
io.printf('\t\t\t\t\tHintPath = "%s"', path.translate(linkname, "\\"))
|
||||
end
|
||||
io.printf('\t\t\t\t/>')
|
||||
end
|
||||
io.printf('\t\t\t</References>')
|
||||
|
||||
io.printf('\t\t</Build>')
|
||||
|
||||
-- List source files
|
||||
io.printf('\t\t<Files>')
|
||||
io.printf('\t\t\t<Include>')
|
||||
for fcfg in premake.eachfile(prj) do
|
||||
local action = premake.csc.getbuildaction(fcfg)
|
||||
local fname = path.translate(premake.esc(fcfg.name), "\\")
|
||||
local elements, dependency = getelements(prj, action, fcfg.name)
|
||||
|
||||
io.printf('\t\t\t\t<File')
|
||||
io.printf('\t\t\t\t\tRelPath = "%s"', premake.esc(fname))
|
||||
io.printf('\t\t\t\t\tBuildAction = "%s"', action)
|
||||
if dependency then
|
||||
io.printf('\t\t\t\t\tDependentUpon = "%s"', premake.esc(path.translate(dependency, "\\")))
|
||||
end
|
||||
if elements == "SubTypeCode" then
|
||||
io.printf('\t\t\t\t\tSubType = "Code"')
|
||||
end
|
||||
io.printf('\t\t\t\t/>')
|
||||
end
|
||||
io.printf('\t\t\t</Include>')
|
||||
io.printf('\t\t</Files>')
|
||||
|
||||
io.printf('\t</CSHARP>')
|
||||
io.printf('</VisualStudioProject>')
|
||||
|
||||
end
|
@ -1,127 +0,0 @@
|
||||
<%
|
||||
eol = "\r\n"
|
||||
local csc = premake.csc
|
||||
|
||||
--
|
||||
-- Figure out what elements a particular file need in its item block,
|
||||
-- based on its build action and any related files in the project.
|
||||
--
|
||||
|
||||
function getelements(prj, action, fname)
|
||||
|
||||
if action == "Compile" and fname:endswith(".cs") then
|
||||
return "SubTypeCode"
|
||||
end
|
||||
|
||||
if action == "EmbeddedResource" and fname:endswith(".resx") then
|
||||
-- is there a matching *.cs file?
|
||||
local basename = fname:sub(1, -6)
|
||||
local testname = path.getname(basename .. ".cs")
|
||||
if premake.findfile(prj, testname) then
|
||||
return "Dependency", testname
|
||||
end
|
||||
end
|
||||
|
||||
return "None"
|
||||
end
|
||||
|
||||
-- end of preprocessing; template starts here --
|
||||
%>
|
||||
<VisualStudioProject>
|
||||
<CSHARP
|
||||
ProjectType = "Local"
|
||||
ProductVersion = "<%= iif(_ACTION == "vs2002", "7.0.9254", "7.10.3077") %>"
|
||||
SchemaVersion = "<%= iif(_ACTION == "vs2002", "1.0", "2.0") %>"
|
||||
ProjectGuid = "{<%= this.uuid %>}"
|
||||
>
|
||||
<Build>
|
||||
<Settings
|
||||
ApplicationIcon = ""
|
||||
AssemblyKeyContainerName = ""
|
||||
AssemblyName = "<%= this.buildtarget.basename %>"
|
||||
AssemblyOriginatorKeyFile = ""
|
||||
DefaultClientScript = "JScript"
|
||||
DefaultHTMLPageLayout = "Grid"
|
||||
DefaultTargetSchema = "IE50"
|
||||
DelaySign = "false"
|
||||
<% if _ACTION == "vs2002" then %>
|
||||
NoStandardLibraries = "false"
|
||||
<% end %>
|
||||
OutputType = "<%= csc.getkind(this) %>"
|
||||
<% if _ACTION == "vs2003" then %>
|
||||
PreBuildEvent = ""
|
||||
PostBuildEvent = ""
|
||||
<% end %>
|
||||
RootNamespace = "<%= this.buildtarget.basename %>"
|
||||
<% if _ACTION == "vs2003" then %>
|
||||
RunPostBuildEvent = "OnBuildSuccess"
|
||||
<% end %>
|
||||
StartupObject = ""
|
||||
>
|
||||
<% for cfg in premake.eachconfig(this) do %>
|
||||
<Config
|
||||
Name = "<%= premake.esc(cfg.name) %>"
|
||||
AllowUnsafeBlocks = "<%= iif(cfg.flags.Unsafe, "true", "false") %>"
|
||||
BaseAddress = "285212672"
|
||||
CheckForOverflowUnderflow = "false"
|
||||
ConfigurationOverrideFile = ""
|
||||
DefineConstants = "<%= premake.esc(table.concat(cfg.defines, ";")) %>"
|
||||
DocumentationFile = ""
|
||||
DebugSymbols = "<%= iif(cfg.flags.Symbols, "true", "false") %>"
|
||||
FileAlignment = "4096"
|
||||
IncrementalBuild = "false"
|
||||
<% if _ACTION == "vs2003" then %>
|
||||
NoStdLib = "false"
|
||||
NoWarn = ""
|
||||
<% end %>
|
||||
Optimize = "<%= iif(cfg.flags.Optimize or cfg.flags.OptimizeSize or cfg.flags.OptimizeSpeed, "true", "false") %>"
|
||||
OutputPath = "<%= premake.esc(cfg.buildtarget.directory) %>"
|
||||
RegisterForComInterop = "false"
|
||||
RemoveIntegerChecks = "false"
|
||||
TreatWarningsAsErrors = "<%= iif(cfg.flags.FatalWarnings, "true", "false") %>"
|
||||
WarningLevel = "4"
|
||||
/>
|
||||
<% end %>
|
||||
</Settings>
|
||||
<References>
|
||||
<% for _, prj in ipairs(premake.getlinks(this, "siblings", "object")) do %>
|
||||
<Reference
|
||||
Name = "<%= prj.buildtarget.basename %>"
|
||||
Project = "{<%= prj.uuid %>}"
|
||||
Package = "{<%= _VS.tool(prj) %>}"
|
||||
/>
|
||||
<% end %>
|
||||
<% for _, linkname in ipairs(premake.getlinks(this, "system", "fullpath")) do %>
|
||||
<Reference
|
||||
Name = "<%= path.getbasename(linkname) %>"
|
||||
AssemblyName = "<%= path.getname(linkname) %>"
|
||||
<% if path.getdirectory(linkname) ~= "." then %>
|
||||
HintPath = "<%= path.translate(linkname, "\\") %>"
|
||||
<% end %>
|
||||
/>
|
||||
<% end %>
|
||||
</References>
|
||||
</Build>
|
||||
<Files>
|
||||
<Include>
|
||||
<%
|
||||
for fcfg in premake.eachfile(this) do
|
||||
local action = csc.getbuildaction(fcfg)
|
||||
local fname = path.translate(premake.esc(fcfg.name), "\\")
|
||||
local elements, dependency = getelements(this, action, fcfg.name)
|
||||
%>
|
||||
<File
|
||||
RelPath = "<%= premake.esc(fname) %>"
|
||||
BuildAction = "<%= action %>"
|
||||
<% if dependency then %>
|
||||
DependentUpon = "<%= premake.esc(path.translate(dependency, "\\")) %>"
|
||||
<% end %>
|
||||
<% if elements == "SubTypeCode" then %>
|
||||
SubType = "Code"
|
||||
<% end %>
|
||||
/>
|
||||
<% end %>
|
||||
</Include>
|
||||
</Files>
|
||||
</CSHARP>
|
||||
</VisualStudioProject>
|
50
src/actions/vstudio/vs2002_csproj_user.lua
Normal file
50
src/actions/vstudio/vs2002_csproj_user.lua
Normal file
@ -0,0 +1,50 @@
|
||||
--
|
||||
-- vs2002_csproj_user.lua
|
||||
-- Generate a Visual Studio 2002/2003 C# .user file.
|
||||
-- Copyright (c) 2009 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
function premake.vs2002_csproj_user(prj)
|
||||
io.eol = "\r\n"
|
||||
|
||||
io.printf('<VisualStudioProject>')
|
||||
io.printf('\t<CSHARP>')
|
||||
io.printf('\t\t<Build>')
|
||||
|
||||
-- Visual Studio wants absolute paths
|
||||
local refpaths = table.translate(prj.libdirs, function(v) return path.getabsolute(prj.location .. "/" .. v) end)
|
||||
io.printf('\t\t\t<Settings ReferencePath = "%s">', path.translate(table.concat(refpaths, ";"), "\\"))
|
||||
|
||||
for cfg in premake.eachconfig(prj) do
|
||||
io.printf('\t\t\t\t<Config')
|
||||
io.printf('\t\t\t\t\tName = "%s"', premake.esc(cfg.name))
|
||||
io.printf('\t\t\t\t\tEnableASPDebugging = "false"')
|
||||
io.printf('\t\t\t\t\tEnableASPXDebugging = "false"')
|
||||
io.printf('\t\t\t\t\tEnableUnmanagedDebugging = "false"')
|
||||
io.printf('\t\t\t\t\tEnableSQLServerDebugging = "false"')
|
||||
io.printf('\t\t\t\t\tRemoteDebugEnabled = "false"')
|
||||
io.printf('\t\t\t\t\tRemoteDebugMachine = ""')
|
||||
io.printf('\t\t\t\t\tStartAction = "Project"')
|
||||
io.printf('\t\t\t\t\tStartArguments = ""')
|
||||
io.printf('\t\t\t\t\tStartPage = ""')
|
||||
io.printf('\t\t\t\t\tStartProgram = ""')
|
||||
io.printf('\t\t\t\t\tStartURL = ""')
|
||||
io.printf('\t\t\t\t\tStartWorkingDirectory = ""')
|
||||
io.printf('\t\t\t\t\tStartWithIE = "false"')
|
||||
io.printf('\t\t\t\t/>')
|
||||
end
|
||||
|
||||
io.printf('\t\t\t</Settings>')
|
||||
io.printf('\t\t</Build>')
|
||||
io.printf('\t\t<OtherProjectSettings')
|
||||
io.printf('\t\t\tCopyProjectDestinationFolder = ""')
|
||||
io.printf('\t\t\tCopyProjectUncPath = ""')
|
||||
io.printf('\t\t\tCopyProjectOption = "0"')
|
||||
io.printf('\t\t\tProjectView = "ProjectFiles"')
|
||||
io.printf('\t\t\tProjectTrust = "0"')
|
||||
io.printf('\t\t/>')
|
||||
|
||||
io.printf('\t</CSHARP>')
|
||||
io.printf('</VisualStudioProject>')
|
||||
|
||||
end
|
@ -1,37 +0,0 @@
|
||||
<%
|
||||
eol = "\r\n"
|
||||
local csc = premake.csc
|
||||
%>
|
||||
<VisualStudioProject>
|
||||
<CSHARP>
|
||||
<Build>
|
||||
<Settings ReferencePath = "<%= table.concat(table.translate(this.libdirs, function(v) return path.translate(path.getabsolute(this.location.."/"..v),"\\") end), ";") %>">
|
||||
<% for cfg in premake.eachconfig(this) do %>
|
||||
<Config
|
||||
Name = "<%= premake.esc(cfg.name) %>"
|
||||
EnableASPDebugging = "false"
|
||||
EnableASPXDebugging = "false"
|
||||
EnableUnmanagedDebugging = "false"
|
||||
EnableSQLServerDebugging = "false"
|
||||
RemoteDebugEnabled = "false"
|
||||
RemoteDebugMachine = ""
|
||||
StartAction = "Project"
|
||||
StartArguments = ""
|
||||
StartPage = ""
|
||||
StartProgram = ""
|
||||
StartURL = ""
|
||||
StartWorkingDirectory = ""
|
||||
StartWithIE = "false"
|
||||
/>
|
||||
<% end %>
|
||||
</Settings>
|
||||
</Build>
|
||||
<OtherProjectSettings
|
||||
CopyProjectDestinationFolder = ""
|
||||
CopyProjectUncPath = ""
|
||||
CopyProjectOption = "0"
|
||||
ProjectView = "ProjectFiles"
|
||||
ProjectTrust = "0"
|
||||
/>
|
||||
</CSHARP>
|
||||
</VisualStudioProject>
|
44
src/actions/vstudio/vs2002_solution.lua
Normal file
44
src/actions/vstudio/vs2002_solution.lua
Normal file
@ -0,0 +1,44 @@
|
||||
--
|
||||
-- vs2002_solution.lua
|
||||
-- Generate a Visual Studio 2002 solution.
|
||||
-- Copyright (c) 2009 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
function premake.vs2002_solution(sln)
|
||||
io.eol = '\r\n'
|
||||
|
||||
io.printf('Microsoft Visual Studio Solution File, Format Version 7.00')
|
||||
|
||||
-- Write out the list of project entries
|
||||
for prj in premake.eachproject(sln) do
|
||||
local projpath = path.translate(path.getrelative(sln.location, _VS.projectfile(prj)))
|
||||
io.printf('Project("{%s}") = "%s", "%s", "{%s}"', _VS.tool(prj), prj.name, projpath, prj.uuid)
|
||||
io.printf('EndProject')
|
||||
end
|
||||
|
||||
io.printf('Global')
|
||||
io.printf('\tGlobalSection(SolutionConfiguration) = preSolution')
|
||||
for i, cfgname in ipairs(sln.configurations) do
|
||||
io.printf('\t\tConfigName.%d = %s', i - 1, cfgname)
|
||||
end
|
||||
io.printf('\tEndGlobalSection')
|
||||
|
||||
io.printf('\tGlobalSection(ProjectDependencies) = postSolution')
|
||||
io.printf('\tEndGlobalSection')
|
||||
|
||||
io.printf('\tGlobalSection(ProjectConfiguration) = postSolution')
|
||||
for prj in premake.eachproject(sln) do
|
||||
for _, cfgname in ipairs(sln.configurations) do
|
||||
io.printf('\t\t{%s}.%s.ActiveCfg = %s|%s', prj.uuid, cfgname, cfgname, _VS.arch(prj))
|
||||
io.printf('\t\t{%s}.%s.Build.0 = %s|%s', prj.uuid, cfgname, cfgname, _VS.arch(prj))
|
||||
end
|
||||
end
|
||||
io.printf('\tEndGlobalSection')
|
||||
io.printf('\tGlobalSection(ExtensibilityGlobals) = postSolution')
|
||||
io.printf('\tEndGlobalSection')
|
||||
io.printf('\tGlobalSection(ExtensibilityAddIns) = postSolution')
|
||||
io.printf('\tEndGlobalSection')
|
||||
|
||||
io.printf('EndGlobal')
|
||||
end
|
||||
|
@ -1,34 +0,0 @@
|
||||
<% eol = "\r\n" %>
|
||||
Microsoft Visual Studio Solution File, Format Version 7.00
|
||||
<% for prj in premake.eachproject(this) do %>
|
||||
Project("{<%=_VS.tool(prj)%>}") = "<%=prj.name%>", "<%=path.translate(path.getrelative(this.location, _VS.projectfile(prj)))%>", "{<%=prj.uuid%>}"
|
||||
EndProject
|
||||
<% end %>
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
<% for i,cfgname in ipairs(this.configurations) do %>
|
||||
ConfigName.<%= i-1 %> = <%= cfgname %>
|
||||
<% end %>
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectDependencies) = postSolution
|
||||
<% for prj in premake.eachproject(this) do %>
|
||||
<% for i,dep in ipairs(premake.getdependencies(prj)) do %>
|
||||
{<%= prj.uuid %>}.<%= i - 1 %> = {<%= dep.uuid %>}
|
||||
<% end %>
|
||||
<% end %>
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectDependencies) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
<% for prj in premake.eachproject(this) do %>
|
||||
<% for i,cfgname in ipairs(this.configurations) do %>
|
||||
{<%=prj.uuid%>}.<%=cfgname%>.ActiveCfg = <%=cfgname%>|<%=_VS.arch(prj)%>
|
||||
{<%=prj.uuid%>}.<%=cfgname%>.Build.0 = <%=cfgname%>|<%=_VS.arch(prj)%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
54
src/actions/vstudio/vs2003_solution.lua
Normal file
54
src/actions/vstudio/vs2003_solution.lua
Normal file
@ -0,0 +1,54 @@
|
||||
--
|
||||
-- vs2003_solution.lua
|
||||
-- Generate a Visual Studio 2003 solution.
|
||||
-- Copyright (c) 2009 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
function premake.vs2003_solution(sln)
|
||||
io.eol = '\r\n'
|
||||
|
||||
io.printf('Microsoft Visual Studio Solution File, Format Version 8.00')
|
||||
|
||||
-- Write out the list of project entries
|
||||
for prj in premake.eachproject(sln) do
|
||||
local projpath = path.translate(path.getrelative(sln.location, _VS.projectfile(prj)))
|
||||
io.printf('Project("{%s}") = "%s", "%s", "{%s}"', _VS.tool(prj), prj.name, projpath, prj.uuid)
|
||||
|
||||
local deps = premake.getdependencies(prj)
|
||||
if #deps > 0 then
|
||||
io.printf('\tProjectSection(ProjectDependencies) = postProject')
|
||||
for _, dep in ipairs(deps) do
|
||||
io.printf('\t\t{%s} = {%s}', dep.uuid, dep.uuid)
|
||||
end
|
||||
io.printf('\tEndProjectSection')
|
||||
end
|
||||
|
||||
io.printf('EndProject')
|
||||
end
|
||||
|
||||
io.printf('Global')
|
||||
io.printf('\tGlobalSection(SolutionConfiguration) = preSolution')
|
||||
for _, cfgname in ipairs(sln.configurations) do
|
||||
io.printf('\t\t%s = %s', cfgname, cfgname)
|
||||
end
|
||||
io.printf('\tEndGlobalSection')
|
||||
|
||||
io.printf('\tGlobalSection(ProjectDependencies) = postSolution')
|
||||
io.printf('\tEndGlobalSection')
|
||||
|
||||
io.printf('\tGlobalSection(ProjectConfiguration) = postSolution')
|
||||
for prj in premake.eachproject(sln) do
|
||||
for _, cfgname in ipairs(sln.configurations) do
|
||||
io.printf('\t\t{%s}.%s.ActiveCfg = %s|%s', prj.uuid, cfgname, cfgname, _VS.arch(prj))
|
||||
io.printf('\t\t{%s}.%s.Build.0 = %s|%s', prj.uuid, cfgname, cfgname, _VS.arch(prj))
|
||||
end
|
||||
end
|
||||
io.printf('\tEndGlobalSection')
|
||||
|
||||
io.printf('\tGlobalSection(ExtensibilityGlobals) = postSolution')
|
||||
io.printf('\tEndGlobalSection')
|
||||
io.printf('\tGlobalSection(ExtensibilityAddIns) = postSolution')
|
||||
io.printf('\tEndGlobalSection')
|
||||
|
||||
io.printf('EndGlobal')
|
||||
end
|
@ -1,34 +0,0 @@
|
||||
<% eol = "\r\n" %>
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
<% for prj in premake.eachproject(this) do %>
|
||||
Project("{<%=_VS.tool(prj)%>}") = "<%=prj.name%>", "<%=path.translate(path.getrelative(this.location, _VS.projectfile(prj)))%>", "{<%=prj.uuid%>}"
|
||||
<% local deps = premake.getdependencies(prj); if #deps > 0 then %>
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
<% for _,dep in ipairs(deps) do %>
|
||||
{<%= dep.uuid %>} = {<%= dep.uuid %>}
|
||||
<% end %>
|
||||
EndProjectSection
|
||||
<% end %>
|
||||
EndProject
|
||||
<% end %>
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
<% for i,cfgname in ipairs(this.configurations) do %>
|
||||
<%= cfgname %> = <%= cfgname %>
|
||||
<% end %>
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectDependencies) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
<% for prj in premake.eachproject(this) do %>
|
||||
<% for i,cfgname in ipairs(this.configurations) do %>
|
||||
{<%=prj.uuid%>}.<%=cfgname%>.ActiveCfg = <%=cfgname%>|<%=_VS.arch(prj)%>
|
||||
{<%=prj.uuid%>}.<%=cfgname%>.Build.0 = <%=cfgname%>|<%=_VS.arch(prj)%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
168
src/actions/vstudio/vs2005_csproj.lua
Normal file
168
src/actions/vstudio/vs2005_csproj.lua
Normal file
@ -0,0 +1,168 @@
|
||||
--
|
||||
-- vs2005_csproj.lua
|
||||
-- Generate a Visual Studio 2005/2008 C# project.
|
||||
-- Copyright (c) 2009 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
--
|
||||
-- Figure out what elements a particular source code file need in its item
|
||||
-- block, based on its build action and any related files in the project.
|
||||
--
|
||||
|
||||
function getelements(prj, action, fname)
|
||||
|
||||
if action == "Compile" and fname:endswith(".cs") then
|
||||
if fname:endswith(".Designer.cs") then
|
||||
-- is there a matching *.cs file?
|
||||
local basename = fname:sub(1, -13)
|
||||
local testname = basename .. ".cs"
|
||||
if premake.findfile(prj, testname) then
|
||||
return "Dependency", testname
|
||||
end
|
||||
-- is there a matching *.resx file?
|
||||
testname = basename .. ".resx"
|
||||
if premake.findfile(prj, testname) then
|
||||
return "AutoGen", testname
|
||||
end
|
||||
else
|
||||
-- is there a *.Designer.cs file?
|
||||
local basename = fname:sub(1, -4)
|
||||
local testname = basename .. ".Designer.cs"
|
||||
if premake.findfile(prj, testname) then
|
||||
return "SubTypeForm"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if action == "EmbeddedResource" and fname:endswith(".resx") then
|
||||
-- is there a matching *.cs file?
|
||||
local basename = fname:sub(1, -6)
|
||||
local testname = path.getname(basename .. ".cs")
|
||||
if premake.findfile(prj, testname) then
|
||||
if premake.findfile(prj, basename .. ".Designer.cs") then
|
||||
return "DesignerType", testname
|
||||
else
|
||||
return "Dependency", testname
|
||||
end
|
||||
else
|
||||
-- is there a matching *.Designer.cs?
|
||||
testname = path.getname(basename .. ".Designer.cs")
|
||||
if premake.findfile(prj, testname) then
|
||||
return "AutoGenerated"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if action == "Content" then
|
||||
return "CopyNewest"
|
||||
end
|
||||
|
||||
return "None"
|
||||
end
|
||||
|
||||
|
||||
function premake.vs2005_csproj(prj)
|
||||
io.eol = "\r\n"
|
||||
|
||||
local vsversion, toolversion
|
||||
if _ACTION == "vs2005" then
|
||||
vsversion = "8.0.50727"
|
||||
toolversion = nil
|
||||
elseif _ACTION == "vs2008" then
|
||||
vsversion = "9.0.50727"
|
||||
toolversion = "3.5"
|
||||
end
|
||||
|
||||
if toolversion then
|
||||
io.printf('<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="%s">', toolversion)
|
||||
else
|
||||
io.printf('<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">')
|
||||
end
|
||||
|
||||
io.printf(' <PropertyGroup>')
|
||||
io.printf(' <Configuration Condition=" \'$(Configuration)\' == \'\' ">%s</Configuration>', premake.esc(prj.solution.configurations[1]))
|
||||
io.printf(' <Platform Condition=" \'$(Platform)\' == \'\' ">AnyCPU</Platform>')
|
||||
io.printf(' <ProductVersion>%s</ProductVersion>', vsversion)
|
||||
io.printf(' <SchemaVersion>2.0</SchemaVersion>')
|
||||
io.printf(' <ProjectGuid>{%s}</ProjectGuid>', prj.uuid)
|
||||
io.printf(' <OutputType>%s</OutputType>', premake.csc.getkind(prj))
|
||||
io.printf(' <AppDesignerFolder>Properties</AppDesignerFolder>')
|
||||
io.printf(' <RootNamespace>%s</RootNamespace>', prj.buildtarget.basename)
|
||||
io.printf(' <AssemblyName>%s</AssemblyName>', prj.buildtarget.basename)
|
||||
io.printf(' </PropertyGroup>')
|
||||
|
||||
for cfg in premake.eachconfig(prj) do
|
||||
io.printf(' <PropertyGroup Condition=" \'$(Configuration)|$(Platform)\' == \'%s|AnyCPU\' ">', premake.esc(cfg.name))
|
||||
if cfg.flags.Symbols then
|
||||
io.printf(' <DebugSymbols>true</DebugSymbols>')
|
||||
io.printf(' <DebugType>full</DebugType>')
|
||||
else
|
||||
io.printf(' <DebugType>pdbonly</DebugType>')
|
||||
end
|
||||
io.printf(' <Optimize>%s</Optimize>', iif(cfg.flags.Optimize or cfg.flags.OptimizeSize or cfg.flags.OptimizeSpeed, "true", "false"))
|
||||
io.printf(' <OutputPath>%s</OutputPath>', cfg.buildtarget.directory)
|
||||
io.printf(' <DefineConstants>%s</DefineConstants>', table.concat(premake.esc(cfg.defines), ";"))
|
||||
io.printf(' <ErrorReport>prompt</ErrorReport>')
|
||||
io.printf(' <WarningLevel>4</WarningLevel>')
|
||||
if cfg.flags.Unsafe then
|
||||
io.printf(' <AllowUnsafeBlocks>true</AllowUnsafeBlocks>')
|
||||
end
|
||||
if cfg.flags.FatalWarnings then
|
||||
io.printf(' <TreatWarningsAsErrors>true</TreatWarningsAsErrors>')
|
||||
end
|
||||
io.printf(' </PropertyGroup>')
|
||||
end
|
||||
|
||||
io.printf(' <ItemGroup>')
|
||||
for _, prj in ipairs(premake.getlinks(prj, "siblings", "object")) do
|
||||
io.printf(' <ProjectReference Include="%s">', path.translate(path.getrelative(prj.location, _VS.projectfile(prj)), "\\"))
|
||||
io.printf(' <Project>{%s}</Project>', prj.uuid)
|
||||
io.printf(' <Name>%s</Name>', premake.esc(prj.name))
|
||||
io.printf(' </ProjectReference>')
|
||||
end
|
||||
for _, linkname in ipairs(premake.getlinks(prj, "system", "basename")) do
|
||||
io.printf(' <Reference Include="%s" />', premake.esc(linkname))
|
||||
end
|
||||
io.printf(' </ItemGroup>')
|
||||
|
||||
io.printf(' <ItemGroup>')
|
||||
for fcfg in premake.eachfile(prj) do
|
||||
local action = premake.csc.getbuildaction(fcfg)
|
||||
local fname = path.translate(premake.esc(fcfg.name), "\\")
|
||||
local elements, dependency = getelements(prj, action, fcfg.name)
|
||||
if elements == "None" then
|
||||
io.printf(' <%s Include="%s" />', action, fname)
|
||||
else
|
||||
io.printf(' <%s Include="%s">', action, fname)
|
||||
if elements == "AutoGen" then
|
||||
io.printf(' <AutoGen>True</AutoGen>')
|
||||
elseif elements == "AutoGenerated" then
|
||||
io.printf(' <SubType>Designer</SubType>')
|
||||
io.printf(' <Generator>ResXFileCodeGenerator</Generator>')
|
||||
io.printf(' <LastGenOutput>%s.Designer.cs</LastGenOutput>', premake.esc(path.getbasename(fcfg.name)))
|
||||
elseif elements == "SubTypeDesigner" then
|
||||
io.printf(' <SubType>Designer</SubType>')
|
||||
elseif elements == "SubTypeForm" then
|
||||
io.printf(' <SubType>Form</SubType>')
|
||||
elseif elements == "PreserveNewest" then
|
||||
io.printf(' <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>')
|
||||
end
|
||||
if dependency then
|
||||
io.printf(' <DependentUpon>%s</DependentUpon>', path.translate(premake.esc(dependency), "\\"))
|
||||
end
|
||||
io.printf(' </%s>', action)
|
||||
end
|
||||
end
|
||||
io.printf(' </ItemGroup>')
|
||||
|
||||
io.printf(' <Import Project="$(MSBuildBinPath)\\Microsoft.CSharp.targets" />')
|
||||
io.printf(' <!-- To modify your build process, add your task inside one of the targets below and uncomment it.')
|
||||
io.printf(' Other similar extension points exist, see Microsoft.Common.targets.')
|
||||
io.printf(' <Target Name="BeforeBuild">')
|
||||
io.printf(' </Target>')
|
||||
io.printf(' <Target Name="AfterBuild">')
|
||||
io.printf(' </Target>')
|
||||
io.printf(' -->')
|
||||
io.printf('</Project>')
|
||||
end
|
||||
|
@ -1,164 +0,0 @@
|
||||
<%
|
||||
eol = "\r\n"
|
||||
local csc = premake.csc
|
||||
|
||||
-- translate the action to format and tool versions
|
||||
local vsversion, toolversion
|
||||
if _ACTION == "vs2005" then
|
||||
vsversion = "8.0.50727"
|
||||
toolversion = nil
|
||||
elseif _ACTION == "vs2008" then
|
||||
vsversion = "9.0.50727"
|
||||
toolversion = "3.5"
|
||||
end
|
||||
|
||||
--
|
||||
-- Figure out what elements a particular source code file need in its item
|
||||
-- block, based on its build action and any related files in the project.
|
||||
--
|
||||
|
||||
function getelements(prj, action, fname)
|
||||
|
||||
if action == "Compile" and fname:endswith(".cs") then
|
||||
if fname:endswith(".Designer.cs") then
|
||||
-- is there a matching *.cs file?
|
||||
local basename = fname:sub(1, -13)
|
||||
local testname = basename .. ".cs"
|
||||
if premake.findfile(prj, testname) then
|
||||
return "Dependency", testname
|
||||
end
|
||||
-- is there a matching *.resx file?
|
||||
testname = basename .. ".resx"
|
||||
if premake.findfile(prj, testname) then
|
||||
return "AutoGen", testname
|
||||
end
|
||||
else
|
||||
-- is there a *.Designer.cs file?
|
||||
local basename = fname:sub(1, -4)
|
||||
local testname = basename .. ".Designer.cs"
|
||||
if premake.findfile(prj, testname) then
|
||||
return "SubTypeForm"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if action == "EmbeddedResource" and fname:endswith(".resx") then
|
||||
-- is there a matching *.cs file?
|
||||
local basename = fname:sub(1, -6)
|
||||
local testname = path.getname(basename .. ".cs")
|
||||
if premake.findfile(prj, testname) then
|
||||
if premake.findfile(prj, basename .. ".Designer.cs") then
|
||||
return "DesignerType", testname
|
||||
else
|
||||
return "Dependency", testname
|
||||
end
|
||||
else
|
||||
-- is there a matching *.Designer.cs?
|
||||
testname = path.getname(basename .. ".Designer.cs")
|
||||
if premake.findfile(prj, testname) then
|
||||
return "AutoGenerated"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if action == "Content" then
|
||||
return "CopyNewest"
|
||||
end
|
||||
|
||||
return "None"
|
||||
end
|
||||
|
||||
-- end of preprocessing; template starts here --
|
||||
%>
|
||||
<% if toolversion then %>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="<%= toolversion %>">
|
||||
<% else %>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<% end %>
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' "><%= premake.esc(this.solution.configurations[1]) %></Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion><%= vsversion %></ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{<%= this.uuid %>}</ProjectGuid>
|
||||
<OutputType><%= csc.getkind(this) %></OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace><%= this.buildtarget.basename %></RootNamespace>
|
||||
<AssemblyName><%= this.buildtarget.basename %></AssemblyName>
|
||||
</PropertyGroup>
|
||||
<% for cfg in premake.eachconfig(this) do %>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == '<%= premake.esc(cfg.name) %>|AnyCPU' ">
|
||||
<% if cfg.flags.Symbols then %>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<% else %>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<% end %>
|
||||
<Optimize><%= iif(cfg.flags.Optimize or cfg.flags.OptimizeSize or cfg.flags.OptimizeSpeed, "true", "false") %></Optimize>
|
||||
<OutputPath><%= cfg.buildtarget.directory %></OutputPath>
|
||||
<DefineConstants><%= table.concat(premake.esc(cfg.defines), ";") %></DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<% if cfg.flags.Unsafe then %>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<% end %>
|
||||
<% if cfg.flags.FatalWarnings then %>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<% end %>
|
||||
</PropertyGroup>
|
||||
<% end %>
|
||||
<ItemGroup>
|
||||
<% for _, prj in ipairs(premake.getlinks(this, "siblings", "object")) do %>
|
||||
<ProjectReference Include="<%= path.translate(path.getrelative(this.location, _VS.projectfile(prj)), "\\") %>">
|
||||
<Project>{<%= prj.uuid %>}</Project>
|
||||
<Name><%= premake.esc(prj.name) %></Name>
|
||||
</ProjectReference>
|
||||
<% end %>
|
||||
<% for _, linkname in ipairs(premake.getlinks(this, "system", "basename")) do %>
|
||||
<Reference Include="<%= premake.esc(linkname) %>" />
|
||||
<% end %>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<%
|
||||
for fcfg in premake.eachfile(this) do
|
||||
local action = csc.getbuildaction(fcfg)
|
||||
local fname = path.translate(premake.esc(fcfg.name), "\\")
|
||||
local elements, dependency = getelements(this, action, fcfg.name)
|
||||
if elements == "None" then
|
||||
%>
|
||||
<<%= action %> Include="<%= fname %>" />
|
||||
<%
|
||||
else
|
||||
%>
|
||||
<<%= action %> Include="<%= fname %>">
|
||||
<% if elements == "AutoGen" then %>
|
||||
<AutoGen>True</AutoGen>
|
||||
<% elseif elements == "AutoGenerated" then %>
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput><%= premake.esc(path.getbasename(fcfg.name)) %>.Designer.cs</LastGenOutput>
|
||||
<% elseif elements == "SubTypeDesigner" then %>
|
||||
<SubType>Designer</SubType>
|
||||
<% elseif elements == "SubTypeForm" then %>
|
||||
<SubType>Form</SubType>
|
||||
<% elseif elements == "PreserveNewest" then %>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<% end %>
|
||||
<% if dependency then %>
|
||||
<DependentUpon><%= path.translate(premake.esc(dependency), "\\") %></DependentUpon>
|
||||
<% end %>
|
||||
</<%= action %>>
|
||||
<%
|
||||
end
|
||||
end
|
||||
%>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
18
src/actions/vstudio/vs2005_csproj_user.lua
Normal file
18
src/actions/vstudio/vs2005_csproj_user.lua
Normal file
@ -0,0 +1,18 @@
|
||||
--
|
||||
-- vs2005_csproj_user.lua
|
||||
-- Generate a Visual Studio 2005/2008 C# .user file.
|
||||
-- Copyright (c) 2009 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
function premake.vs2005_csproj_user(prj)
|
||||
io.eol = "\r\n"
|
||||
|
||||
io.printf('<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">')
|
||||
io.printf(' <PropertyGroup>')
|
||||
|
||||
local refpaths = table.translate(prj.libdirs, function(v) return path.getabsolute(prj.location .. "/" .. v) end)
|
||||
io.printf(' <ReferencePath>%s</ReferencePath>', path.translate(table.concat(refpaths, ";"), "\\"))
|
||||
io.printf(' </PropertyGroup>')
|
||||
io.printf('</Project>')
|
||||
|
||||
end
|
@ -1,6 +0,0 @@
|
||||
<% eol = "\r\n" %>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ReferencePath><%= table.concat(table.translate(this.libdirs, function(v) return path.translate(path.getabsolute(this.location.."/"..v),"\\") end), ";") %></ReferencePath>
|
||||
</PropertyGroup>
|
||||
</Project>
|
168
src/actions/vstudio/vs2005_solution.lua
Normal file
168
src/actions/vstudio/vs2005_solution.lua
Normal file
@ -0,0 +1,168 @@
|
||||
--
|
||||
-- vs2005_solution.lua
|
||||
-- Generate a Visual Studio 2005 or 2008 solution.
|
||||
-- Copyright (c) 2009 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
|
||||
function premake.vs2005_solution(sln)
|
||||
io.eol = '\r\n'
|
||||
|
||||
-- Mark the file as Unicode
|
||||
io.printf('\239\187\191')
|
||||
|
||||
-- Write the solution file version header
|
||||
if _ACTION == "vs2005" then
|
||||
io.printf('Microsoft Visual Studio Solution File, Format Version 9.00')
|
||||
io.printf('# Visual Studio 2005')
|
||||
else
|
||||
io.printf('Microsoft Visual Studio Solution File, Format Version 10.00')
|
||||
io.printf('# Visual Studio 2008')
|
||||
end
|
||||
|
||||
-- Write out the list of project entries
|
||||
for prj in premake.eachproject(sln) do
|
||||
-- Build a relative path from the solution file to the project file
|
||||
local projpath = path.translate(path.getrelative(sln.location, _VS.projectfile(prj)), "\\")
|
||||
|
||||
io.printf('Project("{%s}") = "%s", "%s", "{%s}"', _VS.tool(prj), prj.name, projpath, prj.uuid)
|
||||
local deps = premake.getdependencies(prj)
|
||||
if #deps > 0 then
|
||||
io.printf('\tProjectSection(ProjectDependencies) = postProject')
|
||||
for _, dep in ipairs(deps) do
|
||||
io.printf('\t\t{%s} = {%s}', dep.uuid, dep.uuid)
|
||||
end
|
||||
io.printf('\tEndProjectSection')
|
||||
end
|
||||
io.printf('EndProject')
|
||||
end
|
||||
|
||||
io.printf('Global')
|
||||
premake.vs2005_solution_configurations(sln)
|
||||
premake.vs2005_solution_project_configurations(sln)
|
||||
premake.vs2005_solution_properties(sln)
|
||||
io.printf('EndGlobal')
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Write out the contents of the SolutionConfigurationPlatforms section, which
|
||||
-- lists all of the configuration/platform pairs that exist in the solution.
|
||||
--
|
||||
|
||||
function premake.vs2005_solution_configurations(sln)
|
||||
local platforms = premake.vs2005_solution_platforms(sln)
|
||||
io.printf('\tGlobalSection(SolutionConfigurationPlatforms) = preSolution')
|
||||
|
||||
for _, cfgname in ipairs(sln.configurations) do
|
||||
for _, platname in ipairs(platforms) do
|
||||
io.printf('\t\t%s|%s = %s|%s', cfgname, platname, cfgname, platname)
|
||||
end
|
||||
end
|
||||
|
||||
io.printf('\tEndGlobalSection')
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Write out the contents of the ProjectConfigurationPlatforms section, which maps
|
||||
-- the configuration/platform pairs into each project of the solution.
|
||||
--
|
||||
|
||||
function premake.vs2005_solution_project_configurations(sln)
|
||||
local platforms = premake.vs2005_solution_platforms(sln)
|
||||
io.printf('\tGlobalSection(ProjectConfigurationPlatforms) = postSolution')
|
||||
|
||||
for prj in premake.eachproject(sln) do
|
||||
for _, cfgname in ipairs(sln.configurations) do
|
||||
for i, platname in ipairs(platforms) do
|
||||
local mappedname = premake.vs2005_map_platform(prj, platforms, i)
|
||||
io.printf('\t\t{%s}.%s|%s.ActiveCfg = %s|%s', prj.uuid, cfgname, platname, cfgname, mappedname)
|
||||
if (platname == mappedname or platname == "Mixed Platforms") then
|
||||
io.printf('\t\t{%s}.%s|%s.Build.0 = %s|%s', prj.uuid, cfgname, platname, cfgname, mappedname)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
io.printf('\tEndGlobalSection')
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Write out contents of the SolutionProperties section; current unused.
|
||||
--
|
||||
|
||||
function premake.vs2005_solution_properties(sln)
|
||||
io.printf('\tGlobalSection(SolutionProperties) = preSolution')
|
||||
io.printf('\t\tHideSolutionNode = FALSE')
|
||||
io.printf('\tEndGlobalSection')
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Translate the generic list of platforms into their Visual Studio equivalents.
|
||||
--
|
||||
|
||||
function premake.vs2005_solution_platforms(sln)
|
||||
-- see if I've already cached the list
|
||||
if sln.__vs2005_platforms then
|
||||
return sln.__vs2005_platforms
|
||||
end
|
||||
|
||||
local hascpp = premake.hascppproject(sln)
|
||||
local hasdotnet = premake.hasdotnetproject(sln)
|
||||
local result = { }
|
||||
|
||||
if hasdotnet then
|
||||
table.insert(result, "Any CPU")
|
||||
end
|
||||
|
||||
if hasdotnet and hascpp then
|
||||
table.insert(result, "Mixed Platforms")
|
||||
end
|
||||
|
||||
if hascpp then
|
||||
result._firstCppPlatform = #result + 1
|
||||
if sln.platforms then
|
||||
for _, pid in ipairs(sln.platforms) do
|
||||
if pid == "x32" then
|
||||
table.insert(result, "Win32")
|
||||
elseif pid == "x64" then
|
||||
table.insert(result, "x64")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- if no VS-compatible platforms were found, add a default
|
||||
if #result < result._firstCppPlatform then
|
||||
table.insert(result, "Win32")
|
||||
end
|
||||
end
|
||||
|
||||
-- cache the result; I need it pretty often
|
||||
sln.__vs2005_platforms = result
|
||||
return result
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Map a solution-level platform to one compatible with the provided project.
|
||||
-- C++ platforms are mapped to "Any CPU" for .NET projects, and vice versa.
|
||||
--
|
||||
|
||||
function premake.vs2005_map_platform(prj, platforms, i)
|
||||
-- .NET projects always use "Any CPU" platform (for now, at least)
|
||||
if premake.isdotnetproject(prj) then
|
||||
return "Any CPU"
|
||||
end
|
||||
|
||||
-- C++ projects use the current platform, or the first C++ platform
|
||||
-- if the current one is for .NET
|
||||
return platforms[math.max(i, platforms._firstCppPlatform)]
|
||||
end
|
@ -1,59 +0,0 @@
|
||||
<% eol = "\r\n" %>
|
||||
<%= "\239\187\191" %>
|
||||
<% local hascpp, hasdotnet %>
|
||||
<% if _ACTION == "vs2005" then %>
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
<% elseif _ACTION == "vs2008" then %>
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
<% end %>
|
||||
<% for prj in premake.eachproject(this) do %>
|
||||
<% if (prj.language == "C" or prj.language == "C++") then hascpp = true end %>
|
||||
<% if (prj.language == "C#") then hasdotnet = true end %>
|
||||
Project("{<%=_VS.tool(prj)%>}") = "<%=prj.name%>", "<%=path.translate(path.getrelative(this.location, _VS.projectfile(prj)),"\\")%>", "{<%=prj.uuid%>}"
|
||||
<% local deps = premake.getdependencies(prj); if #deps > 0 then %>
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
<% for _,dep in ipairs(deps) do %>
|
||||
{<%= dep.uuid %>} = {<%= dep.uuid %>}
|
||||
<% end %>
|
||||
EndProjectSection
|
||||
<% end %>
|
||||
EndProject
|
||||
<% end %>
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
<% for _, cfgname in ipairs(this.configurations) do %>
|
||||
<% if hasdotnet then %>
|
||||
<%= cfgname %>|Any CPU = <%= cfgname %>|Any CPU
|
||||
<% end; if hasdotnet and hascpp then %>
|
||||
<%= cfgname %>|Mixed Platforms = <%= cfgname %>|Mixed Platforms
|
||||
<% end; if hascpp then %>
|
||||
<%= cfgname %>|Win32 = <%= cfgname %>|Win32
|
||||
<% end %>
|
||||
<% end %>
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
<% for prj in premake.eachproject(this) do %>
|
||||
<% for _, cfgname in ipairs(this.configurations) do %>
|
||||
<% if hasdotnet then %>
|
||||
{<%= prj.uuid %>}.<%= cfgname %>|Any CPU.ActiveCfg = <%= cfgname %>|<%= _VS.arch(prj) %>
|
||||
<% if (prj.language ~= "C" and prj.language ~= "C++") then %>
|
||||
{<%= prj.uuid %>}.<%= cfgname %>|Any CPU.Build.0 = <%= cfgname %>|<%= _VS.arch(prj) %>
|
||||
<% end %>
|
||||
<% end; if (hasdotnet and hascpp) then %>
|
||||
{<%= prj.uuid %>}.<%= cfgname %>|Mixed Platforms.ActiveCfg = <%= cfgname %>|<%= _VS.arch(prj) %>
|
||||
{<%= prj.uuid %>}.<%= cfgname %>|Mixed Platforms.Build.0 = <%= cfgname %>|<%= _VS.arch(prj) %>
|
||||
<% end; if (hascpp) then %>
|
||||
{<%= prj.uuid %>}.<%= cfgname %>|Win32.ActiveCfg = <%= cfgname %>|<%= _VS.arch(prj) %>
|
||||
<% if (prj.language == "C" or prj.language == "C++") then %>
|
||||
{<%= prj.uuid %>}.<%= cfgname %>|Win32.Build.0 = <%= cfgname %>|<%= _VS.arch(prj) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
266
src/actions/vstudio/vs200x_vcproj.lua
Normal file
266
src/actions/vstudio/vs200x_vcproj.lua
Normal file
@ -0,0 +1,266 @@
|
||||
--
|
||||
-- vs200x_vcproj.lua
|
||||
-- Generate a Visual Studio 2002-2008 C/C++ project.
|
||||
-- Copyright (c) 2009 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
--
|
||||
-- Write out an empty tool block; there are quite a few of these.
|
||||
--
|
||||
local function printemptyblock(name)
|
||||
io.printf('\t\t\t<Tool')
|
||||
io.printf('\t\t\t\tName="%s"', name)
|
||||
io.printf('\t\t\t/>')
|
||||
end
|
||||
|
||||
|
||||
-- Write out a custom build steps block.
|
||||
local function buildstepsblock(name, steps)
|
||||
io.printf('\t\t\t<Tool')
|
||||
io.printf('\t\t\t\tName="%s"', name)
|
||||
if #steps > 0 then
|
||||
io.printf('\t\t\t\tCommandLine="%s"', premake.esc(table.implode(steps, "", "", "\r\n")))
|
||||
end
|
||||
io.printf('\t\t\t/>')
|
||||
end
|
||||
|
||||
|
||||
|
||||
function premake.vs200x_vcproj(prj)
|
||||
io.eol = "\r\n"
|
||||
io.printf('<?xml version="1.0" encoding="Windows-1252"?>')
|
||||
|
||||
-- Write opening project block
|
||||
io.printf('<VisualStudioProject')
|
||||
io.printf('\tProjectType="Visual C++"')
|
||||
if _ACTION == "vs2002" then
|
||||
io.printf('\tVersion="7.00"')
|
||||
elseif _ACTION == "vs2003" then
|
||||
io.printf('\tVersion="7.10"')
|
||||
elseif _ACTION == "vs2005" then
|
||||
io.printf('\tVersion="8.00"')
|
||||
elseif _ACTION == "vs2008" then
|
||||
io.printf('\tVersion="9.00"')
|
||||
end
|
||||
io.printf('\tName="%s"', premake.esc(prj.name))
|
||||
io.printf('\tProjectGUID="{%s}"', prj.uuid)
|
||||
if _ACTION > "vs2003" then
|
||||
io.printf('\tRootNamespace="%s"', prj.name)
|
||||
end
|
||||
io.printf('\tKeyword="%s"', iif(prj.flags.Managed, "ManagedCProj", "Win32Proj"))
|
||||
io.printf('\t>')
|
||||
|
||||
premake.vs200x_vcproj_platforms(prj)
|
||||
|
||||
if _ACTION > "vs2003" then
|
||||
io.printf('\t<ToolFiles>')
|
||||
io.printf('\t</ToolFiles>')
|
||||
end
|
||||
|
||||
io.printf('\t<Configurations>')
|
||||
|
||||
local platforms = premake.vs2005_solution_platforms(prj.solution)
|
||||
for i = platforms._firstCppPlatform, #platforms do
|
||||
local platform = platforms[i]
|
||||
|
||||
for cfg in premake.eachconfig(prj) do
|
||||
-- Start a configuration
|
||||
io.printf('\t\t<Configuration')
|
||||
io.printf('\t\t\tName="%s|%s"', premake.esc(cfg.name), platform)
|
||||
io.printf('\t\t\tOutputDirectory="%s"', premake.esc(cfg.buildtarget.directory))
|
||||
io.printf('\t\t\tIntermediateDirectory="%s"', premake.esc(cfg.objectsdir))
|
||||
io.printf('\t\t\tConfigurationType="%s"', _VS.cfgtype(cfg))
|
||||
io.printf('\t\t\tCharacterSet="%s"', iif(cfg.flags.Unicode, 1, 2))
|
||||
if cfg.flags.Managed then
|
||||
io.printf('\t\t\tManagedExtensions="true"')
|
||||
end
|
||||
io.printf('\t\t\t>')
|
||||
|
||||
for _, block in ipairs(_VS[_ACTION]) do
|
||||
|
||||
-- Compiler block --
|
||||
if block == "VCCLCompilerTool" then
|
||||
io.printf('\t\t\t<Tool')
|
||||
io.printf('\t\t\t\tName="VCCLCompilerTool"')
|
||||
if #cfg.buildoptions > 0 then
|
||||
io.printf('\t\t\t\tAdditionalOptions="%s"', table.concat(premake.esc(cfg.buildoptions), " "))
|
||||
end
|
||||
io.printf('\t\t\t\tOptimization="%s"', _VS.optimization(cfg))
|
||||
if cfg.flags.NoFramePointer then
|
||||
io.printf('\t\t\t\tOmitFramePointers="%s"', _VS.bool(true))
|
||||
end
|
||||
if #cfg.includedirs > 0 then
|
||||
io.printf('\t\t\t\tAdditionalIncludeDirectories="%s"', table.concat(premake.esc(cfg.includedirs), ";"))
|
||||
end
|
||||
if #cfg.defines > 0 then
|
||||
io.printf('\t\t\t\tPreprocessorDefinitions="%s"', table.concat(premake.esc(cfg.defines), ";"))
|
||||
end
|
||||
if cfg.flags.Symbols and not cfg.flags.Managed then
|
||||
io.printf('\t\t\t\tMinimalRebuild="%s"', _VS.bool(true))
|
||||
end
|
||||
if cfg.flags.NoExceptions then
|
||||
io.printf('\t\t\t\tExceptionHandling="%s"', iif(_ACTION < "vs2005", "FALSE", 0))
|
||||
elseif cfg.flags.SEH and _ACTION > "vs2003" then
|
||||
io.printf('\t\t\t\tExceptionHandling="2"')
|
||||
end
|
||||
if _VS.optimization(cfg) == 0 and not cfg.flags.Managed then
|
||||
io.printf('\t\t\t\tBasicRuntimeChecks="3"')
|
||||
end
|
||||
if _VS.optimization(cfg) ~= 0 then
|
||||
io.printf('\t\t\t\tStringPooling="%s"', _VS.bool(true))
|
||||
end
|
||||
io.printf('\t\t\t\tRuntimeLibrary="%s"', _VS.runtime(cfg))
|
||||
io.printf('\t\t\t\tEnableFunctionLevelLinking="%s"', _VS.bool(true))
|
||||
if _ACTION < "vs2005" and not cfg.flags.NoRTTI then
|
||||
io.printf('\t\t\t\tRuntimeTypeInfo="%s"', _VS.bool(true))
|
||||
elseif _ACTION > "vs2003" and cfg.flags.NoRTTI then
|
||||
io.printf('\t\t\t\tRuntimeTypeInfo="%s"', _VS.bool(false))
|
||||
end
|
||||
if cfg.flags.NativeWChar then
|
||||
io.printf('\t\t\t\tTreatWChar_tAsBuiltInType="%s"', _VS.bool(true))
|
||||
elseif cfg.flags.NoNativeWChar then
|
||||
io.printf('\t\t\t\tTreatWChar_tAsBuiltInType="%s"', _VS.bool(false))
|
||||
end
|
||||
if not cfg.flags.NoPCH and cfg.pchheader then
|
||||
io.printf('\t\t\t\tUsePrecompiledHeader="%s"', iif(_ACTION < "vs2005", 3, 2))
|
||||
io.printf('\t\t\t\tPrecompiledHeaderThrough="%s"', cfg.pchheader)
|
||||
else
|
||||
io.printf('\t\t\t\tUsePrecompiledHeader="%s"', iif(_ACTION > "vs2003" or cfg.flags.NoPCH, 0, 2))
|
||||
end
|
||||
io.printf('\t\t\t\tWarningLevel="%s"', iif(cfg.flags.ExtraWarnings, 4, 3))
|
||||
if cfg.flags.FatalWarnings then
|
||||
io.printf('\t\t\t\tWarnAsError="%s"', _VS.bool(true))
|
||||
end
|
||||
if _ACTION < "vs2008" and not cfg.flags.Managed then
|
||||
io.printf('\t\t\t\tDetect64BitPortabilityProblems="%s"', _VS.bool(not cfg.flags.No64BitChecks))
|
||||
end
|
||||
io.printf('\t\t\t\tProgramDataBaseFileName="$(OutDir)\\$(ProjectName).pdb"')
|
||||
io.printf('\t\t\t\tDebugInformationFormat="%s"', _VS.symbols(cfg))
|
||||
io.printf('\t\t\t/>')
|
||||
-- End compiler block --
|
||||
|
||||
-- Linker block --
|
||||
elseif block == "VCLinkerTool" then
|
||||
io.printf('\t\t\t<Tool')
|
||||
if cfg.kind ~= "StaticLib" then
|
||||
io.printf('\t\t\t\tName="VCLinkerTool"')
|
||||
if cfg.flags.NoImportLib then
|
||||
io.printf('\t\t\t\tIgnoreImportLibrary="%s"', _VS.bool(true))
|
||||
end
|
||||
if #cfg.linkoptions > 0 then
|
||||
io.printf('\t\t\t\tAdditionalOptions="%s"', table.concat(premake.esc(cfg.linkoptions), " "))
|
||||
end
|
||||
if #cfg.links > 0 then
|
||||
io.printf('\t\t\t\tAdditionalDependencies="%s"', table.concat(premake.getlinks(cfg, "all", "fullpath"), " "))
|
||||
end
|
||||
io.printf('\t\t\t\tOutputFile="$(OutDir)\\%s"', cfg.buildtarget.name)
|
||||
io.printf('\t\t\t\tLinkIncremental="%s"', iif(_VS.optimization(cfg) == 0, 2, 1))
|
||||
io.printf('\t\t\t\tAdditionalLibraryDirectories="%s"', table.concat(premake.esc(path.translate(cfg.libdirs)) , ";"))
|
||||
local deffile = premake.findfile(cfg, ".def")
|
||||
if deffile then
|
||||
io.printf('\t\t\t\tModuleDefinitionFile="%s"', deffile)
|
||||
end
|
||||
if cfg.flags.NoManifest then
|
||||
io.printf('\t\t\t\tGenerateManifest="%s"', _VS.bool(false))
|
||||
end
|
||||
io.printf('\t\t\t\tGenerateDebugInformation="%s"', _VS.bool(_VS.symbols(cfg) ~= 0))
|
||||
if _VS.symbols(cfg) ~= 0 then
|
||||
io.printf('\t\t\t\tProgramDatabaseFile="$(OutDir)\\$(ProjectName).pdb"')
|
||||
end
|
||||
io.printf('\t\t\t\tSubSystem="%s"', iif(cfg.kind == "ConsoleApp", 1, 2))
|
||||
if _VS.optimization(cfg) ~= 0 then
|
||||
io.printf('\t\t\t\tOptimizeReferences="2"')
|
||||
io.printf('\t\t\t\tEnableCOMDATFolding="2"')
|
||||
end
|
||||
if (cfg.kind == "ConsoleApp" or cfg.kind == "WindowedApp") and not cfg.flags.WinMain then
|
||||
io.printf('\t\t\t\tEntryPointSymbol="mainCRTStartup"')
|
||||
end
|
||||
if cfg.kind == "SharedLib" then
|
||||
local implibname = path.translate(premake.gettarget(cfg, "link", "windows").fullpath, "\\")
|
||||
io.printf('\t\t\t\tImportLibrary="%s"', iif(cfg.flags.NoImportLib, cfg.objectsdir .. "\\" .. path.getname(implibname), implibname))
|
||||
end
|
||||
io.printf('\t\t\t\tTargetMachine="1"')
|
||||
else
|
||||
io.printf('\t\t\t\tName="VCLibrarianTool"')
|
||||
if #cfg.links > 0 then
|
||||
io.printf('\t\t\t\tAdditionalDependencies="%s"', table.concat(premake.getlinks(cfg, "all", "fullpath"), " "))
|
||||
end
|
||||
io.printf('\t\t\t\tOutputFile="$(OutDir)\\%s"', cfg.buildtarget.name)
|
||||
io.printf('\t\t\t\tAdditionalLibraryDirectories="%s"', table.concat(premake.esc(path.translate(cfg.libdirs)) , ";"))
|
||||
end
|
||||
io.printf('\t\t\t/>')
|
||||
-- End linker block --
|
||||
|
||||
-- Resource compiler --
|
||||
elseif block == "VCResourceCompilerTool" then
|
||||
io.printf('\t\t\t<Tool')
|
||||
io.printf('\t\t\t\tName="VCResourceCompilerTool"')
|
||||
if #cfg.resoptions > 0 then
|
||||
io.printf('\t\t\t\tAdditionalOptions="%s"', table.concat(premake.esc(cfg.resoptions), " "))
|
||||
end
|
||||
if #cfg.defines > 0 or #cfg.resdefines > 0 then
|
||||
io.printf('\t\t\t\tPreprocessorDefinitions="%s"', table.concat(premake.esc(table.join(cfg.defines, cfg.resdefines)), ";"))
|
||||
end
|
||||
if #cfg.includedirs > 0 or #cfg.resincludedirs > 0 then
|
||||
io.printf('\t\t\t\tAdditionalIncludeDirectories="%s"', table.concat(premake.esc(table.join(cfg.includedirs, cfg.resincludedirs)), ";"))
|
||||
end
|
||||
io.printf('\t\t\t/>')
|
||||
-- End resource compiler --
|
||||
|
||||
-- Build event blocks --
|
||||
elseif block == "VCPreBuildEventTool" then
|
||||
buildstepsblock("VCPreBuildEventTool", cfg.prebuildcommands)
|
||||
elseif block == "VCPreLinkEventTool" then
|
||||
buildstepsblock("VCPreLinkEventTool", cfg.prelinkcommands)
|
||||
elseif block == "VCPostBuildEventTool" then
|
||||
buildstepsblock("VCPostBuildEventTool", cfg.postbuildcommands)
|
||||
-- End build event blocks --
|
||||
|
||||
else
|
||||
printemptyblock(block)
|
||||
end
|
||||
end
|
||||
io.printf('\t\t</Configuration>')
|
||||
end
|
||||
end
|
||||
io.printf('\t</Configurations>')
|
||||
|
||||
io.printf('\t<References>')
|
||||
io.printf('\t</References>')
|
||||
|
||||
io.printf('\t<Files>')
|
||||
premake.walksources(prj, prj.files, _VS.files)
|
||||
io.printf('\t</Files>')
|
||||
|
||||
io.printf('\t<Globals>')
|
||||
io.printf('\t</Globals>')
|
||||
io.printf('</VisualStudioProject>')
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Write out the platforms block, listing all of the platforms targeted in the project.
|
||||
--
|
||||
|
||||
function premake.vs200x_vcproj_platforms(prj)
|
||||
io.printf('\t<Platforms>')
|
||||
|
||||
-- I haven't implement platforms for VS2002/2003 yet
|
||||
if _ACTION < "vs2005" then
|
||||
io.printf('\t\t<Platform')
|
||||
io.printf('\t\t\tName="Win32"')
|
||||
io.printf('\t\t/>')
|
||||
else
|
||||
-- only list C/C++ platforms; skip the generic .NET ones
|
||||
local platforms = premake.vs2005_solution_platforms(prj.solution)
|
||||
for i = platforms._firstCppPlatform, #platforms do
|
||||
io.printf('\t\t<Platform')
|
||||
io.printf('\t\t\tName="%s"', platforms[i])
|
||||
io.printf('\t\t/>')
|
||||
end
|
||||
end
|
||||
|
||||
io.printf('\t</Platforms>')
|
||||
end
|
||||
|
||||
|
@ -1,250 +0,0 @@
|
||||
<% eol = "\r\n" %>
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
<% if _ACTION == "vs2002" then %>
|
||||
Version="7.00"
|
||||
<% elseif _ACTION == "vs2003" then %>
|
||||
Version="7.10"
|
||||
<% elseif _ACTION == "vs2005" then %>
|
||||
Version="8.00"
|
||||
<% elseif _ACTION == "vs2008" then %>
|
||||
Version="9.00"
|
||||
<% end %>
|
||||
Name="<%= premake.esc(this.name) %>"
|
||||
ProjectGUID="{<%= this.uuid %>}"
|
||||
<% if _ACTION > "vs2003" then %>
|
||||
RootNamespace="<%= this.name %>"
|
||||
<% end %>
|
||||
Keyword="<%= iif(this.flags.Managed, "ManagedCProj", "Win32Proj") %>"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<% if _ACTION > "vs2003" then %>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<% end %>
|
||||
<Configurations>
|
||||
<% for cfg in premake.eachconfig(this) do %>
|
||||
<Configuration
|
||||
Name="<%= premake.esc(cfg.name) %>|Win32"
|
||||
OutputDirectory="<%= premake.esc(cfg.buildtarget.directory) %>"
|
||||
IntermediateDirectory="<%= premake.esc(cfg.objectsdir) %>"
|
||||
ConfigurationType="<%= _VS.cfgtype(cfg) %>"
|
||||
CharacterSet="<%= iif(cfg.flags.Unicode, 1, 2) %>"
|
||||
<% if cfg.flags.Managed then %>
|
||||
ManagedExtensions="true"
|
||||
<% end %>
|
||||
>
|
||||
<% for _,block in ipairs(_VS[_ACTION]) do %>
|
||||
<% if (block == "VCALinkTool") then %>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<% elseif (block == "VCAppVerifierTool") then %>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<% elseif (block == "VCAuxiliaryManagedWrapperGeneratorTool") then %>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"
|
||||
/>
|
||||
<% elseif (block == "VCBscMakeTool") then %>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<% elseif (block == "VCCLCompilerTool") then %>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
<% if #cfg.buildoptions > 0 then %>
|
||||
AdditionalOptions="<%= table.concat(premake.esc(cfg.buildoptions), " ") %>"
|
||||
<% end %>
|
||||
Optimization="<%= _VS.optimization(cfg) %>"
|
||||
<% if cfg.flags.NoFramePointer then %>
|
||||
OmitFramePointers="<%= _VS.bool(true) %>"
|
||||
<% end %>
|
||||
<% if #cfg.includedirs > 0 then %>
|
||||
AdditionalIncludeDirectories="<%= table.concat(premake.esc(cfg.includedirs), ";") %>"
|
||||
<% end %>
|
||||
<% if #cfg.defines > 0 then %>
|
||||
PreprocessorDefinitions="<%= table.concat(premake.esc(cfg.defines), ";") %>"
|
||||
<% end %>
|
||||
<% if cfg.flags.Symbols and not cfg.flags.Managed then %>
|
||||
MinimalRebuild="<%= _VS.bool(true) %>"
|
||||
<% end %>
|
||||
<% if cfg.flags.NoExceptions then %>
|
||||
ExceptionHandling="<%= iif(_ACTION < "vs2005", "FALSE", 0) %>"
|
||||
<% elseif cfg.flags.SEH and _ACTION > "vs2003" then %>
|
||||
ExceptionHandling="2"
|
||||
<% end %>
|
||||
<% if _VS.optimization(cfg) == 0 and not cfg.flags.Managed then %>
|
||||
BasicRuntimeChecks="3"
|
||||
<% end %>
|
||||
<% if _VS.optimization(cfg) ~= 0 then %>
|
||||
StringPooling="<%= _VS.bool(true) %>"
|
||||
<% end %>
|
||||
RuntimeLibrary="<%= _VS.runtime(cfg) %>"
|
||||
EnableFunctionLevelLinking="<%= _VS.bool(true) %>"
|
||||
<% if _ACTION < "vs2005" and not cfg.flags.NoRTTI then %>
|
||||
RuntimeTypeInfo="<%= _VS.bool(true) %>"
|
||||
<% elseif _ACTION > "vs2003" and cfg.flags.NoRTTI then %>
|
||||
RuntimeTypeInfo="<%= _VS.bool(false) %>"
|
||||
<% end %>
|
||||
<% if cfg.flags.NativeWChar then %>
|
||||
TreatWChar_tAsBuiltInType="<%= _VS.bool(true) %>"
|
||||
<% elseif cfg.flags.NoNativeWChar then %>
|
||||
TreatWChar_tAsBuiltInType="<%= _VS.bool(false) %>"
|
||||
<% end %>
|
||||
<% if not cfg.flags.NoPCH and cfg.pchheader then %>
|
||||
UsePrecompiledHeader="<%= iif(_ACTION < "vs2005", 3, 2) %>"
|
||||
PrecompiledHeaderThrough="<%= cfg.pchheader %>"
|
||||
<% else %>
|
||||
UsePrecompiledHeader="<%= iif(_ACTION > "vs2003" or cfg.flags.NoPCH, 0, 2) %>"
|
||||
<% end %>
|
||||
WarningLevel="<%= iif(cfg.flags.ExtraWarnings, 4, 3) %>"
|
||||
<% if cfg.flags.FatalWarnings then %>
|
||||
WarnAsError="<%= _VS.bool(true) %>"
|
||||
<% end %>
|
||||
<% if _ACTION < "vs2008" and not cfg.flags.Managed then %>
|
||||
Detect64BitPortabilityProblems="<%= _VS.bool(not cfg.flags.No64BitChecks) %>"
|
||||
<% end %>
|
||||
ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
|
||||
DebugInformationFormat="<%= _VS.symbols(cfg) %>"
|
||||
/>
|
||||
<% elseif (block == "VCCustomBuildTool") then %>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<% elseif (block == "VCFxCopTool") then %>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<% elseif (block == "VCLinkerTool") then %>
|
||||
<Tool
|
||||
<% if cfg.kind ~= "StaticLib" then %>
|
||||
Name="VCLinkerTool"
|
||||
<% if cfg.flags.NoImportLib then %>
|
||||
IgnoreImportLibrary="<%= _VS.bool(true) %>"
|
||||
<% end %>
|
||||
<% if #cfg.linkoptions > 0 then %>
|
||||
AdditionalOptions="<%= table.concat(premake.esc(cfg.linkoptions), " ") %>"
|
||||
<% end %>
|
||||
<% if #cfg.links > 0 then %>
|
||||
AdditionalDependencies="<%= table.concat(premake.getlinks(cfg, "all", "fullpath"), " ") %>"
|
||||
<% end %>
|
||||
OutputFile="$(OutDir)\<%= cfg.buildtarget.name %>"
|
||||
LinkIncremental="<%= iif(_VS.optimization(cfg) == 0, 2, 1) %>"
|
||||
AdditionalLibraryDirectories="<%= table.concat(premake.esc(path.translate(cfg.libdirs)) , ";") %>"
|
||||
<% local deffile = premake.findfile(cfg, ".def"); if deffile then %>
|
||||
ModuleDefinitionFile="<%= deffile %>"
|
||||
<% end %>
|
||||
<% if cfg.flags.NoManifest then %>
|
||||
GenerateManifest="<%= _VS.bool(false) %>"
|
||||
<% end %>
|
||||
GenerateDebugInformation="<%= _VS.bool(_VS.symbols(cfg) ~= 0) %>"
|
||||
<% if _VS.symbols(cfg) ~= 0 then %>
|
||||
ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb"
|
||||
<% end %>
|
||||
SubSystem="<%= iif(cfg.kind == "ConsoleApp", 1, 2) %>"
|
||||
<% if _VS.optimization(cfg) ~= 0 then %>
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
<% end %>
|
||||
<% if (cfg.kind == "ConsoleApp" or cfg.kind == "WindowedApp") and not cfg.flags.WinMain then %>
|
||||
EntryPointSymbol="mainCRTStartup"
|
||||
<% end %>
|
||||
<% if cfg.kind == "SharedLib" then %>
|
||||
<% local implibname = path.translate(premake.gettarget(cfg, "link", "windows").fullpath, "\\") %>
|
||||
ImportLibrary="<%= iif(cfg.flags.NoImportLib, cfg.objectsdir.."\\"..path.getname(implibname), implibname) %>"
|
||||
<% end %>
|
||||
TargetMachine="1"
|
||||
<% else %>
|
||||
Name="VCLibrarianTool"
|
||||
<% if #cfg.links > 0 then %>
|
||||
AdditionalDependencies="<%= table.concat(premake.getlinks(cfg, "all", "fullpath"), " ") %>"
|
||||
<% end %>
|
||||
OutputFile="$(OutDir)\<%= cfg.buildtarget.name %>"
|
||||
AdditionalLibraryDirectories="<%= table.concat(premake.esc(path.translate(cfg.libdirs)) , ";") %>"
|
||||
<% end %>
|
||||
/>
|
||||
<% elseif (block == "VCManagedResourceCompilerTool") then %>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<% elseif (block == "VCManagedWrapperGeneratorTool") then %>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"
|
||||
/>
|
||||
<% elseif (block == "VCManifestTool") then %>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<% elseif (block == "VCMIDLTool") then %>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<% elseif (block == "VCPreBuildEventTool") then %>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
<% if #cfg.prebuildcommands > 0 then %>
|
||||
CommandLine="<%= premake.esc(table.implode(cfg.prebuildcommands, "", "", "\r\n")) %>"
|
||||
<% end %>
|
||||
/>
|
||||
<% elseif (block == "VCPreLinkEventTool") then %>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
<% if #cfg.prelinkcommands > 0 then %>
|
||||
CommandLine="<%= premake.esc(table.implode(cfg.prelinkcommands, "", "", "\r\n")) %>"
|
||||
<% end %>
|
||||
/>
|
||||
<% elseif (block == "VCPostBuildEventTool") then %>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
<% if #cfg.postbuildcommands > 0 then %>
|
||||
CommandLine="<%= premake.esc(table.implode(cfg.postbuildcommands, "", "", "\r\n")) %>"
|
||||
<% end %>
|
||||
/>
|
||||
<% elseif (block == "VCResourceCompilerTool") then %>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
<% if #cfg.resoptions > 0 then %>
|
||||
AdditionalOptions="<%= table.concat(premake.esc(cfg.resoptions), " ") %>"
|
||||
<% end %>
|
||||
<% if #cfg.defines > 0 or #cfg.resdefines > 0 then %>
|
||||
PreprocessorDefinitions="<%= table.concat(premake.esc(table.join(cfg.defines, cfg.resdefines)), ";") %>"
|
||||
<% end %>
|
||||
<% if #cfg.includedirs > 0 or #cfg.resincludedirs > 0 then %>
|
||||
AdditionalIncludeDirectories="<%= table.concat(premake.esc(table.join(cfg.includedirs, cfg.resincludedirs)), ";") %>"
|
||||
<% end %>
|
||||
/>
|
||||
<% elseif (block == "VCWebDeploymentTool") then %>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<% elseif (block == "VCWebServiceProxyGeneratorTool") then %>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<% elseif (block == "VCXDCMakeTool") then %>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<% elseif (block == "VCXMLDataGeneratorTool") then %>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</Configuration>
|
||||
<% end %>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<% premake.walksources(this, this.files, _VS.files) %>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
@ -193,6 +193,19 @@
|
||||
kind = "path",
|
||||
scope = "config",
|
||||
},
|
||||
|
||||
platforms =
|
||||
{
|
||||
kind = "list",
|
||||
scope = "solution",
|
||||
allowed = {
|
||||
"x32",
|
||||
"x64",
|
||||
"ppc",
|
||||
"ppc64",
|
||||
"xbox360"
|
||||
}
|
||||
},
|
||||
|
||||
postbuildcommands =
|
||||
{
|
||||
|
@ -88,27 +88,6 @@
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Open an overload of the io.open() function, which will create any missing
|
||||
-- subdirectories in the filename if "mode" is set to writeable.
|
||||
--
|
||||
|
||||
local builtin_open = io.open
|
||||
function io.open(fname, mode)
|
||||
if (mode) then
|
||||
if (mode:find("w")) then
|
||||
local dir = path.getdirectory(fname)
|
||||
ok, err = os.mkdir(dir)
|
||||
if (not ok) then
|
||||
error(err, 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
return builtin_open(fname, mode)
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- A shortcut for printing formatted output.
|
||||
--
|
||||
@ -116,9 +95,9 @@
|
||||
function printf(msg, ...)
|
||||
print(string.format(msg, unpack(arg)))
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- An extension to type() to identify project object types by reading the
|
||||
-- "__type" field from the metatable.
|
||||
|
67
src/base/io.lua
Normal file
67
src/base/io.lua
Normal file
@ -0,0 +1,67 @@
|
||||
--
|
||||
-- io.lua
|
||||
-- Additions to the I/O namespace.
|
||||
-- Copyright (c) 2008-2009 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
|
||||
--
|
||||
-- Prepare to capture the output from all subsequent calls to io.printf(),
|
||||
-- used for automated testing of the generators.
|
||||
--
|
||||
|
||||
function io.capture()
|
||||
io.captured = ''
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Returns the captured text and stops capturing.
|
||||
--
|
||||
|
||||
function io.endcapture()
|
||||
local captured = io.captured
|
||||
io.captured = nil
|
||||
return captured
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Open an overload of the io.open() function, which will create any missing
|
||||
-- subdirectories in the filename if "mode" is set to writeable.
|
||||
--
|
||||
|
||||
local builtin_open = io.open
|
||||
function io.open(fname, mode)
|
||||
if (mode) then
|
||||
if (mode:find("w")) then
|
||||
local dir = path.getdirectory(fname)
|
||||
ok, err = os.mkdir(dir)
|
||||
if (not ok) then
|
||||
error(err, 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
return builtin_open(fname, mode)
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- A shortcut for printing formatted output to an output stream.
|
||||
--
|
||||
|
||||
function io.printf(msg, ...)
|
||||
if (not io.eol) then
|
||||
io.eol = "\n"
|
||||
end
|
||||
|
||||
local s = string.format(msg, unpack(arg))
|
||||
if io.captured then
|
||||
io.captured = io.captured .. s .. io.eol
|
||||
else
|
||||
io.write(s)
|
||||
io.write(io.eol)
|
||||
end
|
||||
end
|
@ -313,7 +313,55 @@
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Returns true if the solution contains at least one C/C++ project.
|
||||
--
|
||||
|
||||
function premake.hascppproject(sln)
|
||||
for prj in premake.eachproject(sln) do
|
||||
if premake.iscppproject(prj) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Returns true if the solution contains at least one .NET project.
|
||||
--
|
||||
|
||||
function premake.hasdotnetproject(sln)
|
||||
for prj in premake.eachproject(sln) do
|
||||
if premake.isdotnetproject(prj) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Returns true if the project uses a C/C++ language.
|
||||
--
|
||||
|
||||
function premake.iscppproject(prj)
|
||||
return (prj.language == "C" or prj.language == "C++")
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Returns true if the project uses a .NET language.
|
||||
--
|
||||
|
||||
function premake.isdotnetproject(prj)
|
||||
return (prj.language == "C#")
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Walk the list of source code files, breaking them into "groups" based
|
||||
-- on the directory hierarchy.
|
||||
|
File diff suppressed because one or more lines are too long
@ -16,6 +16,11 @@
|
||||
dofile("test_api.lua")
|
||||
dofile("test_targets.lua")
|
||||
dofile("test_keywords.lua")
|
||||
dofile("test_vs2002_sln.lua")
|
||||
dofile("test_vs2003_sln.lua")
|
||||
dofile("test_vs2005_sln.lua")
|
||||
dofile("test_vs2008_sln.lua")
|
||||
dofile("test_vs200x_vcproj.lua")
|
||||
|
||||
|
||||
|
||||
|
59
tests/test_vs2002_sln.lua
Normal file
59
tests/test_vs2002_sln.lua
Normal file
@ -0,0 +1,59 @@
|
||||
--
|
||||
-- tests/test_vs2002_sln.lua
|
||||
-- Automated test suite for Visual Studio 2002 solution generation.
|
||||
-- Copyright (c) 2009 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
T.vs2002_sln = { }
|
||||
|
||||
--
|
||||
-- Configure a solution for testing
|
||||
--
|
||||
|
||||
local sln
|
||||
function T.vs2002_sln.setup()
|
||||
sln = solution "MySolution"
|
||||
configurations { "Debug", "Release" }
|
||||
|
||||
prj = project "MyProject"
|
||||
language "C++"
|
||||
kind "ConsoleApp"
|
||||
uuid "AE61726D-187C-E440-BD07-2556188A6565"
|
||||
|
||||
premake.buildconfigs()
|
||||
_ACTION = 'vs2002'
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Make sure I've got the basic layout correct
|
||||
--
|
||||
|
||||
function T.vs2002_sln.BasicLayout()
|
||||
io.capture()
|
||||
premake.vs2002_solution(sln)
|
||||
test.capture [[
|
||||
Microsoft Visual Studio Solution File, Format Version 7.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyProject", "MyProject.vcproj", "{AE61726D-187C-E440-BD07-2556188A6565}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
ConfigName.0 = Debug
|
||||
ConfigName.1 = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectDependencies) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Debug.ActiveCfg = Debug|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Debug.Build.0 = Debug|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Release.ActiveCfg = Release|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
]]
|
||||
end
|
59
tests/test_vs2003_sln.lua
Normal file
59
tests/test_vs2003_sln.lua
Normal file
@ -0,0 +1,59 @@
|
||||
--
|
||||
-- tests/test_vs2003_sln.lua
|
||||
-- Automated test suite for Visual Studio 2003 solution generation.
|
||||
-- Copyright (c) 2009 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
T.vs2003_sln = { }
|
||||
|
||||
--
|
||||
-- Configure a solution for testing
|
||||
--
|
||||
|
||||
local sln
|
||||
function T.vs2003_sln.setup()
|
||||
sln = solution "MySolution"
|
||||
configurations { "Debug", "Release" }
|
||||
|
||||
prj = project "MyProject"
|
||||
language "C++"
|
||||
kind "ConsoleApp"
|
||||
uuid "AE61726D-187C-E440-BD07-2556188A6565"
|
||||
|
||||
premake.buildconfigs()
|
||||
_ACTION = 'vs2003'
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Make sure I've got the basic layout correct
|
||||
--
|
||||
|
||||
function T.vs2003_sln.BasicLayout()
|
||||
io.capture()
|
||||
premake.vs2003_solution(sln)
|
||||
test.capture [[
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyProject", "MyProject.vcproj", "{AE61726D-187C-E440-BD07-2556188A6565}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectDependencies) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Debug.ActiveCfg = Debug|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Debug.Build.0 = Debug|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Release.ActiveCfg = Release|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
]]
|
||||
end
|
208
tests/test_vs2005_sln.lua
Normal file
208
tests/test_vs2005_sln.lua
Normal file
@ -0,0 +1,208 @@
|
||||
--
|
||||
-- tests/test_vs2005_sln.lua
|
||||
-- Automated test suite for Visual Studio 2005 solution generation.
|
||||
-- Copyright (c) 2009 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
T.vs2005_sln = { }
|
||||
|
||||
--
|
||||
-- Configure a solution for testing
|
||||
--
|
||||
|
||||
local sln
|
||||
function T.vs2005_sln.setup()
|
||||
sln = solution "MySolution"
|
||||
configurations { "Debug", "Release" }
|
||||
|
||||
prj = project "MyProject"
|
||||
language "C++"
|
||||
kind "ConsoleApp"
|
||||
uuid "AE61726D-187C-E440-BD07-2556188A6565"
|
||||
|
||||
_ACTION = 'vs2005'
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Make sure I've got the basic layout correct
|
||||
--
|
||||
|
||||
function T.vs2005_sln.BasicLayout()
|
||||
io.capture()
|
||||
premake.buildconfigs()
|
||||
premake.vs2005_solution(sln)
|
||||
test.capture ('\239\187\191' .. [[
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyProject", "MyProject.vcproj", "{AE61726D-187C-E440-BD07-2556188A6565}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
]])
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Test a mixed runtime (C++/.NET) solution.
|
||||
--
|
||||
|
||||
function T.vs2005_sln.MixedRuntime()
|
||||
project "MyNetProject"
|
||||
language "C#"
|
||||
kind "ConsoleApp"
|
||||
uuid "C9135098-6047-8142-B10E-D27E7F73FCB3"
|
||||
|
||||
io.capture()
|
||||
premake.buildconfigs()
|
||||
premake.vs2005_solution(sln)
|
||||
test.capture ('\239\187\191' .. [[
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyProject", "MyProject.vcproj", "{AE61726D-187C-E440-BD07-2556188A6565}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyNetProject", "MyNetProject.csproj", "{C9135098-6047-8142-B10E-D27E7F73FCB3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|Mixed Platforms = Debug|Mixed Platforms
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|Mixed Platforms = Release|Mixed Platforms
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Release|Mixed Platforms.Build.0 = Release|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Release|Win32.Build.0 = Release|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Win32.ActiveCfg = Debug|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Win32.ActiveCfg = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
]])
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Test combinations of C++ and .NET platforms
|
||||
--
|
||||
|
||||
function T.vs2005_sln.SolutionConfigs_OnMultipleCppPlatforms()
|
||||
solution()
|
||||
platforms { "x32", "x64" }
|
||||
|
||||
io.capture()
|
||||
premake.buildconfigs()
|
||||
premake.vs2005_solution_configurations(sln)
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function T.vs2005_sln.ProjectConfigs_OnMultipleCppPlatforms()
|
||||
solution()
|
||||
platforms { "x32", "x64" }
|
||||
|
||||
io.capture()
|
||||
premake.buildconfigs()
|
||||
premake.vs2005_solution_project_configurations(sln)
|
||||
test.capture [[
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Debug|x64.Build.0 = Debug|x64
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Release|Win32.Build.0 = Release|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Release|x64.ActiveCfg = Release|x64
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function T.vs2005_sln.ProjectConfigs_OnMultipleCppPlatformsAndMixedRuntimes()
|
||||
project "MyNetProject"
|
||||
language "C#"
|
||||
kind "ConsoleApp"
|
||||
uuid "C9135098-6047-8142-B10E-D27E7F73FCB3"
|
||||
|
||||
solution()
|
||||
platforms { "x32", "x64" }
|
||||
|
||||
io.capture()
|
||||
premake.buildconfigs()
|
||||
premake.vs2005_solution_project_configurations(sln)
|
||||
test.capture [[
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Debug|x64.Build.0 = Debug|x64
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Release|Mixed Platforms.Build.0 = Release|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Release|Win32.Build.0 = Release|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Release|x64.ActiveCfg = Release|x64
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Release|x64.Build.0 = Release|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Win32.ActiveCfg = Debug|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Win32.ActiveCfg = Release|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
58
tests/test_vs2008_sln.lua
Normal file
58
tests/test_vs2008_sln.lua
Normal file
@ -0,0 +1,58 @@
|
||||
--
|
||||
-- tests/test_vs2008_sln.lua
|
||||
-- Automated test suite for Visual Studio 2008 solution generation.
|
||||
-- Copyright (c) 2009 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
T.vs2008_sln = { }
|
||||
|
||||
--
|
||||
-- Configure a solution for testing
|
||||
--
|
||||
|
||||
local sln
|
||||
function T.vs2008_sln.setup()
|
||||
sln = solution "MySolution"
|
||||
configurations { "Debug", "Release" }
|
||||
|
||||
prj = project "MyProject"
|
||||
language "C++"
|
||||
kind "ConsoleApp"
|
||||
uuid "AE61726D-187C-E440-BD07-2556188A6565"
|
||||
|
||||
premake.buildconfigs()
|
||||
_ACTION = 'vs2008'
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Make sure I've got the basic layout correct
|
||||
--
|
||||
|
||||
function T.vs2008_sln.BasicLayout()
|
||||
io.capture()
|
||||
premake.vs2005_solution(sln)
|
||||
test.capture ('\239\187\191' .. [[
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyProject", "MyProject.vcproj", "{AE61726D-187C-E440-BD07-2556188A6565}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{AE61726D-187C-E440-BD07-2556188A6565}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
]])
|
||||
end
|
264
tests/test_vs200x_vcproj.lua
Normal file
264
tests/test_vs200x_vcproj.lua
Normal file
@ -0,0 +1,264 @@
|
||||
--
|
||||
-- tests/test_vs200x_vcproj.lua
|
||||
-- Automated test suite for Visual Studio 2002-2008 C/C++ project generation.
|
||||
-- Copyright (c) 2009 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
T.vs200x_vcproj = { }
|
||||
|
||||
--
|
||||
-- Configure a solution for testing
|
||||
--
|
||||
|
||||
local sln, prj
|
||||
function T.vs200x_vcproj.setup()
|
||||
sln = solution "MySolution"
|
||||
configurations { "Debug", "Release" }
|
||||
|
||||
prj = project "MyProject"
|
||||
language "C++"
|
||||
kind "ConsoleApp"
|
||||
uuid "AE61726D-187C-E440-BD07-2556188A6565"
|
||||
|
||||
_ACTION = 'vs2005'
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
io.capture()
|
||||
premake.buildconfigs()
|
||||
|
||||
local cfg = premake.getconfig(sln.projects[1])
|
||||
cfg.name = prj.name
|
||||
cfg.blocks = prj.blocks
|
||||
prj = cfg
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Make sure I've got the basic layout correct
|
||||
--
|
||||
|
||||
function T.vs200x_vcproj.BasicLayout()
|
||||
prepare()
|
||||
premake.vs200x_vcproj(prj)
|
||||
test.capture [[
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="MyProject"
|
||||
ProjectGUID="{AE61726D-187C-E440-BD07-2556188A6565}"
|
||||
RootNamespace="MyProject"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="."
|
||||
IntermediateDirectory="obj\Debug"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\MyProject.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""
|
||||
GenerateDebugInformation="false"
|
||||
SubSystem="1"
|
||||
EntryPointSymbol="mainCRTStartup"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="."
|
||||
IntermediateDirectory="obj\Release"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\MyProject.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""
|
||||
GenerateDebugInformation="false"
|
||||
SubSystem="1"
|
||||
EntryPointSymbol="mainCRTStartup"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Test multiple platforms
|
||||
--
|
||||
|
||||
function T.vs200x_vcproj.Platforms_OnMultiplePlatforms()
|
||||
platforms { "x32", "x64" }
|
||||
|
||||
prepare()
|
||||
premake.vs200x_vcproj_platforms(prj)
|
||||
test.capture [[
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
function T.vs200x_vcproj.Platforms_OnMultiplePlatforms()
|
||||
platforms { "x32", "x64" }
|
||||
|
||||
prepare()
|
||||
premake.vs200x_vcproj(prj)
|
||||
local result = io.endcapture()
|
||||
|
||||
test.istrue(result:find '<Configuration\r\n\t\t\tName="Debug|Win32"\r\n')
|
||||
test.istrue(result:find '<Configuration\r\n\t\t\tName="Release|Win32"\r\n')
|
||||
test.istrue(result:find '<Configuration\r\n\t\t\tName="Debug|x64"\r\n')
|
||||
test.istrue(result:find '<Configuration\r\n\t\t\tName="Release|x64"\r\n')
|
||||
end
|
@ -19,6 +19,26 @@
|
||||
-- Assertion functions
|
||||
--
|
||||
|
||||
function test.capture(expected)
|
||||
local actual = io.endcapture()
|
||||
|
||||
local ait = actual:gfind("(.-)" .. io.eol)
|
||||
local eit = expected:gfind("(.-)\n")
|
||||
|
||||
local linenum = 1
|
||||
local atxt = ait()
|
||||
local etxt = eit()
|
||||
while etxt do
|
||||
if (etxt ~= atxt) then
|
||||
test.fail("(%d) expected:\n%s\n...but was:\n%s", linenum, etxt, atxt)
|
||||
end
|
||||
linenum = linenum + 1
|
||||
atxt = ait()
|
||||
etxt = eit()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function test.fail(format, ...)
|
||||
-- convert nils into something more usefuls
|
||||
for i = 1, arg.n do
|
||||
|
Loading…
Reference in New Issue
Block a user