Merged in TurkeyMan/premake-dev/patchability (pull request #85)
Improvements to vstudio patchability
This commit is contained in:
commit
e2e4bd5113
@ -53,14 +53,14 @@
|
||||
--
|
||||
|
||||
function vstudio.archFromConfig(cfg, win32)
|
||||
local iscpp = project.iscpp(cfg.project)
|
||||
local isnative = project.isnative(cfg.project)
|
||||
|
||||
local arch = architecture(cfg.system, cfg.architecture)
|
||||
if not arch then
|
||||
arch = iif(iscpp, "x86", "Any CPU")
|
||||
arch = iif(isnative, "x86", "Any CPU")
|
||||
end
|
||||
|
||||
if win32 and iscpp and arch == "x86" then
|
||||
if win32 and isnative and arch == "x86" then
|
||||
arch = "Win32"
|
||||
end
|
||||
|
||||
@ -151,9 +151,9 @@
|
||||
|
||||
function vstudio.projectfile(prj)
|
||||
local extension
|
||||
if prj.language == "C#" then
|
||||
if project.isdotnet(prj) then
|
||||
extension = ".csproj"
|
||||
else
|
||||
elseif project.iscpp(prj) then
|
||||
extension = iif(_ACTION > "vs2008", ".vcxproj", ".vcproj")
|
||||
end
|
||||
|
||||
@ -212,12 +212,12 @@
|
||||
end
|
||||
|
||||
-- scan the contained projects to identify the platform
|
||||
local hascpp = false
|
||||
local hasnative = false
|
||||
local hasnet = false
|
||||
local slnarch
|
||||
for prj in solution.eachproject(cfg.solution) do
|
||||
if project.iscpp(prj) then
|
||||
hascpp = true
|
||||
if project.isnative(prj) then
|
||||
hasnative = true
|
||||
elseif project.isdotnet(prj) then
|
||||
hasnet = true
|
||||
end
|
||||
@ -239,7 +239,7 @@
|
||||
return iif(hasnet, "x86", "Win32")
|
||||
elseif slnarch then
|
||||
return iif(slnarch == "x86" and not hasnet, "Win32", slnarch)
|
||||
elseif hasnet and hascpp then
|
||||
elseif hasnet and hasnative then
|
||||
return "Mixed Platforms"
|
||||
elseif hasnet then
|
||||
return "Any CPU"
|
||||
@ -260,7 +260,7 @@
|
||||
--
|
||||
|
||||
function vstudio.solutionarch(cfg)
|
||||
local hascpp = false
|
||||
local hasnative = false
|
||||
local hasdotnet = false
|
||||
|
||||
-- if the configuration has a platform identifier, use that as default
|
||||
@ -270,13 +270,13 @@
|
||||
--
|
||||
|
||||
for prj in solution.eachproject(cfg.solution) do
|
||||
if project.iscpp(prj) then
|
||||
hascpp = true
|
||||
if project.isnative(prj) then
|
||||
hasnative = true
|
||||
elseif project.isdotnet(prj) then
|
||||
hasdotnet = true
|
||||
end
|
||||
|
||||
if hascpp and hasdotnet then
|
||||
if hasnative and hasdotnet then
|
||||
return "Mixed Platforms"
|
||||
end
|
||||
|
||||
@ -291,7 +291,7 @@
|
||||
end
|
||||
|
||||
-- use a default if no other architecture was specified
|
||||
arch = arch or iif(hascpp, "Win32", "Any CPU")
|
||||
arch = arch or iif(hasnative, "Win32", "Any CPU")
|
||||
return arch
|
||||
end
|
||||
|
||||
@ -327,9 +327,9 @@
|
||||
--
|
||||
|
||||
function vstudio.tool(prj)
|
||||
if (prj.language == "C#") then
|
||||
if project.isdotnet(prj) then
|
||||
return "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC"
|
||||
else
|
||||
elseif project.iscpp(prj) then
|
||||
return "8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942"
|
||||
end
|
||||
end
|
||||
|
@ -28,7 +28,7 @@
|
||||
if premake.project.isdotnet(prj) then
|
||||
premake.generate(prj, ".csproj", vstudio.cs2005.generate)
|
||||
premake.generate(prj, ".csproj.user", vstudio.cs2005.generate_user)
|
||||
else
|
||||
elseif premake.project.iscpp(prj) then
|
||||
premake.generate(prj, ".vcproj", vstudio.vc200x.generate)
|
||||
premake.generate(prj, ".vcproj.user", vstudio.vc200x.generate_user)
|
||||
end
|
||||
@ -93,5 +93,6 @@
|
||||
csprojSchemaVersion = "2.0",
|
||||
productVersion = "8.0.50727",
|
||||
solutionVersion = "9",
|
||||
versionName = "2005",
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,19 @@
|
||||
local tree = premake.tree
|
||||
|
||||
|
||||
--
|
||||
-- Return the list of sections contained in the solution.
|
||||
--
|
||||
|
||||
function sln2005.solutionSections(sln)
|
||||
return {
|
||||
"ConfigurationPlatforms",
|
||||
"SolutionProperties",
|
||||
"NestedProjects",
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Generate a Visual Studio 200x solution, with support for the new platforms API.
|
||||
--
|
||||
@ -26,9 +39,7 @@
|
||||
sln2005.projects(sln)
|
||||
|
||||
_p('Global')
|
||||
sln2005.configurationPlatforms(sln)
|
||||
sln2005.properties(sln)
|
||||
sln2005.NestedProjects(sln)
|
||||
sln2005.sections(sln)
|
||||
_p('EndGlobal')
|
||||
|
||||
end
|
||||
@ -42,7 +53,7 @@
|
||||
function sln2005.header()
|
||||
local action = premake.action.current()
|
||||
_p('Microsoft Visual Studio Solution File, Format Version %d.00', action.vstudio.solutionVersion)
|
||||
_p('# Visual Studio %s', _ACTION:sub(3))
|
||||
_p('# Visual Studio %s', action.vstudio.versionName)
|
||||
end
|
||||
|
||||
|
||||
@ -240,3 +251,28 @@
|
||||
_p(1,'EndGlobalSection')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Map solution sections to output functions. Tools that aren't listed will
|
||||
-- be ignored.
|
||||
--
|
||||
|
||||
sln2005.sectionmap = {
|
||||
ConfigurationPlatforms = sln2005.configurationPlatforms,
|
||||
SolutionProperties = sln2005.properties,
|
||||
NestedProjects = sln2005.NestedProjects
|
||||
}
|
||||
|
||||
|
||||
--
|
||||
-- Write out all of the solution sections.
|
||||
--
|
||||
|
||||
function sln2005.sections(sln)
|
||||
for _, section in ipairs(sln2005.solutionSections(sln)) do
|
||||
if sln2005.sectionmap[section] then
|
||||
sln2005.sectionmap[section](sln)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -48,6 +48,7 @@
|
||||
csprojSchemaVersion = "2.0",
|
||||
productVersion = "9.0.30729",
|
||||
solutionVersion = "10",
|
||||
versionName = "2008",
|
||||
toolsVersion = "3.5",
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@
|
||||
if premake.project.isdotnet(prj) then
|
||||
premake.generate(prj, ".csproj", vstudio.cs2005.generate)
|
||||
premake.generate(prj, ".csproj.user", vstudio.cs2005.generate_user)
|
||||
else
|
||||
elseif premake.project.iscpp(prj) then
|
||||
premake.generate(prj, ".vcxproj", vstudio.vc2010.generate)
|
||||
premake.generate(prj, ".vcxproj.user", vstudio.vc2010.generateUser)
|
||||
|
||||
@ -91,6 +91,7 @@
|
||||
csprojSchemaVersion = "2.0",
|
||||
productVersion = "8.0.30703",
|
||||
solutionVersion = "11",
|
||||
versionName = "2010",
|
||||
targetFramework = "4.0",
|
||||
toolsVersion = "4.0",
|
||||
}
|
||||
|
@ -46,6 +46,7 @@
|
||||
|
||||
vstudio = {
|
||||
solutionVersion = "12",
|
||||
versionName = "2012",
|
||||
targetFramework = "4.5",
|
||||
toolsVersion = "4.0",
|
||||
}
|
||||
|
@ -46,6 +46,7 @@
|
||||
|
||||
vstudio = {
|
||||
solutionVersion = "12",
|
||||
versionName = "2013",
|
||||
targetFramework = "4.5",
|
||||
toolsVersion = "12.0",
|
||||
}
|
||||
|
@ -832,6 +832,15 @@
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Returns true if the project uses a native language.
|
||||
--
|
||||
|
||||
function project.isnative(prj)
|
||||
return project.iscpp(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Given a build config/platform pairing, applies any project configuration maps
|
||||
-- and returns a new (or the same) pairing.
|
||||
|
Loading…
Reference in New Issue
Block a user