Commits

Jason Perkins  committed cbb6f09

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

  • Participants
  • Parent commits c77c6c2

Comments (0)

Files changed (14)

File src/actions/vstudio/_vstudio.lua

 
 
 --
+-- 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.
 -- This function detects that case, so that the individual actions can work

File src/actions/vstudio/vs2005.lua

 
 		-- 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"   },

File src/actions/vstudio/vs2008.lua

 
 		-- 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"   },

File src/actions/vstudio/vs200x_vcproj.lua

 			if cfg.flags.Managed then
 				isManaged = true
 			end
-			if cfg.kind == premake.MAKEFILE then
+			if vstudio.isMakefile(cfg) then
 				isMakefile = true
 			end
 		end
 --
 
 	function vc200x.toolsForConfig(cfg, isEmptyCfg)
-		if cfg.kind == premake.MAKEFILE and not isEmptyCfg then
+		if vstudio.isMakefile(cfg) and not isEmptyCfg then
 			return {
 				"VCNMakeTool"
 			}
 
 
 	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
 	function vc200x.configurationType(cfg)
 		local cfgtypes = {
 			Makefile = 0,
+			None = 0,
 			SharedLib = 2,
 			StaticLib = 4,
 		}

File src/actions/vstudio/vs2010.lua

 
 		-- 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"   },

File src/actions/vstudio/vs2010_vcxproj.lua

 			if cfg.flags.Managed then
 				isManaged = true
 			end
-			if cfg.kind == premake.MAKEFILE then
+			if vstudio.isMakefile(cfg) then
 				isMakefile = true
 			end
 		end
 	}
 
 	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
 --
 
 	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")
 	}
 
 	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>')
 
 
 	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
 
 
 	function vc2010.nmakeOutDirs(cfg)
-		if cfg.kind == premake.MAKEFILE then
+		if vstudio.isMakefile(cfg) then
 			vc2010.outDir(cfg)
 			vc2010.intDir(cfg)
 		end

File src/actions/vstudio/vs2012.lua

 
 		-- 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"   },

File src/base/premake.lua

 			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

File tests/actions/vstudio/vc200x/test_configuration.lua

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

File tests/actions/vstudio/vc200x/test_project.lua

 
 
 --
--- 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
 
 
 ---
 		]]
 	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
+

File tests/actions/vstudio/vc2010/test_config_props.lua

 	</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

File tests/actions/vstudio/vc2010/test_globals.lua

 		]]
 	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

File tests/actions/vstudio/vc2010/test_item_def_group.lua

 		]]
 	end
 
+	function suite.structureIsCorrect_onNone()
+		kind "Makefile"
+		prepare()
+		test.capture [[
+	<ItemDefinitionGroup>
+	</ItemDefinitionGroup>
+		]]
+	end
+
 
 
 --
 		prepare("Release")
 		test.isemptycapture()
 	end
+
+	function suite.skipped_onSubsequentConfigs_onNone()
+		kind "None"
+		prepare("Release")
+		test.isemptycapture()
+	end

File tests/actions/vstudio/vc2010/test_output_props.lua

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