2012-01-27 21:29:41 +00:00
|
|
|
--
|
|
|
|
-- tests/actions/vstudio/vc2010/test_globals.lua
|
|
|
|
-- Validate generation of the Globals property group.
|
2014-04-25 15:53:01 +00:00
|
|
|
-- Copyright (c) 2011-2014 Jason Perkins and the Premake project
|
2012-01-27 21:29:41 +00:00
|
|
|
--
|
|
|
|
|
2013-01-12 16:52:59 +00:00
|
|
|
local suite = test.declare("vstudio_vs2010_globals")
|
2012-01-27 21:29:41 +00:00
|
|
|
local vc2010 = premake.vstudio.vc2010
|
|
|
|
|
|
|
|
|
|
|
|
--
|
2013-01-12 16:52:59 +00:00
|
|
|
-- Setup
|
2012-01-27 21:29:41 +00:00
|
|
|
--
|
|
|
|
|
|
|
|
local sln, prj
|
2013-01-12 16:52:59 +00:00
|
|
|
|
2012-01-27 21:29:41 +00:00
|
|
|
function suite.setup()
|
2013-01-12 16:52:59 +00:00
|
|
|
_ACTION = "vs2010"
|
2012-01-27 21:29:41 +00:00
|
|
|
sln = test.createsolution()
|
|
|
|
end
|
2013-01-12 16:52:59 +00:00
|
|
|
|
2012-01-27 21:29:41 +00:00
|
|
|
local function prepare()
|
2013-09-13 15:52:00 +00:00
|
|
|
prj = premake.solution.getproject(sln, 1)
|
2012-01-27 21:29:41 +00:00
|
|
|
vc2010.globals(prj)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Check the structure with the default project values.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.structureIsCorrect_onDefaultValues()
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<PropertyGroup Label="Globals">
|
2013-01-12 16:52:59 +00:00
|
|
|
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
2012-01-27 01:40:39 +00:00
|
|
|
<Keyword>Win32Proj</Keyword>
|
|
|
|
<RootNamespace>MyProject</RootNamespace>
|
2012-01-27 21:29:41 +00:00
|
|
|
</PropertyGroup>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
2013-01-12 16:52:59 +00:00
|
|
|
|
2012-01-27 21:29:41 +00:00
|
|
|
--
|
|
|
|
-- Ensure CLR support gets enabled for Managed C++ projects.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.keywordIsCorrect_onManagedC()
|
2014-11-12 00:20:29 +00:00
|
|
|
clr "On"
|
2012-01-27 21:29:41 +00:00
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<PropertyGroup Label="Globals">
|
2013-01-12 16:52:59 +00:00
|
|
|
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
2012-01-27 01:40:39 +00:00
|
|
|
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
|
|
|
<Keyword>ManagedCProj</Keyword>
|
|
|
|
<RootNamespace>MyProject</RootNamespace>
|
2012-01-27 21:29:41 +00:00
|
|
|
</PropertyGroup>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
2013-01-12 16:52:59 +00:00
|
|
|
|
2013-09-30 14:53:16 +00:00
|
|
|
--
|
|
|
|
-- Ensure custom target framework version correct for Managed C++ projects.
|
|
|
|
--
|
|
|
|
|
2014-12-29 20:18:07 +00:00
|
|
|
function suite.frameworkVersionIsCorrect_onSpecificVersion()
|
2014-11-12 00:20:29 +00:00
|
|
|
clr "On"
|
2013-09-30 14:53:16 +00:00
|
|
|
framework "4.5"
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<PropertyGroup Label="Globals">
|
|
|
|
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
|
|
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
|
|
|
<Keyword>ManagedCProj</Keyword>
|
|
|
|
<RootNamespace>MyProject</RootNamespace>
|
|
|
|
</PropertyGroup>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
2014-12-29 20:18:07 +00:00
|
|
|
function suite.frameworkVersionIsCorrect_on2013()
|
|
|
|
_ACTION = "vs2013"
|
|
|
|
clr "On"
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<PropertyGroup Label="Globals">
|
|
|
|
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
|
|
|
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
|
|
|
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
|
|
|
<Keyword>ManagedCProj</Keyword>
|
|
|
|
<RootNamespace>MyProject</RootNamespace>
|
|
|
|
</PropertyGroup>
|
|
|
|
]]
|
|
|
|
end
|
2013-09-30 14:53:16 +00:00
|
|
|
|
2013-01-12 16:52:59 +00:00
|
|
|
--
|
|
|
|
-- Omit Keyword and RootNamespace for non-Windows projects.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.noKeyword_onNotWindows()
|
2014-12-18 21:41:58 +00:00
|
|
|
system "Linux"
|
2013-01-12 16:52:59 +00:00
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<PropertyGroup Label="Globals">
|
|
|
|
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
|
|
|
</PropertyGroup>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Include Keyword and RootNamespace for mixed system projects.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.includeKeyword_onMixedConfigs()
|
2014-04-25 15:53:01 +00:00
|
|
|
filter "Debug"
|
2013-01-12 16:52:59 +00:00
|
|
|
system "Windows"
|
2014-04-25 15:53:01 +00:00
|
|
|
filter "Release"
|
2014-12-18 21:41:58 +00:00
|
|
|
system "Linux"
|
2013-01-12 16:52:59 +00:00
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<PropertyGroup Label="Globals">
|
|
|
|
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
|
|
|
<Keyword>Win32Proj</Keyword>
|
|
|
|
<RootNamespace>MyProject</RootNamespace>
|
|
|
|
</PropertyGroup>
|
|
|
|
]]
|
|
|
|
end
|
2013-04-03 15:53:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Makefile projects set new keyword and drop the root namespace.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.keywordIsCorrect_onMakefile()
|
|
|
|
kind "Makefile"
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<PropertyGroup Label="Globals">
|
|
|
|
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
|
|
|
<Keyword>MakeFileProj</Keyword>
|
|
|
|
</PropertyGroup>
|
|
|
|
]]
|
|
|
|
end
|
2013-05-01 16:08:41 +00:00
|
|
|
|
2013-06-26 11:28:57 +00:00
|
|
|
function suite.keywordIsCorrect_onNone()
|
|
|
|
kind "None"
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<PropertyGroup Label="Globals">
|
|
|
|
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
|
|
|
<Keyword>MakeFileProj</Keyword>
|
|
|
|
</PropertyGroup>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
2013-05-01 16:08:41 +00:00
|
|
|
|
|
|
|
---
|
|
|
|
-- If the project name differs from the project filename, output a
|
|
|
|
-- <ProjectName> element to indicate that.
|
|
|
|
---
|
|
|
|
|
|
|
|
function suite.addsFilename_onDifferentFilename()
|
|
|
|
filename "MyProject_2012"
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<PropertyGroup Label="Globals">
|
|
|
|
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
|
|
|
<Keyword>Win32Proj</Keyword>
|
|
|
|
<RootNamespace>MyProject</RootNamespace>
|
|
|
|
<ProjectName>MyProject</ProjectName>
|
|
|
|
</PropertyGroup>
|
|
|
|
]]
|
|
|
|
end
|
2014-12-08 22:42:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- VS 2013 adds the <IgnoreWarnCompileDuplicatedFilename> to get rid
|
|
|
|
-- of spurious warnings when the same filename is present in different
|
|
|
|
-- configurations.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.structureIsCorrect_on2013()
|
|
|
|
_ACTION = "vs2013"
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<PropertyGroup Label="Globals">
|
|
|
|
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
|
|
|
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
|
|
|
|
<Keyword>Win32Proj</Keyword>
|
|
|
|
<RootNamespace>MyProject</RootNamespace>
|
|
|
|
</PropertyGroup>
|
|
|
|
]]
|
|
|
|
end
|