One of the change sets to support the new kind "None" seems to have gone missing; here it is (again?)

This commit is contained in:
Jason Perkins 2013-06-26 07:28:57 -04:00
parent 63257e1fc8
commit 644cb30326
14 changed files with 138 additions and 34 deletions

View File

@ -86,6 +86,16 @@
end
--
-- Return true if the configuration kind is one of "Makefile" or "None". The
-- latter is generated like a Makefile project and excluded from the solution.
--
function vstudio.isMakefile(cfg)
return (cfg.kind == premake.MAKEFILE or cfg.kind == premake.NONE)
end
--
-- If a dependency of a project configuration is excluded from that particular
-- build configuration or platform, Visual Studio will still try to link it.

View File

@ -75,7 +75,7 @@
-- The capabilities of this action
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Makefile" },
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Makefile", "None" },
valid_languages = { "C", "C++", "C#" },
valid_tools = {
cc = { "msc" },

View File

@ -30,7 +30,7 @@
-- The capabilities of this action
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Makefile" },
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Makefile", "None" },
valid_languages = { "C", "C++", "C#" },
valid_tools = {
cc = { "msc" },

View File

@ -119,7 +119,7 @@
if cfg.flags.Managed then
isManaged = true
end
if cfg.kind == premake.MAKEFILE then
if vstudio.isMakefile(cfg) then
isMakefile = true
end
end
@ -246,7 +246,7 @@
--
function vc200x.toolsForConfig(cfg, isEmptyCfg)
if cfg.kind == premake.MAKEFILE and not isEmptyCfg then
if vstudio.isMakefile(cfg) and not isEmptyCfg then
return {
"VCNMakeTool"
}
@ -981,7 +981,7 @@
function vc200x.characterSet(cfg)
if cfg.kind ~= premake.MAKEFILE then
if not vstudio.isMakefile(cfg) then
_p(3,'CharacterSet="%s"', iif(cfg.flags.Unicode, 1, 2))
end
end
@ -1011,6 +1011,7 @@
function vc200x.configurationType(cfg)
local cfgtypes = {
Makefile = 0,
None = 0,
SharedLib = 2,
StaticLib = 4,
}

View File

@ -68,7 +68,7 @@
-- The capabilities of this action
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Makefile" },
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Makefile", "None" },
valid_languages = { "C", "C++", "C#" },
valid_tools = {
cc = { "msc" },

View File

@ -134,7 +134,7 @@
if cfg.flags.Managed then
isManaged = true
end
if cfg.kind == premake.MAKEFILE then
if vstudio.isMakefile(cfg) then
isMakefile = true
end
end
@ -209,7 +209,7 @@
}
function vc2010.outputProperties(cfg)
if cfg.kind ~= premake.MAKEFILE then
if not vstudio.isMakefile(cfg) then
premake.callarray(vc2010, vc2010.elements.outputProperties, cfg)
_p(1,'</PropertyGroup>')
end
@ -222,7 +222,7 @@
--
function vc2010.nmakeProperties(cfg)
if cfg.kind == premake.MAKEFILE then
if vstudio.isMakefile(cfg) then
vc2010.propertyGroup(cfg)
vc2010.nmakeOutput(cfg)
vc2010.nmakeCommandLine(cfg, cfg.buildcommands, "Build")
@ -248,7 +248,7 @@
}
function vc2010.itemDefinitionGroup(cfg)
if cfg.kind ~= premake.MAKEFILE then
if not vstudio.isMakefile(cfg) then
_p(1,'<ItemDefinitionGroup %s>', vc2010.condition(cfg))
premake.callarray(vc2010, vc2010.elements.itemDefinitionGroup, cfg)
_p(1,'</ItemDefinitionGroup>')
@ -624,7 +624,7 @@
function vc2010.characterSet(cfg)
if cfg.kind ~= premake.MAKEFILE then
if not vstudio.isMakefile(cfg) then
_p(2,'<CharacterSet>%s</CharacterSet>', iif(cfg.flags.Unicode, "Unicode", "MultiByte"))
end
end
@ -882,7 +882,7 @@
function vc2010.nmakeOutDirs(cfg)
if cfg.kind == premake.MAKEFILE then
if vstudio.isMakefile(cfg) then
vc2010.outDir(cfg)
vc2010.intDir(cfg)
end

View File

@ -30,7 +30,7 @@
-- The capabilities of this action
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Makefile" },
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Makefile", "None" },
valid_languages = { "C", "C++", "C#" },
valid_tools = {
cc = { "msc" },

View File

@ -262,9 +262,10 @@
premake.error("project '%s' needs a kind in configuration '%s'", cfg.project.name, cfg.name)
end
-- makefile configuration can only appear in C++ projects
if cfg.kind == premake.MAKEFILE and not project.iscpp(cfg.project) then
premake.error("project '%s' uses Makefile kind in configuration '%s'; language must be C++", cfg.project.name, cfg.name)
-- makefile configuration can only appear in C++ projects; this is the
-- default now, so should only be a problem if overridden.
if (cfg.kind == premake.MAKEFILE or cfg.kind == premake.NONE) and not project.iscpp(cfg.project) then
premake.error("project '%s' uses %s kind in configuration '%s'; language must be C++", cfg.project.name, cfg.kind, cfg.name)
end
-- check for out of scope fields

View File

@ -96,7 +96,7 @@
-- character encoding.
--
function suite.defaultSettings()
function suite.defaultSettings_onMakefile()
kind "Makefile"
prepare()
test.capture [[
@ -108,3 +108,16 @@
>
]]
end
function suite.defaultSettings_onNone()
kind "None"
prepare()
test.capture [[
<Configuration
Name="Debug|Win32"
OutputDirectory="."
IntermediateDirectory="obj\Debug"
ConfigurationType="0"
>
]]
end

View File

@ -134,25 +134,42 @@
--
-- Makefile projects set new keyword and drop the root namespace. But I
-- can't get this working yet; need to figure out a better way to test
-- for empty configurations in the project first.
-- Makefile projects set new keyword. It should also drop the root
-- namespace, but I need to figure out a better way to test for
-- empty configurations in the project first.
--
-- function suite.keywordIsCorrect_onMakefile()
-- kind "Makefile"
-- prepare()
-- test.capture [[
--<VisualStudioProject
-- ProjectType="Visual C++"
-- Version="9.00"
-- Name="MyProject"
-- ProjectGUID="{AE61726D-187C-E440-BD07-2556188A6565}"
-- Keyword="MakeFileProj"
-- TargetFrameworkVersion="196613"
-- >
-- ]]
-- end
function suite.keywordIsCorrect_onMakefile()
kind "Makefile"
prepare()
test.capture [[
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="MyProject"
ProjectGUID="{AE61726D-187C-E440-BD07-2556188A6565}"
RootNamespace="MyProject"
Keyword="MakeFileProj"
TargetFrameworkVersion="196613"
>
]]
end
function suite.keywordIsCorrect_onNone()
kind "None"
prepare()
test.capture [[
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="MyProject"
ProjectGUID="{AE61726D-187C-E440-BD07-2556188A6565}"
RootNamespace="MyProject"
Keyword="MakeFileProj"
TargetFrameworkVersion="196613"
>
]]
end
---
@ -177,3 +194,20 @@
]]
end
function suite.keywordIsCorrect_onNoneWithMixedConfigs()
removeconfigurations { "Release" }
kind "None"
prepare()
test.capture [[
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="MyProject"
ProjectGUID="{AE61726D-187C-E440-BD07-2556188A6565}"
RootNamespace="MyProject"
Keyword="MakeFileProj"
TargetFrameworkVersion="196613"
>
]]
end

View File

@ -190,3 +190,16 @@
</PropertyGroup>
]]
end
function suite.structureIsCorrect_onNone()
kind "None"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<OutDir>.\</OutDir>
<IntDir>obj\Debug\</IntDir>
</PropertyGroup>
]]
end

View File

@ -109,6 +109,17 @@
]]
end
function suite.keywordIsCorrect_onNone()
kind "None"
prepare()
test.capture [[
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
<Keyword>MakeFileProj</Keyword>
</PropertyGroup>
]]
end
---
-- If the project name differs from the project filename, output a

View File

@ -50,6 +50,15 @@
]]
end
function suite.structureIsCorrect_onNone()
kind "Makefile"
prepare()
test.capture [[
<ItemDefinitionGroup>
</ItemDefinitionGroup>
]]
end
--
@ -63,3 +72,9 @@
prepare("Release")
test.isemptycapture()
end
function suite.skipped_onSubsequentConfigs_onNone()
kind "None"
prepare("Release")
test.isemptycapture()
end

View File

@ -56,6 +56,12 @@
test.isemptycapture()
end
function suite.omitsBlock_onNone()
kind "Makefile"
prepare()
test.isemptycapture()
end
--
-- Xbox360 adds an extra <OutputFile> element to the block.