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 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 -- If a dependency of a project configuration is excluded from that particular
-- build configuration or platform, Visual Studio will still try to link it. -- build configuration or platform, Visual Studio will still try to link it.

View File

@ -75,7 +75,7 @@
-- The capabilities of this action -- 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_languages = { "C", "C++", "C#" },
valid_tools = { valid_tools = {
cc = { "msc" }, cc = { "msc" },

View File

@ -30,7 +30,7 @@
-- The capabilities of this action -- 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_languages = { "C", "C++", "C#" },
valid_tools = { valid_tools = {
cc = { "msc" }, cc = { "msc" },

View File

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

View File

@ -68,7 +68,7 @@
-- The capabilities of this action -- 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_languages = { "C", "C++", "C#" },
valid_tools = { valid_tools = {
cc = { "msc" }, cc = { "msc" },

View File

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

View File

@ -30,7 +30,7 @@
-- The capabilities of this action -- 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_languages = { "C", "C++", "C#" },
valid_tools = { valid_tools = {
cc = { "msc" }, cc = { "msc" },

View File

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

View File

@ -96,7 +96,7 @@
-- character encoding. -- character encoding.
-- --
function suite.defaultSettings() function suite.defaultSettings_onMakefile()
kind "Makefile" kind "Makefile"
prepare() prepare()
test.capture [[ test.capture [[
@ -108,3 +108,16 @@
> >
]] ]]
end 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 -- Makefile projects set new keyword. It should also drop the root
-- can't get this working yet; need to figure out a better way to test -- namespace, but I need to figure out a better way to test for
-- for empty configurations in the project first. -- empty configurations in the project first.
-- --
-- function suite.keywordIsCorrect_onMakefile() function suite.keywordIsCorrect_onMakefile()
-- kind "Makefile" kind "Makefile"
-- prepare() prepare()
-- test.capture [[ test.capture [[
--<VisualStudioProject <VisualStudioProject
-- ProjectType="Visual C++" ProjectType="Visual C++"
-- Version="9.00" Version="9.00"
-- Name="MyProject" Name="MyProject"
-- ProjectGUID="{AE61726D-187C-E440-BD07-2556188A6565}" ProjectGUID="{AE61726D-187C-E440-BD07-2556188A6565}"
-- Keyword="MakeFileProj" RootNamespace="MyProject"
-- TargetFrameworkVersion="196613" Keyword="MakeFileProj"
-- > TargetFrameworkVersion="196613"
-- ]] >
-- end ]]
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 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> </PropertyGroup>
]] ]]
end 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 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 -- If the project name differs from the project filename, output a

View File

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

View File

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