diff --git a/src/actions/vstudio/_vstudio.lua b/src/actions/vstudio/_vstudio.lua index 1e99f9c0..b693b6ed 100644 --- a/src/actions/vstudio/_vstudio.lua +++ b/src/actions/vstudio/_vstudio.lua @@ -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. diff --git a/src/actions/vstudio/vs2005.lua b/src/actions/vstudio/vs2005.lua index 727ce2f5..bbb0adaf 100644 --- a/src/actions/vstudio/vs2005.lua +++ b/src/actions/vstudio/vs2005.lua @@ -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" }, diff --git a/src/actions/vstudio/vs2008.lua b/src/actions/vstudio/vs2008.lua index 28b4da1d..798d7b7d 100644 --- a/src/actions/vstudio/vs2008.lua +++ b/src/actions/vstudio/vs2008.lua @@ -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" }, diff --git a/src/actions/vstudio/vs200x_vcproj.lua b/src/actions/vstudio/vs200x_vcproj.lua index 2a26d1a7..d97dd5ba 100644 --- a/src/actions/vstudio/vs200x_vcproj.lua +++ b/src/actions/vstudio/vs200x_vcproj.lua @@ -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, } diff --git a/src/actions/vstudio/vs2010.lua b/src/actions/vstudio/vs2010.lua index 1e445fe9..43171f17 100644 --- a/src/actions/vstudio/vs2010.lua +++ b/src/actions/vstudio/vs2010.lua @@ -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" }, diff --git a/src/actions/vstudio/vs2010_vcxproj.lua b/src/actions/vstudio/vs2010_vcxproj.lua index d9df2d30..b4593f9a 100644 --- a/src/actions/vstudio/vs2010_vcxproj.lua +++ b/src/actions/vstudio/vs2010_vcxproj.lua @@ -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,'') 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,'', vc2010.condition(cfg)) premake.callarray(vc2010, vc2010.elements.itemDefinitionGroup, cfg) _p(1,'') @@ -624,7 +624,7 @@ function vc2010.characterSet(cfg) - if cfg.kind ~= premake.MAKEFILE then + if not vstudio.isMakefile(cfg) then _p(2,'%s', 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 diff --git a/src/actions/vstudio/vs2012.lua b/src/actions/vstudio/vs2012.lua index cbb14f12..6c43be22 100644 --- a/src/actions/vstudio/vs2012.lua +++ b/src/actions/vstudio/vs2012.lua @@ -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" }, diff --git a/src/base/premake.lua b/src/base/premake.lua index 73a44ad3..2c462515 100644 --- a/src/base/premake.lua +++ b/src/base/premake.lua @@ -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 diff --git a/tests/actions/vstudio/vc200x/test_configuration.lua b/tests/actions/vstudio/vc200x/test_configuration.lua index 6e44cc41..7df418e1 100755 --- a/tests/actions/vstudio/vc200x/test_configuration.lua +++ b/tests/actions/vstudio/vc200x/test_configuration.lua @@ -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 [[ + + ]] + end diff --git a/tests/actions/vstudio/vc200x/test_project.lua b/tests/actions/vstudio/vc200x/test_project.lua index 48a618fc..a54cd539 100644 --- a/tests/actions/vstudio/vc200x/test_project.lua +++ b/tests/actions/vstudio/vc200x/test_project.lua @@ -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 [[ --- --- ]] --- end + function suite.keywordIsCorrect_onMakefile() + kind "Makefile" + prepare() + test.capture [[ + + ]] + end + + function suite.keywordIsCorrect_onNone() + kind "None" + prepare() + test.capture [[ + + ]] + end --- @@ -177,3 +194,20 @@ ]] end + function suite.keywordIsCorrect_onNoneWithMixedConfigs() + removeconfigurations { "Release" } + kind "None" + prepare() + test.capture [[ + + ]] + end + diff --git a/tests/actions/vstudio/vc2010/test_config_props.lua b/tests/actions/vstudio/vc2010/test_config_props.lua index f43f9953..d48728cc 100755 --- a/tests/actions/vstudio/vc2010/test_config_props.lua +++ b/tests/actions/vstudio/vc2010/test_config_props.lua @@ -190,3 +190,16 @@ ]] end + + function suite.structureIsCorrect_onNone() + kind "None" + prepare() + test.capture [[ + + Makefile + false + .\ + obj\Debug\ + + ]] + end diff --git a/tests/actions/vstudio/vc2010/test_globals.lua b/tests/actions/vstudio/vc2010/test_globals.lua index 32cbe85e..d2829255 100755 --- a/tests/actions/vstudio/vc2010/test_globals.lua +++ b/tests/actions/vstudio/vc2010/test_globals.lua @@ -109,6 +109,17 @@ ]] end + function suite.keywordIsCorrect_onNone() + kind "None" + prepare() + test.capture [[ + + {42B5DBC6-AE1F-903D-F75D-41E363076E92} + MakeFileProj + + ]] + end + --- -- If the project name differs from the project filename, output a diff --git a/tests/actions/vstudio/vc2010/test_item_def_group.lua b/tests/actions/vstudio/vc2010/test_item_def_group.lua index 24c5ef9a..b0b5d6e7 100644 --- a/tests/actions/vstudio/vc2010/test_item_def_group.lua +++ b/tests/actions/vstudio/vc2010/test_item_def_group.lua @@ -50,6 +50,15 @@ ]] end + function suite.structureIsCorrect_onNone() + kind "Makefile" + prepare() + test.capture [[ + + + ]] + end + -- @@ -63,3 +72,9 @@ prepare("Release") test.isemptycapture() end + + function suite.skipped_onSubsequentConfigs_onNone() + kind "None" + prepare("Release") + test.isemptycapture() + end diff --git a/tests/actions/vstudio/vc2010/test_output_props.lua b/tests/actions/vstudio/vc2010/test_output_props.lua index 758229f6..4b6eeada 100755 --- a/tests/actions/vstudio/vc2010/test_output_props.lua +++ b/tests/actions/vstudio/vc2010/test_output_props.lua @@ -56,6 +56,12 @@ test.isemptycapture() end + function suite.omitsBlock_onNone() + kind "Makefile" + prepare() + test.isemptycapture() + end + -- -- Xbox360 adds an extra element to the block.