Merge pull request #822 from Blizzard/vstudio-to-module
Move VStudio action into a module.
This commit is contained in:
commit
9dc4da43ed
@ -9,6 +9,8 @@
|
||||
|
||||
m.visuald = {}
|
||||
|
||||
require ("vstudio")
|
||||
|
||||
local vstudio = p.vstudio
|
||||
local workspace = p.workspace
|
||||
local project = p.project
|
||||
|
23
modules/vstudio/_manifest.lua
Normal file
23
modules/vstudio/_manifest.lua
Normal file
@ -0,0 +1,23 @@
|
||||
return {
|
||||
"_preload.lua",
|
||||
"vstudio.lua",
|
||||
"vs2005.lua",
|
||||
"vs2008.lua",
|
||||
"vs200x_vcproj.lua",
|
||||
"vs200x_vcproj_user.lua",
|
||||
"vs2005_solution.lua",
|
||||
"vs2005_csproj.lua",
|
||||
"vs2005_csproj_user.lua",
|
||||
"vs2010.lua",
|
||||
"vs2010_nuget.lua",
|
||||
"vs2010_vcxproj.lua",
|
||||
"vs2010_vcxproj_user.lua",
|
||||
"vs2010_vcxproj_filters.lua",
|
||||
"vs2010_rules_props.lua",
|
||||
"vs2010_rules_targets.lua",
|
||||
"vs2010_rules_xml.lua",
|
||||
"vs2012.lua",
|
||||
"vs2013.lua",
|
||||
"vs2015.lua",
|
||||
"vs2017.lua",
|
||||
}
|
37
modules/vstudio/_preload.lua
Normal file
37
modules/vstudio/_preload.lua
Normal file
@ -0,0 +1,37 @@
|
||||
--
|
||||
-- _preload.lua
|
||||
-- Define the makefile action(s).
|
||||
-- Copyright (c) 2002-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local project = p.project
|
||||
|
||||
-- initialize module.
|
||||
p.modules.vstudio = p.modules.vstudio or {}
|
||||
p.modules.vstudio._VERSION = p._VERSION
|
||||
p.vstudio = p.modules.vstudio
|
||||
|
||||
-- load actions.
|
||||
include("vs2005.lua")
|
||||
include("vs2008.lua")
|
||||
include("vs2010.lua")
|
||||
include("vs2012.lua")
|
||||
include("vs2013.lua")
|
||||
include("vs2015.lua")
|
||||
include("vs2017.lua")
|
||||
|
||||
--
|
||||
-- Decide when the full module should be loaded.
|
||||
--
|
||||
|
||||
return function(cfg)
|
||||
return
|
||||
_ACTION == "vs2005" or
|
||||
_ACTION == "vs2008" or
|
||||
_ACTION == "vs2010" or
|
||||
_ACTION == "vs2012" or
|
||||
_ACTION == "vs2013" or
|
||||
_ACTION == "vs2015" or
|
||||
_ACTION == "vs2017";
|
||||
end
|
86
modules/vstudio/tests/_tests.lua
Normal file
86
modules/vstudio/tests/_tests.lua
Normal file
@ -0,0 +1,86 @@
|
||||
require ("vstudio")
|
||||
|
||||
return {
|
||||
-- Visual Studio 2005-2013 C# projects
|
||||
"cs2005/test_assembly_refs.lua",
|
||||
"cs2005/test_build_events.lua",
|
||||
"cs2005/test_common_props.lua",
|
||||
"cs2005/test_compiler_props.lua",
|
||||
"cs2005/test_debug_props.lua",
|
||||
"cs2005/test_files.lua",
|
||||
"cs2005/test_icon.lua",
|
||||
"cs2005/test_nuget_config.lua",
|
||||
"cs2005/test_nuget_packages_config.lua",
|
||||
"cs2005/test_output_props.lua",
|
||||
"cs2005/projectelement.lua",
|
||||
"cs2005/test_platform_groups.lua",
|
||||
"cs2005/test_project_refs.lua",
|
||||
"cs2005/projectsettings.lua",
|
||||
"cs2005/test_targets.lua",
|
||||
"cs2005/test_user_file.lua",
|
||||
|
||||
-- Visual Studio 2005-2013 solutions
|
||||
"sln2005/test_dependencies.lua",
|
||||
"sln2005/test_header.lua",
|
||||
"sln2005/test_nested_projects.lua",
|
||||
"sln2005/test_projects.lua",
|
||||
"sln2005/test_platforms.lua",
|
||||
"sln2005/test_sections.lua",
|
||||
|
||||
-- Visual Studio 2002-2008 C/C++ projects
|
||||
"vc200x/test_assembly_refs.lua",
|
||||
"vc200x/test_build_steps.lua",
|
||||
"vc200x/test_configuration.lua",
|
||||
"vc200x/test_compiler_block.lua",
|
||||
"vc200x/test_debug_settings.lua",
|
||||
"vc200x/test_excluded_configs.lua",
|
||||
"vc200x/test_files.lua",
|
||||
"vc200x/test_linker_block.lua",
|
||||
"vc200x/test_manifest_block.lua",
|
||||
"vc200x/test_nmake_settings.lua",
|
||||
"vc200x/test_platforms.lua",
|
||||
"vc200x/test_project.lua",
|
||||
"vc200x/test_project_refs.lua",
|
||||
"vc200x/test_resource_compiler.lua",
|
||||
"vc200x/test_user_file.lua",
|
||||
|
||||
-- Visual Studio 2010-2013 C/C++ projects
|
||||
"vc2010/test_assembly_refs.lua",
|
||||
"vc2010/test_build_events.lua",
|
||||
"vc2010/test_build_log.lua",
|
||||
"vc2010/test_character_set.lua",
|
||||
"vc2010/test_compile_settings.lua",
|
||||
"vc2010/test_config_props.lua",
|
||||
"vc2010/test_debug_settings.lua",
|
||||
"vc2010/test_excluded_configs.lua",
|
||||
"vc2010/test_extension_settings.lua",
|
||||
"vc2010/test_extension_targets.lua",
|
||||
"vc2010/test_language_settings.lua",
|
||||
"vc2010/test_language_targets.lua",
|
||||
"vc2010/test_floatingpoint.lua",
|
||||
"vc2010/test_globals.lua",
|
||||
"vc2010/test_header.lua",
|
||||
"vc2010/test_files.lua",
|
||||
"vc2010/test_filter_ids.lua",
|
||||
"vc2010/test_filters.lua",
|
||||
"vc2010/test_imagexex_settings.lua",
|
||||
"vc2010/test_item_def_group.lua",
|
||||
"vc2010/test_link.lua",
|
||||
"vc2010/test_manifest.lua",
|
||||
"vc2010/test_nmake_props.lua",
|
||||
"vc2010/test_nuget_packages_config.lua",
|
||||
"vc2010/test_output_props.lua",
|
||||
"vc2010/test_platform_toolset.lua",
|
||||
"vc2010/test_project_configs.lua",
|
||||
"vc2010/test_project_refs.lua",
|
||||
"vc2010/test_prop_sheet.lua",
|
||||
"vc2010/test_resource_compile.lua",
|
||||
"vc2010/test_rule_props.lua",
|
||||
"vc2010/test_rule_targets.lua",
|
||||
"vc2010/test_rule_vars.lua",
|
||||
"vc2010/test_rule_xml.lua",
|
||||
"vc2010/test_target_machine.lua",
|
||||
"vc2010/test_user_file.lua",
|
||||
"vc2010/test_vectorextensions.lua",
|
||||
"vc2010/test_ensure_nuget_imports.lua",
|
||||
}
|
0
tests/actions/vstudio/cs2005/projectelement.lua → modules/vstudio/tests/cs2005/projectelement.lua
Executable file → Normal file
0
tests/actions/vstudio/cs2005/projectelement.lua → modules/vstudio/tests/cs2005/projectelement.lua
Executable file → Normal file
414
tests/actions/vstudio/cs2005/projectsettings.lua → modules/vstudio/tests/cs2005/projectsettings.lua
Executable file → Normal file
414
tests/actions/vstudio/cs2005/projectsettings.lua → modules/vstudio/tests/cs2005/projectsettings.lua
Executable file → Normal file
@ -1,207 +1,207 @@
|
||||
--
|
||||
-- tests/actions/vstudio/cs2005/projectsettings.lua
|
||||
-- Validate generation of root <PropertyGroup/> in Visual Studio 2005+ .csproj
|
||||
-- Copyright (c) 2009-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_cs2005_projectsettings")
|
||||
local cs2005 = p.vstudio.cs2005
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2005")
|
||||
wks = test.createWorkspace()
|
||||
language "C#"
|
||||
uuid "AE61726D-187C-E440-BD07-2556188A6565"
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
prj = test.getproject(wks, 1)
|
||||
cs2005.projectProperties(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Version Tests
|
||||
--
|
||||
|
||||
function suite.OnVs2005()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{AE61726D-187C-E440-BD07-2556188A6565}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
<AssemblyName>MyProject</AssemblyName>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.OnVs2008()
|
||||
p.action.set("vs2008")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{AE61726D-187C-E440-BD07-2556188A6565}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
<AssemblyName>MyProject</AssemblyName>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.OnVs2010()
|
||||
p.action.set("vs2010")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{AE61726D-187C-E440-BD07-2556188A6565}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
<AssemblyName>MyProject</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.onVs2012()
|
||||
p.action.set("vs2012")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{AE61726D-187C-E440-BD07-2556188A6565}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
<AssemblyName>MyProject</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Framework Tests
|
||||
--
|
||||
|
||||
function suite.OnFrameworkVersion()
|
||||
framework "3.0"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{AE61726D-187C-E440-BD07-2556188A6565}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
<AssemblyName>MyProject</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.OnDotNetFrameworkVersion()
|
||||
dotnetframework "3.0"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{AE61726D-187C-E440-BD07-2556188A6565}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
<AssemblyName>MyProject</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Make sure the root namespace can be overridden.
|
||||
--
|
||||
|
||||
function suite.canOverrideRootNamespace()
|
||||
namespace "MyCompany.%{prj.name}"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{AE61726D-187C-E440-BD07-2556188A6565}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MyCompany.MyProject</RootNamespace>
|
||||
<AssemblyName>MyProject</AssemblyName>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- WPF adds an additional element.
|
||||
--
|
||||
|
||||
function suite.projectTypeGuids_onWPF()
|
||||
p.action.set("vs2010")
|
||||
flags { "WPF" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{AE61726D-187C-E440-BD07-2556188A6565}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
<AssemblyName>MyProject</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
--
|
||||
-- tests/actions/vstudio/cs2005/projectsettings.lua
|
||||
-- Validate generation of root <PropertyGroup/> in Visual Studio 2005+ .csproj
|
||||
-- Copyright (c) 2009-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_cs2005_projectsettings")
|
||||
local cs2005 = p.vstudio.cs2005
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2005")
|
||||
wks = test.createWorkspace()
|
||||
language "C#"
|
||||
uuid "AE61726D-187C-E440-BD07-2556188A6565"
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
prj = test.getproject(wks, 1)
|
||||
cs2005.projectProperties(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Version Tests
|
||||
--
|
||||
|
||||
function suite.OnVs2005()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{AE61726D-187C-E440-BD07-2556188A6565}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
<AssemblyName>MyProject</AssemblyName>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.OnVs2008()
|
||||
p.action.set("vs2008")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{AE61726D-187C-E440-BD07-2556188A6565}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
<AssemblyName>MyProject</AssemblyName>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.OnVs2010()
|
||||
p.action.set("vs2010")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{AE61726D-187C-E440-BD07-2556188A6565}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
<AssemblyName>MyProject</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.onVs2012()
|
||||
p.action.set("vs2012")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{AE61726D-187C-E440-BD07-2556188A6565}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
<AssemblyName>MyProject</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Framework Tests
|
||||
--
|
||||
|
||||
function suite.OnFrameworkVersion()
|
||||
framework "3.0"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{AE61726D-187C-E440-BD07-2556188A6565}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
<AssemblyName>MyProject</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.OnDotNetFrameworkVersion()
|
||||
dotnetframework "3.0"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{AE61726D-187C-E440-BD07-2556188A6565}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
<AssemblyName>MyProject</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Make sure the root namespace can be overridden.
|
||||
--
|
||||
|
||||
function suite.canOverrideRootNamespace()
|
||||
namespace "MyCompany.%{prj.name}"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{AE61726D-187C-E440-BD07-2556188A6565}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MyCompany.MyProject</RootNamespace>
|
||||
<AssemblyName>MyProject</AssemblyName>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- WPF adds an additional element.
|
||||
--
|
||||
|
||||
function suite.projectTypeGuids_onWPF()
|
||||
p.action.set("vs2010")
|
||||
flags { "WPF" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{AE61726D-187C-E440-BD07-2556188A6565}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
<AssemblyName>MyProject</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
@ -1,39 +1,39 @@
|
||||
--
|
||||
-- tests/actions/vstudio/cs2005/test_common_props.lua
|
||||
-- Check Visual Studio 2012 extensions to the project properties block.
|
||||
-- Copyright (c) 2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs2012_csproj_common_props")
|
||||
local cs2005 = p.vstudio.cs2005
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2012")
|
||||
wks = test.createWorkspace()
|
||||
language "C#"
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
prj = test.getproject(wks, 1)
|
||||
cs2005.commonProperties(prj)
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Visual Studio 2012 omits <ProductVersion> and <SchemaVersion>.
|
||||
---
|
||||
|
||||
function suite.onDefaultCommonProps()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
]]
|
||||
end
|
||||
--
|
||||
-- tests/actions/vstudio/cs2005/test_common_props.lua
|
||||
-- Check Visual Studio 2012 extensions to the project properties block.
|
||||
-- Copyright (c) 2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs2012_csproj_common_props")
|
||||
local cs2005 = p.vstudio.cs2005
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2012")
|
||||
wks = test.createWorkspace()
|
||||
language "C#"
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
prj = test.getproject(wks, 1)
|
||||
cs2005.commonProperties(prj)
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Visual Studio 2012 omits <ProductVersion> and <SchemaVersion>.
|
||||
---
|
||||
|
||||
function suite.onDefaultCommonProps()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
]]
|
||||
end
|
0
tests/actions/vstudio/cs2005/test_files.lua → modules/vstudio/tests/cs2005/test_files.lua
Executable file → Normal file
0
tests/actions/vstudio/cs2005/test_files.lua → modules/vstudio/tests/cs2005/test_files.lua
Executable file → Normal file
@ -1,46 +1,46 @@
|
||||
--
|
||||
-- tests/actions/vstudio/cs2005/test_targets.lua
|
||||
-- Check Visual Studio 2012 extensions to the targets block.
|
||||
-- Copyright (c) 2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs2012_csproj_targets")
|
||||
local cs2005 = p.vstudio.cs2005
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2012")
|
||||
wks = test.createWorkspace()
|
||||
language "C#"
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
prj = test.getproject(wks, 1)
|
||||
cs2005.targets(prj)
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Visual Studio 2012 changes the MS Build path slightly.
|
||||
---
|
||||
|
||||
function suite.on2012()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
]]
|
||||
end
|
||||
--
|
||||
-- tests/actions/vstudio/cs2005/test_targets.lua
|
||||
-- Check Visual Studio 2012 extensions to the targets block.
|
||||
-- Copyright (c) 2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs2012_csproj_targets")
|
||||
local cs2005 = p.vstudio.cs2005
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2012")
|
||||
wks = test.createWorkspace()
|
||||
language "C#"
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
prj = test.getproject(wks, 1)
|
||||
cs2005.targets(prj)
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Visual Studio 2012 changes the MS Build path slightly.
|
||||
---
|
||||
|
||||
function suite.on2012()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
]]
|
||||
end
|
194
tests/actions/vstudio/sln2005/test_dependencies.lua → modules/vstudio/tests/sln2005/test_dependencies.lua
Executable file → Normal file
194
tests/actions/vstudio/sln2005/test_dependencies.lua → modules/vstudio/tests/sln2005/test_dependencies.lua
Executable file → Normal file
@ -1,97 +1,97 @@
|
||||
--
|
||||
-- tests/actions/vstudio/sln2005/test_dependencies.lua
|
||||
-- Validate generation of Visual Studio 2005+ solution project dependencies.
|
||||
-- Copyright (c) 2009-2012 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_sln2005_dependencies")
|
||||
local sln2005 = p.vstudio.sln2005
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj1, prj2
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2005")
|
||||
wks, prj1 = test.createWorkspace()
|
||||
uuid "AE61726D-187C-E440-BD07-2556188A6565"
|
||||
prj2 = test.createproject(wks)
|
||||
uuid "2151E83B-997F-4A9D-955D-380157E88C31"
|
||||
prj3 = test.createproject(wks)
|
||||
uuid "CAA68162-8B96-11E1-8D5E-5885BBE59B18"
|
||||
links "MyProject"
|
||||
dependson "MyProject2"
|
||||
end
|
||||
|
||||
local function prepare(language)
|
||||
prj1.language = language
|
||||
prj2.language = language
|
||||
prj2 = test.getproject(wks, 2)
|
||||
sln2005.projectdependencies(prj2)
|
||||
prj3.language = language
|
||||
prj3 = test.getproject(wks, 3)
|
||||
sln2005.projectdependencies(prj3)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify dependencies between C++ projects are listed.
|
||||
--
|
||||
function suite.dependency_onCppProjects()
|
||||
prepare("C++")
|
||||
test.capture [[
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{2151E83B-997F-4A9D-955D-380157E88C31} = {2151E83B-997F-4A9D-955D-380157E88C31}
|
||||
EndProjectSection
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify dependencies between C# projects are listed.
|
||||
--
|
||||
|
||||
function suite.dependency_onCSharpProjects()
|
||||
prepare("C#")
|
||||
test.capture [[
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{2151E83B-997F-4A9D-955D-380157E88C31} = {2151E83B-997F-4A9D-955D-380157E88C31}
|
||||
EndProjectSection
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Most C# references should go into the project rather than the solution,
|
||||
-- but until I know the conditions, put everything here to be safe.
|
||||
--
|
||||
|
||||
function suite.dependency_onCSharpProjectsVs2010()
|
||||
p.action.set("vs2010")
|
||||
prepare("C#")
|
||||
test.capture [[
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{2151E83B-997F-4A9D-955D-380157E88C31} = {2151E83B-997F-4A9D-955D-380157E88C31}
|
||||
EndProjectSection
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Verify dependencies between projects C# are listed for VS2012.
|
||||
--
|
||||
|
||||
function suite.dependency_onCSharpProjectsVs2012()
|
||||
p.action.set("vs2012")
|
||||
prepare("C#")
|
||||
test.capture [[
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{2151E83B-997F-4A9D-955D-380157E88C31} = {2151E83B-997F-4A9D-955D-380157E88C31}
|
||||
EndProjectSection
|
||||
]]
|
||||
end
|
||||
--
|
||||
-- tests/actions/vstudio/sln2005/test_dependencies.lua
|
||||
-- Validate generation of Visual Studio 2005+ solution project dependencies.
|
||||
-- Copyright (c) 2009-2012 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_sln2005_dependencies")
|
||||
local sln2005 = p.vstudio.sln2005
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj1, prj2
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2005")
|
||||
wks, prj1 = test.createWorkspace()
|
||||
uuid "AE61726D-187C-E440-BD07-2556188A6565"
|
||||
prj2 = test.createproject(wks)
|
||||
uuid "2151E83B-997F-4A9D-955D-380157E88C31"
|
||||
prj3 = test.createproject(wks)
|
||||
uuid "CAA68162-8B96-11E1-8D5E-5885BBE59B18"
|
||||
links "MyProject"
|
||||
dependson "MyProject2"
|
||||
end
|
||||
|
||||
local function prepare(language)
|
||||
prj1.language = language
|
||||
prj2.language = language
|
||||
prj2 = test.getproject(wks, 2)
|
||||
sln2005.projectdependencies(prj2)
|
||||
prj3.language = language
|
||||
prj3 = test.getproject(wks, 3)
|
||||
sln2005.projectdependencies(prj3)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify dependencies between C++ projects are listed.
|
||||
--
|
||||
function suite.dependency_onCppProjects()
|
||||
prepare("C++")
|
||||
test.capture [[
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{2151E83B-997F-4A9D-955D-380157E88C31} = {2151E83B-997F-4A9D-955D-380157E88C31}
|
||||
EndProjectSection
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify dependencies between C# projects are listed.
|
||||
--
|
||||
|
||||
function suite.dependency_onCSharpProjects()
|
||||
prepare("C#")
|
||||
test.capture [[
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{2151E83B-997F-4A9D-955D-380157E88C31} = {2151E83B-997F-4A9D-955D-380157E88C31}
|
||||
EndProjectSection
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Most C# references should go into the project rather than the solution,
|
||||
-- but until I know the conditions, put everything here to be safe.
|
||||
--
|
||||
|
||||
function suite.dependency_onCSharpProjectsVs2010()
|
||||
p.action.set("vs2010")
|
||||
prepare("C#")
|
||||
test.capture [[
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{2151E83B-997F-4A9D-955D-380157E88C31} = {2151E83B-997F-4A9D-955D-380157E88C31}
|
||||
EndProjectSection
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Verify dependencies between projects C# are listed for VS2012.
|
||||
--
|
||||
|
||||
function suite.dependency_onCSharpProjectsVs2012()
|
||||
p.action.set("vs2012")
|
||||
prepare("C#")
|
||||
test.capture [[
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{2151E83B-997F-4A9D-955D-380157E88C31} = {2151E83B-997F-4A9D-955D-380157E88C31}
|
||||
EndProjectSection
|
||||
]]
|
||||
end
|
0
tests/actions/vstudio/sln2005/test_header.lua → modules/vstudio/tests/sln2005/test_header.lua
Executable file → Normal file
0
tests/actions/vstudio/sln2005/test_header.lua → modules/vstudio/tests/sln2005/test_header.lua
Executable file → Normal file
0
tests/actions/vstudio/sln2005/test_projects.lua → modules/vstudio/tests/sln2005/test_projects.lua
Executable file → Normal file
0
tests/actions/vstudio/sln2005/test_projects.lua → modules/vstudio/tests/sln2005/test_projects.lua
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
246
tests/actions/vstudio/vc200x/test_configuration.lua → modules/vstudio/tests/vc200x/test_configuration.lua
Executable file → Normal file
246
tests/actions/vstudio/vc200x/test_configuration.lua → modules/vstudio/tests/vc200x/test_configuration.lua
Executable file → Normal file
@ -1,123 +1,123 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc200x/test_configuration.lua
|
||||
-- Test the Visual Studio 2002-2008 project's Configuration block
|
||||
-- Copyright (c) 2009-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vc200x_configuration")
|
||||
local vstudio = p.vstudio
|
||||
local vc200x = p.vstudio.vc200x
|
||||
local project = p.project
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2008")
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local cfg = test.getconfig(prj, "Debug", (prj.platforms or wks.platforms or {})[1])
|
||||
vc200x.configuration(cfg, vstudio.projectConfig(cfg))
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the results of generating with the default project settings
|
||||
-- (C++ console application).
|
||||
--
|
||||
|
||||
function suite.defaultSettings()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="bin\Debug"
|
||||
IntermediateDirectory="obj\Debug"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a platform is specified, it should be included in the platform name.
|
||||
--
|
||||
|
||||
function suite.usesWin32_onX86()
|
||||
workspace("MyWorkspace")
|
||||
platforms { "x86" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the x64 architecture handling.
|
||||
--
|
||||
|
||||
function suite.usesX64Architecture_onX86_64Platform()
|
||||
platforms { "x86_64" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- The output directory should use backslashes
|
||||
--
|
||||
|
||||
function suite.escapesOutputDir()
|
||||
targetdir("../bin")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="..\bin"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Makefiles set the configuration type and drop the
|
||||
-- character encoding.
|
||||
--
|
||||
|
||||
function suite.defaultSettings_onMakefile()
|
||||
kind "Makefile"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="bin\Debug"
|
||||
IntermediateDirectory="obj\Debug"
|
||||
ConfigurationType="0"
|
||||
>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.defaultSettings_onNone()
|
||||
kind "None"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="bin\Debug"
|
||||
IntermediateDirectory="obj\Debug"
|
||||
ConfigurationType="0"
|
||||
>
|
||||
]]
|
||||
end
|
||||
--
|
||||
-- tests/actions/vstudio/vc200x/test_configuration.lua
|
||||
-- Test the Visual Studio 2002-2008 project's Configuration block
|
||||
-- Copyright (c) 2009-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vc200x_configuration")
|
||||
local vstudio = p.vstudio
|
||||
local vc200x = p.vstudio.vc200x
|
||||
local project = p.project
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2008")
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local cfg = test.getconfig(prj, "Debug", (prj.platforms or wks.platforms or {})[1])
|
||||
vc200x.configuration(cfg, vstudio.projectConfig(cfg))
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the results of generating with the default project settings
|
||||
-- (C++ console application).
|
||||
--
|
||||
|
||||
function suite.defaultSettings()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="bin\Debug"
|
||||
IntermediateDirectory="obj\Debug"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a platform is specified, it should be included in the platform name.
|
||||
--
|
||||
|
||||
function suite.usesWin32_onX86()
|
||||
workspace("MyWorkspace")
|
||||
platforms { "x86" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the x64 architecture handling.
|
||||
--
|
||||
|
||||
function suite.usesX64Architecture_onX86_64Platform()
|
||||
platforms { "x86_64" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- The output directory should use backslashes
|
||||
--
|
||||
|
||||
function suite.escapesOutputDir()
|
||||
targetdir("../bin")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="..\bin"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Makefiles set the configuration type and drop the
|
||||
-- character encoding.
|
||||
--
|
||||
|
||||
function suite.defaultSettings_onMakefile()
|
||||
kind "Makefile"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="bin\Debug"
|
||||
IntermediateDirectory="obj\Debug"
|
||||
ConfigurationType="0"
|
||||
>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.defaultSettings_onNone()
|
||||
kind "None"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="bin\Debug"
|
||||
IntermediateDirectory="obj\Debug"
|
||||
ConfigurationType="0"
|
||||
>
|
||||
]]
|
||||
end
|
File diff suppressed because it is too large
Load Diff
@ -1,278 +1,278 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc200x/test_linker_block.lua
|
||||
-- Validate generation of VCLinkerTool blocks in Visual Studio 200x C/C++ projects.
|
||||
-- Copyright (c) 2009-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs200x_linker_block")
|
||||
local vc200x = p.vstudio.vc200x
|
||||
|
||||
|
||||
--
|
||||
-- Setup/teardown
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2008")
|
||||
p.escaper(p.vstudio.vs2005.esc)
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
vc200x.VCLinkerTool(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the basic structure of the console app linker block.
|
||||
--
|
||||
|
||||
function suite.onConsoleApp()
|
||||
kind "ConsoleApp"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\MyProject.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="false"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the basic structure of windowed app linker block.
|
||||
--
|
||||
|
||||
function suite.onWindowedApp()
|
||||
kind "WindowedApp"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\MyProject.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="false"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the basic structure of shared library linker block.
|
||||
--
|
||||
|
||||
function suite.onSharedLib()
|
||||
kind "SharedLib"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\MyProject.dll"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="false"
|
||||
SubSystem="2"
|
||||
ImportLibrary="bin\Debug\MyProject.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the basic structure of static library linker block.
|
||||
--
|
||||
|
||||
function suite.onStaticLib()
|
||||
kind "StaticLib"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)\MyProject.lib"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the handling of the Symbols flag.
|
||||
--
|
||||
|
||||
function suite.onSymbolsFlag()
|
||||
symbols "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\MyProject.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the handling of the C7 debug information format.
|
||||
--
|
||||
|
||||
function suite.onC7DebugFormat()
|
||||
symbols "On"
|
||||
debugformat "C7"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\MyProject.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a module definition file is present, make sure it is specified.
|
||||
--
|
||||
|
||||
function suite.onModuleDefinitionFile()
|
||||
files { "MyProject.def" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\MyProject.exe"
|
||||
LinkIncremental="2"
|
||||
ModuleDefinitionFile="MyProject.def"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify handling of the NoIncrementalLink flag.
|
||||
--
|
||||
|
||||
function suite.onNoIncrementalLink()
|
||||
flags { "NoIncrementalLink" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\MyProject.exe"
|
||||
LinkIncremental="1"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify that link options are specified.
|
||||
--
|
||||
|
||||
function suite.additionalOptionsUsed_onStaticLib()
|
||||
kind "StaticLib"
|
||||
linkoptions { "/ltcg", "/lZ" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
AdditionalOptions="/ltcg /lZ"
|
||||
OutputFile="$(OutDir)\MyProject.lib"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Links to system libraries should appear in the list, properly decorated.
|
||||
--
|
||||
|
||||
function suite.includesSystemLibs()
|
||||
links { "GL", "GLU" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="GL.lib GLU.lib"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Links to sibling projects should not appear in the list; Visual Studio
|
||||
-- will link to those automatically.
|
||||
--
|
||||
|
||||
function suite.excludesSiblings()
|
||||
links { "MyProject2" }
|
||||
project ("MyProject2")
|
||||
kind "StaticLib"
|
||||
language "C++"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\MyProject.exe"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If the NoImplicitLinking flag is set, sibling projects should
|
||||
-- then be added to the list.
|
||||
--
|
||||
|
||||
function suite.includesSiblings_onNoImplicitLink()
|
||||
flags { "NoImplicitLink" }
|
||||
links { "MyProject2" }
|
||||
project ("MyProject2")
|
||||
kind "StaticLib"
|
||||
language "C++"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkLibraryDependencies="false"
|
||||
AdditionalDependencies="bin\Debug\MyProject2.lib"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Libraries with spaces in the name must be wrapped in quotes.
|
||||
--
|
||||
|
||||
function suite.wrapsWithQuotes_onSpaceInLibraryName()
|
||||
links { "My Lib" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies=""My Lib.lib""
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Managed assembly references should not be listed in additional dependencies.
|
||||
--
|
||||
|
||||
function suite.ignoresAssemblyReferences()
|
||||
links { "kernel32", "System.dll", "System.Data.dll" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib"
|
||||
]]
|
||||
end
|
||||
--
|
||||
-- tests/actions/vstudio/vc200x/test_linker_block.lua
|
||||
-- Validate generation of VCLinkerTool blocks in Visual Studio 200x C/C++ projects.
|
||||
-- Copyright (c) 2009-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs200x_linker_block")
|
||||
local vc200x = p.vstudio.vc200x
|
||||
|
||||
|
||||
--
|
||||
-- Setup/teardown
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2008")
|
||||
p.escaper(p.vstudio.vs2005.esc)
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
vc200x.VCLinkerTool(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the basic structure of the console app linker block.
|
||||
--
|
||||
|
||||
function suite.onConsoleApp()
|
||||
kind "ConsoleApp"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\MyProject.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="false"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the basic structure of windowed app linker block.
|
||||
--
|
||||
|
||||
function suite.onWindowedApp()
|
||||
kind "WindowedApp"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\MyProject.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="false"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the basic structure of shared library linker block.
|
||||
--
|
||||
|
||||
function suite.onSharedLib()
|
||||
kind "SharedLib"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\MyProject.dll"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="false"
|
||||
SubSystem="2"
|
||||
ImportLibrary="bin\Debug\MyProject.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the basic structure of static library linker block.
|
||||
--
|
||||
|
||||
function suite.onStaticLib()
|
||||
kind "StaticLib"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)\MyProject.lib"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the handling of the Symbols flag.
|
||||
--
|
||||
|
||||
function suite.onSymbolsFlag()
|
||||
symbols "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\MyProject.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the handling of the C7 debug information format.
|
||||
--
|
||||
|
||||
function suite.onC7DebugFormat()
|
||||
symbols "On"
|
||||
debugformat "C7"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\MyProject.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a module definition file is present, make sure it is specified.
|
||||
--
|
||||
|
||||
function suite.onModuleDefinitionFile()
|
||||
files { "MyProject.def" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\MyProject.exe"
|
||||
LinkIncremental="2"
|
||||
ModuleDefinitionFile="MyProject.def"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify handling of the NoIncrementalLink flag.
|
||||
--
|
||||
|
||||
function suite.onNoIncrementalLink()
|
||||
flags { "NoIncrementalLink" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\MyProject.exe"
|
||||
LinkIncremental="1"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify that link options are specified.
|
||||
--
|
||||
|
||||
function suite.additionalOptionsUsed_onStaticLib()
|
||||
kind "StaticLib"
|
||||
linkoptions { "/ltcg", "/lZ" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
AdditionalOptions="/ltcg /lZ"
|
||||
OutputFile="$(OutDir)\MyProject.lib"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Links to system libraries should appear in the list, properly decorated.
|
||||
--
|
||||
|
||||
function suite.includesSystemLibs()
|
||||
links { "GL", "GLU" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="GL.lib GLU.lib"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Links to sibling projects should not appear in the list; Visual Studio
|
||||
-- will link to those automatically.
|
||||
--
|
||||
|
||||
function suite.excludesSiblings()
|
||||
links { "MyProject2" }
|
||||
project ("MyProject2")
|
||||
kind "StaticLib"
|
||||
language "C++"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\MyProject.exe"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If the NoImplicitLinking flag is set, sibling projects should
|
||||
-- then be added to the list.
|
||||
--
|
||||
|
||||
function suite.includesSiblings_onNoImplicitLink()
|
||||
flags { "NoImplicitLink" }
|
||||
links { "MyProject2" }
|
||||
project ("MyProject2")
|
||||
kind "StaticLib"
|
||||
language "C++"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkLibraryDependencies="false"
|
||||
AdditionalDependencies="bin\Debug\MyProject2.lib"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Libraries with spaces in the name must be wrapped in quotes.
|
||||
--
|
||||
|
||||
function suite.wrapsWithQuotes_onSpaceInLibraryName()
|
||||
links { "My Lib" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies=""My Lib.lib""
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Managed assembly references should not be listed in additional dependencies.
|
||||
--
|
||||
|
||||
function suite.ignoresAssemblyReferences()
|
||||
links { "kernel32", "System.dll", "System.Data.dll" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib"
|
||||
]]
|
||||
end
|
114
tests/actions/vstudio/vc200x/test_manifest_block.lua → modules/vstudio/tests/vc200x/test_manifest_block.lua
Executable file → Normal file
114
tests/actions/vstudio/vc200x/test_manifest_block.lua → modules/vstudio/tests/vc200x/test_manifest_block.lua
Executable file → Normal file
@ -1,57 +1,57 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc200x/test_manifest_block.lua
|
||||
-- Validate generation of VCManifest elements Visual Studio 200x C/C++ projects.
|
||||
-- Copyright (c) 2009-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs200x_manifest_block")
|
||||
local vc200x = p.vstudio.vc200x
|
||||
|
||||
|
||||
--
|
||||
-- Setup/teardown
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2008")
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
vc200x.VCManifestTool(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- The manifest tool should empty if there are no manifest files.
|
||||
--
|
||||
|
||||
function suite.isEmpty_onNoManifests()
|
||||
files { "hello.c" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If manifest file(s) are present, they should be listed.
|
||||
--
|
||||
|
||||
function suite.listsFiles_onManifests()
|
||||
files { "hello.c", "project1.manifest", "goodbye.c", "project2.manifest" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
AdditionalManifestFiles="project1.manifest;project2.manifest"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
--
|
||||
-- tests/actions/vstudio/vc200x/test_manifest_block.lua
|
||||
-- Validate generation of VCManifest elements Visual Studio 200x C/C++ projects.
|
||||
-- Copyright (c) 2009-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs200x_manifest_block")
|
||||
local vc200x = p.vstudio.vc200x
|
||||
|
||||
|
||||
--
|
||||
-- Setup/teardown
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2008")
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
vc200x.VCManifestTool(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- The manifest tool should empty if there are no manifest files.
|
||||
--
|
||||
|
||||
function suite.isEmpty_onNoManifests()
|
||||
files { "hello.c" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If manifest file(s) are present, they should be listed.
|
||||
--
|
||||
|
||||
function suite.listsFiles_onManifests()
|
||||
files { "hello.c", "project1.manifest", "goodbye.c", "project2.manifest" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
AdditionalManifestFiles="project1.manifest;project2.manifest"
|
||||
/>
|
||||
]]
|
||||
end
|
194
tests/actions/vstudio/vc200x/test_platforms.lua → modules/vstudio/tests/vc200x/test_platforms.lua
Executable file → Normal file
194
tests/actions/vstudio/vc200x/test_platforms.lua → modules/vstudio/tests/vc200x/test_platforms.lua
Executable file → Normal file
@ -1,97 +1,97 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc200x/test_platforms.lua
|
||||
-- Test the Visual Studio 2002-2008 project's Platforms block
|
||||
-- Copyright (c) 2009-2012 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vc200x_platforms")
|
||||
local vc200x = p.vstudio.vc200x
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2008")
|
||||
wks = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
prj = test.getproject(wks, 1)
|
||||
vc200x.platforms(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If no architectures are specified, Win32 should be the default.
|
||||
--
|
||||
|
||||
function suite.win32Listed_onNoPlatforms()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If multiple configurations use the same architecture, it should
|
||||
-- still only be listed once.
|
||||
--
|
||||
|
||||
function suite.architectureListedOnlyOnce_onMultipleConfigurations()
|
||||
platforms { "Static", "Dynamic" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If multiple architectures are used, they should all be listed.
|
||||
--
|
||||
|
||||
function suite.allArchitecturesListed_onMultipleArchitectures()
|
||||
platforms { "x86", "x86_64" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the Xbox360 platform.
|
||||
--
|
||||
|
||||
function suite.platformIsCorrect_onXbox360()
|
||||
platforms { "Xbox360" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Xbox 360"
|
||||
/>
|
||||
</Platforms>
|
||||
]]
|
||||
end
|
||||
--
|
||||
-- tests/actions/vstudio/vc200x/test_platforms.lua
|
||||
-- Test the Visual Studio 2002-2008 project's Platforms block
|
||||
-- Copyright (c) 2009-2012 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vc200x_platforms")
|
||||
local vc200x = p.vstudio.vc200x
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2008")
|
||||
wks = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
prj = test.getproject(wks, 1)
|
||||
vc200x.platforms(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If no architectures are specified, Win32 should be the default.
|
||||
--
|
||||
|
||||
function suite.win32Listed_onNoPlatforms()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If multiple configurations use the same architecture, it should
|
||||
-- still only be listed once.
|
||||
--
|
||||
|
||||
function suite.architectureListedOnlyOnce_onMultipleConfigurations()
|
||||
platforms { "Static", "Dynamic" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If multiple architectures are used, they should all be listed.
|
||||
--
|
||||
|
||||
function suite.allArchitecturesListed_onMultipleArchitectures()
|
||||
platforms { "x86", "x86_64" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the Xbox360 platform.
|
||||
--
|
||||
|
||||
function suite.platformIsCorrect_onXbox360()
|
||||
platforms { "Xbox360" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Xbox 360"
|
||||
/>
|
||||
</Platforms>
|
||||
]]
|
||||
end
|
File diff suppressed because it is too large
Load Diff
0
tests/actions/vstudio/vc2010/test_config_props.lua → modules/vstudio/tests/vc2010/test_config_props.lua
Executable file → Normal file
0
tests/actions/vstudio/vc2010/test_config_props.lua → modules/vstudio/tests/vc2010/test_config_props.lua
Executable file → Normal file
206
tests/actions/vstudio/vc2010/test_debug_settings.lua → modules/vstudio/tests/vc2010/test_debug_settings.lua
Executable file → Normal file
206
tests/actions/vstudio/vc2010/test_debug_settings.lua → modules/vstudio/tests/vc2010/test_debug_settings.lua
Executable file → Normal file
@ -1,103 +1,103 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_debug_settings.lua
|
||||
-- Validate handling of the working directory for debugging.
|
||||
-- Copyright (c) 2011-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs2010_debug_settings")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
local project = p.project
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
vc2010.debugSettings(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If no debug directory is set, nothing should be output.
|
||||
--
|
||||
|
||||
function suite.noOutput_onNoDebugDir()
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
--
|
||||
-- The debug command should specified relative to the project location.
|
||||
--
|
||||
|
||||
function suite.debugCommand_isProjectRelative()
|
||||
debugcommand "bin/emulator.exe"
|
||||
prepare()
|
||||
|
||||
expectedPath = path.translate(path.getabsolute(os.getcwd())) .. "\\bin\\emulator.exe"
|
||||
expected = "<LocalDebuggerCommand>" .. expectedPath .. "</LocalDebuggerCommand>"
|
||||
expected = expected .. "\n<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>"
|
||||
test.capture (expected)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- The debug directory should specified relative to the project location.
|
||||
--
|
||||
|
||||
function suite.debugDirectory_isProjectRelative()
|
||||
debugdir "bin/debug"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<LocalDebuggerWorkingDirectory>bin\debug</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Verify handling of debug arguments.
|
||||
--
|
||||
|
||||
function suite.debuggerCommandArgs_onDebugArgs()
|
||||
debugargs { "arg1", "arg2", "arg1" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<LocalDebuggerCommandArguments>arg1 arg2 arg1</LocalDebuggerCommandArguments>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check the handling of debug environment variables.
|
||||
--
|
||||
|
||||
function suite.localDebuggerEnv_onDebugEnv()
|
||||
debugenvs { "key=value" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<LocalDebuggerEnvironment>key=value</LocalDebuggerEnvironment>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Multiple environment variables should be separated by a "\n" sequence.
|
||||
--
|
||||
|
||||
function suite.localDebuggerEnv_onDebugEnv()
|
||||
debugenvs { "key=value", "foo=bar" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<LocalDebuggerEnvironment>key=value
|
||||
foo=bar</LocalDebuggerEnvironment>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_debug_settings.lua
|
||||
-- Validate handling of the working directory for debugging.
|
||||
-- Copyright (c) 2011-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs2010_debug_settings")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
local project = p.project
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
vc2010.debugSettings(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If no debug directory is set, nothing should be output.
|
||||
--
|
||||
|
||||
function suite.noOutput_onNoDebugDir()
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
--
|
||||
-- The debug command should specified relative to the project location.
|
||||
--
|
||||
|
||||
function suite.debugCommand_isProjectRelative()
|
||||
debugcommand "bin/emulator.exe"
|
||||
prepare()
|
||||
|
||||
expectedPath = path.translate(path.getabsolute(os.getcwd())) .. "\\bin\\emulator.exe"
|
||||
expected = "<LocalDebuggerCommand>" .. expectedPath .. "</LocalDebuggerCommand>"
|
||||
expected = expected .. "\n<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>"
|
||||
test.capture (expected)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- The debug directory should specified relative to the project location.
|
||||
--
|
||||
|
||||
function suite.debugDirectory_isProjectRelative()
|
||||
debugdir "bin/debug"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<LocalDebuggerWorkingDirectory>bin\debug</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Verify handling of debug arguments.
|
||||
--
|
||||
|
||||
function suite.debuggerCommandArgs_onDebugArgs()
|
||||
debugargs { "arg1", "arg2", "arg1" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<LocalDebuggerCommandArguments>arg1 arg2 arg1</LocalDebuggerCommandArguments>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check the handling of debug environment variables.
|
||||
--
|
||||
|
||||
function suite.localDebuggerEnv_onDebugEnv()
|
||||
debugenvs { "key=value" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<LocalDebuggerEnvironment>key=value</LocalDebuggerEnvironment>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Multiple environment variables should be separated by a "\n" sequence.
|
||||
--
|
||||
|
||||
function suite.localDebuggerEnv_onDebugEnv()
|
||||
debugenvs { "key=value", "foo=bar" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<LocalDebuggerEnvironment>key=value
|
||||
foo=bar</LocalDebuggerEnvironment>
|
||||
]]
|
||||
end
|
||||
|
@ -1,108 +1,108 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_extension_targets.lua
|
||||
-- Check the import extension targets block of a VS 2010 project.
|
||||
-- Copyright (c) 2014 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs2010_extension_targets")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
local project = p.project
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
rule "MyRules"
|
||||
rule "MyOtherRules"
|
||||
wks = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local prj = test.getproject(wks)
|
||||
vc2010.importExtensionTargets(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Writes an empty element when no custom rules are specified.
|
||||
--
|
||||
|
||||
function suite.structureIsCorrect_onDefaultValues()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Writes entries for each project scoped custom rules path.
|
||||
--
|
||||
|
||||
function suite.addsImport_onEachRulesFile()
|
||||
rules { "MyRules", "MyOtherRules" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="MyRules.targets" />
|
||||
<Import Project="MyOtherRules.targets" />
|
||||
</ImportGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Writes entries for NuGet packages.
|
||||
--
|
||||
|
||||
function suite.addsImport_onEachNuGetPackage()
|
||||
nuget { "boost:1.59.0-b1", "sdl2.v140:2.0.3", "sdl2.v140.redist:2.0.3" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="packages\boost.1.59.0-b1\build\native\boost.targets" Condition="Exists('packages\boost.1.59.0-b1\build\native\boost.targets')" />
|
||||
<Import Project="packages\sdl2.v140.2.0.3\build\native\sdl2.v140.targets" Condition="Exists('packages\sdl2.v140.2.0.3\build\native\sdl2.v140.targets')" />
|
||||
<Import Project="packages\sdl2.v140.redist.2.0.3\build\native\sdl2.v140.redist.targets" Condition="Exists('packages\sdl2.v140.redist.2.0.3\build\native\sdl2.v140.redist.targets')" />
|
||||
</ImportGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Rule files use a project relative path.
|
||||
--
|
||||
|
||||
function suite.usesProjectRelativePaths()
|
||||
rules { "MyRules" }
|
||||
location "build"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\MyRules.targets" />
|
||||
</ImportGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- the asm 'file category' should add the right target.
|
||||
--
|
||||
|
||||
function suite.hasAssemblyFiles()
|
||||
files { "test.asm" }
|
||||
location "build"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
|
||||
</ImportGroup>
|
||||
]]
|
||||
end
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_extension_targets.lua
|
||||
-- Check the import extension targets block of a VS 2010 project.
|
||||
-- Copyright (c) 2014 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs2010_extension_targets")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
local project = p.project
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
rule "MyRules"
|
||||
rule "MyOtherRules"
|
||||
wks = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local prj = test.getproject(wks)
|
||||
vc2010.importExtensionTargets(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Writes an empty element when no custom rules are specified.
|
||||
--
|
||||
|
||||
function suite.structureIsCorrect_onDefaultValues()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Writes entries for each project scoped custom rules path.
|
||||
--
|
||||
|
||||
function suite.addsImport_onEachRulesFile()
|
||||
rules { "MyRules", "MyOtherRules" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="MyRules.targets" />
|
||||
<Import Project="MyOtherRules.targets" />
|
||||
</ImportGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Writes entries for NuGet packages.
|
||||
--
|
||||
|
||||
function suite.addsImport_onEachNuGetPackage()
|
||||
nuget { "boost:1.59.0-b1", "sdl2.v140:2.0.3", "sdl2.v140.redist:2.0.3" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="packages\boost.1.59.0-b1\build\native\boost.targets" Condition="Exists('packages\boost.1.59.0-b1\build\native\boost.targets')" />
|
||||
<Import Project="packages\sdl2.v140.2.0.3\build\native\sdl2.v140.targets" Condition="Exists('packages\sdl2.v140.2.0.3\build\native\sdl2.v140.targets')" />
|
||||
<Import Project="packages\sdl2.v140.redist.2.0.3\build\native\sdl2.v140.redist.targets" Condition="Exists('packages\sdl2.v140.redist.2.0.3\build\native\sdl2.v140.redist.targets')" />
|
||||
</ImportGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Rule files use a project relative path.
|
||||
--
|
||||
|
||||
function suite.usesProjectRelativePaths()
|
||||
rules { "MyRules" }
|
||||
location "build"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\MyRules.targets" />
|
||||
</ImportGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- the asm 'file category' should add the right target.
|
||||
--
|
||||
|
||||
function suite.hasAssemblyFiles()
|
||||
files { "test.asm" }
|
||||
location "build"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
|
||||
</ImportGroup>
|
||||
]]
|
||||
end
|
0
tests/actions/vstudio/vc2010/test_files.lua → modules/vstudio/tests/vc2010/test_files.lua
Executable file → Normal file
0
tests/actions/vstudio/vc2010/test_files.lua → modules/vstudio/tests/vc2010/test_files.lua
Executable file → Normal file
@ -1,201 +1,201 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_filters.lua
|
||||
-- Validate generation of file filter blocks in Visual Studio 2010 C/C++ projects.
|
||||
-- Copyright (c) 2011-2014 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs2010_filters")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
|
||||
|
||||
--
|
||||
-- Setup/teardown
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
wks = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare(group)
|
||||
prj = test.getproject(wks)
|
||||
vc2010.filterGroups(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check contents of the different file groups.
|
||||
--
|
||||
|
||||
function suite.itemGroup_onClInclude()
|
||||
files { "hello.h" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClInclude Include="hello.h" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.itemGroup_onResourceSection()
|
||||
files { "hello.rc" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="hello.rc" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.itemGroup_onNoneSection()
|
||||
files { "hello.txt" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<None Include="hello.txt" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.itemGroup_onMixed()
|
||||
files { "hello.c", "hello.h", "hello.rc", "hello.txt" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClInclude Include="hello.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="hello.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="hello.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="hello.rc" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Files with a build rule go into a custom build section.
|
||||
--
|
||||
|
||||
function suite.itemGroup_onBuildRule()
|
||||
files { "hello.cg" }
|
||||
filter "files:**.cg"
|
||||
buildcommands { "cgc $(InputFile)" }
|
||||
buildoutputs { "$(InputName).obj" }
|
||||
prepare("CustomBuild")
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="hello.cg" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.itemGroup_onSingleConfigBuildRule()
|
||||
files { "hello.cg" }
|
||||
filter { "Release", "files:**.cg" }
|
||||
buildcommands { "cgc $(InputFile)" }
|
||||
buildoutputs { "$(InputName).obj" }
|
||||
prepare("CustomBuild")
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="hello.cg" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Files located at the root (in the same folder as the project) do not
|
||||
-- need a filter identifier.
|
||||
--
|
||||
|
||||
function suite.noFilter_onRootFiles()
|
||||
files { "hello.c", "goodbye.c" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="goodbye.c" />
|
||||
<ClCompile Include="hello.c" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check the filter with a real path.
|
||||
--
|
||||
|
||||
function suite.filter_onRealPath()
|
||||
files { "src/hello.c", "hello.h" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClInclude Include="hello.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\hello.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check the filter with a virtual path.
|
||||
--
|
||||
|
||||
function suite.filter_onVpath()
|
||||
files { "src/hello.c", "hello.h" }
|
||||
vpaths { ["Source Files"] = "**.c" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClInclude Include="hello.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\hello.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of files using custom rules.
|
||||
--
|
||||
|
||||
function suite.filter_onCustomRule()
|
||||
rules "Animation"
|
||||
files { "hello.dae" }
|
||||
|
||||
rule "Animation"
|
||||
fileextension ".dae"
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<Animation Include="hello.dae" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of .asm files
|
||||
--
|
||||
function suite.itemGroup_onNoneSection()
|
||||
files { "hello.asm" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<Masm Include="hello.asm" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_filters.lua
|
||||
-- Validate generation of file filter blocks in Visual Studio 2010 C/C++ projects.
|
||||
-- Copyright (c) 2011-2014 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs2010_filters")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
|
||||
|
||||
--
|
||||
-- Setup/teardown
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
wks = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare(group)
|
||||
prj = test.getproject(wks)
|
||||
vc2010.filterGroups(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check contents of the different file groups.
|
||||
--
|
||||
|
||||
function suite.itemGroup_onClInclude()
|
||||
files { "hello.h" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClInclude Include="hello.h" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.itemGroup_onResourceSection()
|
||||
files { "hello.rc" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="hello.rc" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.itemGroup_onNoneSection()
|
||||
files { "hello.txt" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<None Include="hello.txt" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.itemGroup_onMixed()
|
||||
files { "hello.c", "hello.h", "hello.rc", "hello.txt" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClInclude Include="hello.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="hello.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="hello.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="hello.rc" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Files with a build rule go into a custom build section.
|
||||
--
|
||||
|
||||
function suite.itemGroup_onBuildRule()
|
||||
files { "hello.cg" }
|
||||
filter "files:**.cg"
|
||||
buildcommands { "cgc $(InputFile)" }
|
||||
buildoutputs { "$(InputName).obj" }
|
||||
prepare("CustomBuild")
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="hello.cg" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.itemGroup_onSingleConfigBuildRule()
|
||||
files { "hello.cg" }
|
||||
filter { "Release", "files:**.cg" }
|
||||
buildcommands { "cgc $(InputFile)" }
|
||||
buildoutputs { "$(InputName).obj" }
|
||||
prepare("CustomBuild")
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="hello.cg" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Files located at the root (in the same folder as the project) do not
|
||||
-- need a filter identifier.
|
||||
--
|
||||
|
||||
function suite.noFilter_onRootFiles()
|
||||
files { "hello.c", "goodbye.c" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="goodbye.c" />
|
||||
<ClCompile Include="hello.c" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check the filter with a real path.
|
||||
--
|
||||
|
||||
function suite.filter_onRealPath()
|
||||
files { "src/hello.c", "hello.h" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClInclude Include="hello.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\hello.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check the filter with a virtual path.
|
||||
--
|
||||
|
||||
function suite.filter_onVpath()
|
||||
files { "src/hello.c", "hello.h" }
|
||||
vpaths { ["Source Files"] = "**.c" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClInclude Include="hello.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\hello.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of files using custom rules.
|
||||
--
|
||||
|
||||
function suite.filter_onCustomRule()
|
||||
rules "Animation"
|
||||
files { "hello.dae" }
|
||||
|
||||
rule "Animation"
|
||||
fileextension ".dae"
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<Animation Include="hello.dae" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of .asm files
|
||||
--
|
||||
function suite.itemGroup_onNoneSection()
|
||||
files { "hello.asm" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<Masm Include="hello.asm" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
510
tests/actions/vstudio/vc2010/test_globals.lua → modules/vstudio/tests/vc2010/test_globals.lua
Executable file → Normal file
510
tests/actions/vstudio/vc2010/test_globals.lua → modules/vstudio/tests/vc2010/test_globals.lua
Executable file → Normal file
@ -1,255 +1,255 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_globals.lua
|
||||
-- Validate generation of the Globals property group.
|
||||
-- Copyright (c) 2011-2014 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs2010_globals")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
wks = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
prj = test.getproject(wks, 1)
|
||||
vc2010.globals(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the structure with the default project values.
|
||||
--
|
||||
|
||||
function suite.structureIsCorrect_onDefaultValues()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Ensure CLR support gets enabled for Managed C++ projects.
|
||||
--
|
||||
|
||||
function suite.keywordIsCorrect_onManagedC()
|
||||
clr "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<Keyword>ManagedCProj</Keyword>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Ensure custom target framework version correct for Managed C++ projects.
|
||||
--
|
||||
|
||||
function suite.frameworkVersionIsCorrect_onSpecificVersion()
|
||||
clr "On"
|
||||
dotnetframework "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
|
||||
|
||||
function suite.frameworkVersionIsCorrect_on2013()
|
||||
p.action.set("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
|
||||
|
||||
--
|
||||
-- Omit Keyword and RootNamespace for non-Windows projects.
|
||||
--
|
||||
|
||||
function suite.noKeyword_onNotWindows()
|
||||
system "Linux"
|
||||
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()
|
||||
filter "Debug"
|
||||
system "Windows"
|
||||
filter "Release"
|
||||
system "Linux"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- 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
|
||||
|
||||
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
|
||||
-- <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
|
||||
|
||||
|
||||
--
|
||||
-- VS 2013 adds the <IgnoreWarnCompileDuplicatedFilename> to get rid
|
||||
-- of spurious warnings when the same filename is present in different
|
||||
-- configurations.
|
||||
--
|
||||
|
||||
function suite.structureIsCorrect_on2013()
|
||||
p.action.set("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
|
||||
|
||||
|
||||
--
|
||||
-- VS 2015 adds the <WindowsTargetPlatformVersion> to allow developers
|
||||
-- to target different versions of the Windows SDK.
|
||||
--
|
||||
|
||||
function suite.windowsTargetPlatformVersionMissing_on2013Default()
|
||||
_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
|
||||
|
||||
function suite.windowsTargetPlatformVersionMissing_on2013()
|
||||
_ACTION = "vs2013"
|
||||
systemversion "10.0.10240.0"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.windowsTargetPlatformVersionMissing_on2015Default()
|
||||
_ACTION = "vs2015"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.windowsTargetPlatformVersion_on2015()
|
||||
_ACTION = "vs2015"
|
||||
systemversion "10.0.10240.0"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.10240.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_globals.lua
|
||||
-- Validate generation of the Globals property group.
|
||||
-- Copyright (c) 2011-2014 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs2010_globals")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
wks = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
prj = test.getproject(wks, 1)
|
||||
vc2010.globals(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the structure with the default project values.
|
||||
--
|
||||
|
||||
function suite.structureIsCorrect_onDefaultValues()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Ensure CLR support gets enabled for Managed C++ projects.
|
||||
--
|
||||
|
||||
function suite.keywordIsCorrect_onManagedC()
|
||||
clr "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<Keyword>ManagedCProj</Keyword>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Ensure custom target framework version correct for Managed C++ projects.
|
||||
--
|
||||
|
||||
function suite.frameworkVersionIsCorrect_onSpecificVersion()
|
||||
clr "On"
|
||||
dotnetframework "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
|
||||
|
||||
function suite.frameworkVersionIsCorrect_on2013()
|
||||
p.action.set("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
|
||||
|
||||
--
|
||||
-- Omit Keyword and RootNamespace for non-Windows projects.
|
||||
--
|
||||
|
||||
function suite.noKeyword_onNotWindows()
|
||||
system "Linux"
|
||||
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()
|
||||
filter "Debug"
|
||||
system "Windows"
|
||||
filter "Release"
|
||||
system "Linux"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- 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
|
||||
|
||||
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
|
||||
-- <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
|
||||
|
||||
|
||||
--
|
||||
-- VS 2013 adds the <IgnoreWarnCompileDuplicatedFilename> to get rid
|
||||
-- of spurious warnings when the same filename is present in different
|
||||
-- configurations.
|
||||
--
|
||||
|
||||
function suite.structureIsCorrect_on2013()
|
||||
p.action.set("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
|
||||
|
||||
|
||||
--
|
||||
-- VS 2015 adds the <WindowsTargetPlatformVersion> to allow developers
|
||||
-- to target different versions of the Windows SDK.
|
||||
--
|
||||
|
||||
function suite.windowsTargetPlatformVersionMissing_on2013Default()
|
||||
_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
|
||||
|
||||
function suite.windowsTargetPlatformVersionMissing_on2013()
|
||||
_ACTION = "vs2013"
|
||||
systemversion "10.0.10240.0"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.windowsTargetPlatformVersionMissing_on2015Default()
|
||||
_ACTION = "vs2015"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.windowsTargetPlatformVersion_on2015()
|
||||
_ACTION = "vs2015"
|
||||
systemversion "10.0.10240.0"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.10240.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
File diff suppressed because it is too large
Load Diff
@ -1,54 +1,54 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_manifest.lua
|
||||
-- Validate generation of Manifest block in Visual Studio 201x C/C++ projects.
|
||||
-- Copyright (c) 2009-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs2010_manifest")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
local project = p.project
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
wks, prj = test.createWorkspace()
|
||||
kind "ConsoleApp"
|
||||
end
|
||||
|
||||
local function prepare(platform)
|
||||
local cfg = test.getconfig(prj, "Debug", platform)
|
||||
vc2010.manifest(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the basic element structure with default settings.
|
||||
--
|
||||
|
||||
function suite.defaultSettings()
|
||||
files { "source/test.manifest" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>source/test.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
|
||||
</Manifest>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check that there is no manifest when using static lib
|
||||
--
|
||||
|
||||
function suite.staticLib()
|
||||
kind "StaticLib"
|
||||
files { "test.manifest" }
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_manifest.lua
|
||||
-- Validate generation of Manifest block in Visual Studio 201x C/C++ projects.
|
||||
-- Copyright (c) 2009-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs2010_manifest")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
local project = p.project
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
wks, prj = test.createWorkspace()
|
||||
kind "ConsoleApp"
|
||||
end
|
||||
|
||||
local function prepare(platform)
|
||||
local cfg = test.getconfig(prj, "Debug", platform)
|
||||
vc2010.manifest(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the basic element structure with default settings.
|
||||
--
|
||||
|
||||
function suite.defaultSettings()
|
||||
files { "source/test.manifest" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>source/test.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
|
||||
</Manifest>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check that there is no manifest when using static lib
|
||||
--
|
||||
|
||||
function suite.staticLib()
|
||||
kind "StaticLib"
|
||||
files { "test.manifest" }
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
0
tests/actions/vstudio/vc2010/test_output_props.lua → modules/vstudio/tests/vc2010/test_output_props.lua
Executable file → Normal file
0
tests/actions/vstudio/vc2010/test_output_props.lua → modules/vstudio/tests/vc2010/test_output_props.lua
Executable file → Normal file
212
tests/actions/vstudio/vc2010/test_project_configs.lua → modules/vstudio/tests/vc2010/test_project_configs.lua
Executable file → Normal file
212
tests/actions/vstudio/vc2010/test_project_configs.lua → modules/vstudio/tests/vc2010/test_project_configs.lua
Executable file → Normal file
@ -1,106 +1,106 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_project_configs.lua
|
||||
-- Test the Visual Studio 2010 project configurations item group.
|
||||
-- Copyright (c) 2009-2014 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vc2010_project_configs")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
wks = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
prj = test.getproject(wks, 1)
|
||||
vc2010.projectConfigurations(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If no architectures are specified, Win32 should be the default.
|
||||
--
|
||||
|
||||
function suite.win32Listed_onNoPlatforms()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Visual Studio requires that all combinations of configurations and
|
||||
-- architectures be listed (even if some pairings would make no sense
|
||||
-- for our build, i.e. Win32 DLL DCRT|PS3).
|
||||
--
|
||||
|
||||
function suite.allArchitecturesListed_onMultipleArchitectures()
|
||||
platforms { "32b", "64b" }
|
||||
filter "platforms:32b"
|
||||
architecture "x86"
|
||||
filter "platforms:64b"
|
||||
architecture "x86_64"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug 32b|Win32">
|
||||
<Configuration>Debug 32b</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug 32b|x64">
|
||||
<Configuration>Debug 32b</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug 64b|Win32">
|
||||
<Configuration>Debug 64b</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug 64b|x64">
|
||||
<Configuration>Debug 64b</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release 32b|Win32">
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Sometimes unrolling the configuration-architecture combinations
|
||||
-- can cause duplicates. Make sure those get removed.
|
||||
--
|
||||
|
||||
function suite.allArchitecturesListed_onImplicitArchitectures()
|
||||
platforms { "x86", "x86_64" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
]]
|
||||
end
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_project_configs.lua
|
||||
-- Test the Visual Studio 2010 project configurations item group.
|
||||
-- Copyright (c) 2009-2014 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vc2010_project_configs")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
wks = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
prj = test.getproject(wks, 1)
|
||||
vc2010.projectConfigurations(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If no architectures are specified, Win32 should be the default.
|
||||
--
|
||||
|
||||
function suite.win32Listed_onNoPlatforms()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Visual Studio requires that all combinations of configurations and
|
||||
-- architectures be listed (even if some pairings would make no sense
|
||||
-- for our build, i.e. Win32 DLL DCRT|PS3).
|
||||
--
|
||||
|
||||
function suite.allArchitecturesListed_onMultipleArchitectures()
|
||||
platforms { "32b", "64b" }
|
||||
filter "platforms:32b"
|
||||
architecture "x86"
|
||||
filter "platforms:64b"
|
||||
architecture "x86_64"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug 32b|Win32">
|
||||
<Configuration>Debug 32b</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug 32b|x64">
|
||||
<Configuration>Debug 32b</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug 64b|Win32">
|
||||
<Configuration>Debug 64b</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug 64b|x64">
|
||||
<Configuration>Debug 64b</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release 32b|Win32">
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Sometimes unrolling the configuration-architecture combinations
|
||||
-- can cause duplicates. Make sure those get removed.
|
||||
--
|
||||
|
||||
function suite.allArchitecturesListed_onImplicitArchitectures()
|
||||
platforms { "x86", "x86_64" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
]]
|
||||
end
|
0
tests/actions/vstudio/vc2010/test_prop_sheet.lua → modules/vstudio/tests/vc2010/test_prop_sheet.lua
Executable file → Normal file
0
tests/actions/vstudio/vc2010/test_prop_sheet.lua → modules/vstudio/tests/vc2010/test_prop_sheet.lua
Executable file → Normal file
228
tests/actions/vstudio/vc2010/test_resource_compile.lua → modules/vstudio/tests/vc2010/test_resource_compile.lua
Executable file → Normal file
228
tests/actions/vstudio/vc2010/test_resource_compile.lua → modules/vstudio/tests/vc2010/test_resource_compile.lua
Executable file → Normal file
@ -1,114 +1,114 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_resource_compile.lua
|
||||
-- Validate resource compiler settings in Visual Studio 2010 C/C++ projects.
|
||||
-- Copyright (c) 2011-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs2010_resource_compiler")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
local project = p.project
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
p.escaper(p.vstudio.vs2010.esc)
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
vc2010.resourceCompile(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Should only write the element if it is needed.
|
||||
--
|
||||
|
||||
function suite.excluded_onNoResourceFiles()
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
function suite.excluded_onNoSettings()
|
||||
files { "hello.rc" }
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
function suite.skips_onXbox360()
|
||||
files { "hello.rc" }
|
||||
defines { "DEBUG" }
|
||||
system "Xbox360"
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If defines are specified, the <PreprocessorDefinitions> element should be added.
|
||||
--
|
||||
|
||||
function suite.preprocessorDefinitions_onDefines()
|
||||
files { "hello.rc" }
|
||||
defines { "DEBUG" }
|
||||
resdefines { "RESOURCES" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>DEBUG;RESOURCES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If include directories are specified, the <AdditionalIncludeDirectories> should be added.
|
||||
--
|
||||
|
||||
function suite.additionalIncludeDirs_onIncludeDirs()
|
||||
files { "hello.rc" }
|
||||
includedirs { "include/lua" }
|
||||
resincludedirs { "include/zlib" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>include\lua;include\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Test special escaping for preprocessor definition with quotes.
|
||||
--
|
||||
|
||||
function suite.preprocessorDefinitions_onDefinesEscaping()
|
||||
files { "hello.rc" }
|
||||
defines { 'VERSION_STRING="1.0.0 (testing)"' }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>VERSION_STRING=\"1.0.0 (testing)\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Test locale conversion to culture codes.
|
||||
--
|
||||
|
||||
function suite.culture_en_US()
|
||||
files { "hello.rc" }
|
||||
locale "en-US"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
]]
|
||||
end
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_resource_compile.lua
|
||||
-- Validate resource compiler settings in Visual Studio 2010 C/C++ projects.
|
||||
-- Copyright (c) 2011-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs2010_resource_compiler")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
local project = p.project
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
p.escaper(p.vstudio.vs2010.esc)
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
vc2010.resourceCompile(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Should only write the element if it is needed.
|
||||
--
|
||||
|
||||
function suite.excluded_onNoResourceFiles()
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
function suite.excluded_onNoSettings()
|
||||
files { "hello.rc" }
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
function suite.skips_onXbox360()
|
||||
files { "hello.rc" }
|
||||
defines { "DEBUG" }
|
||||
system "Xbox360"
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If defines are specified, the <PreprocessorDefinitions> element should be added.
|
||||
--
|
||||
|
||||
function suite.preprocessorDefinitions_onDefines()
|
||||
files { "hello.rc" }
|
||||
defines { "DEBUG" }
|
||||
resdefines { "RESOURCES" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>DEBUG;RESOURCES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If include directories are specified, the <AdditionalIncludeDirectories> should be added.
|
||||
--
|
||||
|
||||
function suite.additionalIncludeDirs_onIncludeDirs()
|
||||
files { "hello.rc" }
|
||||
includedirs { "include/lua" }
|
||||
resincludedirs { "include/zlib" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>include\lua;include\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Test special escaping for preprocessor definition with quotes.
|
||||
--
|
||||
|
||||
function suite.preprocessorDefinitions_onDefinesEscaping()
|
||||
files { "hello.rc" }
|
||||
defines { 'VERSION_STRING="1.0.0 (testing)"' }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>VERSION_STRING=\"1.0.0 (testing)\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Test locale conversion to culture codes.
|
||||
--
|
||||
|
||||
function suite.culture_en_US()
|
||||
files { "hello.rc" }
|
||||
locale "en-US"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
]]
|
||||
end
|
@ -1,181 +1,181 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_rule_xml.lua
|
||||
-- Validate generation of custom rules
|
||||
-- Author Jason Perkins
|
||||
-- Copyright (c) 2016 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs2010_rule_xml")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
local m = p.vstudio.vs2010.rules.xml
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
rule "MyRule"
|
||||
wks, prj = test.createWorkspace()
|
||||
rules { "MyRule" }
|
||||
end
|
||||
|
||||
local function createVar(def)
|
||||
rule "MyRule"
|
||||
propertydefinition(def)
|
||||
project "MyProject"
|
||||
end
|
||||
|
||||
|
||||
|
||||
---
|
||||
-- Property definitions
|
||||
---
|
||||
|
||||
function suite.properties_onStringNoSwitch()
|
||||
createVar { name="MyVar", kind="string" }
|
||||
local r = test.getRule("MyRule")
|
||||
m.properties(r)
|
||||
test.capture [[
|
||||
<StringProperty
|
||||
Name="MyVar"
|
||||
HelpContext="0"
|
||||
DisplayName="MyVar"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.properties_onString()
|
||||
createVar { name="MyVar", kind="string", switch="[value]" }
|
||||
local r = test.getRule("MyRule")
|
||||
m.properties(r)
|
||||
test.capture [[
|
||||
<StringProperty
|
||||
Name="MyVar"
|
||||
HelpContext="0"
|
||||
DisplayName="MyVar"
|
||||
Switch="[value]"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.properties_onStringWithNoKind()
|
||||
createVar { name="MyVar" }
|
||||
local r = test.getRule("MyRule")
|
||||
m.properties(r)
|
||||
test.capture [[
|
||||
<StringProperty
|
||||
Name="MyVar"
|
||||
HelpContext="0"
|
||||
DisplayName="MyVar"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.properties_onBooleanNoSwitch()
|
||||
createVar { name="MyVar", kind="boolean" }
|
||||
local r = test.getRule("MyRule")
|
||||
m.properties(r)
|
||||
test.capture [[
|
||||
<BoolProperty
|
||||
Name="MyVar"
|
||||
HelpContext="0"
|
||||
DisplayName="MyVar"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.properties_onBoolean()
|
||||
createVar { name="MyVar", kind="boolean", switch="[value]" }
|
||||
local r = test.getRule("MyRule")
|
||||
m.properties(r)
|
||||
test.capture [[
|
||||
<BoolProperty
|
||||
Name="MyVar"
|
||||
HelpContext="0"
|
||||
DisplayName="MyVar"
|
||||
Switch="[value]"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.properties_onEnum()
|
||||
createVar {
|
||||
name = "OptimizationLevel",
|
||||
display = "Optimization Level",
|
||||
values = {
|
||||
[0] = "None",
|
||||
[1] = "Size",
|
||||
[2] = "Speed",
|
||||
},
|
||||
switch = {
|
||||
[0] = "-O0",
|
||||
[1] = "-O1",
|
||||
[2] = "-O3",
|
||||
},
|
||||
value = 2,
|
||||
}
|
||||
|
||||
local r = test.getRule("MyRule")
|
||||
m.properties(r)
|
||||
test.capture [[
|
||||
<EnumProperty
|
||||
Name="OptimizationLevel"
|
||||
HelpContext="0"
|
||||
DisplayName="Optimization Level">
|
||||
<EnumValue
|
||||
Name="0"
|
||||
DisplayName="None"
|
||||
Switch="-O0"
|
||||
/>
|
||||
<EnumValue
|
||||
Name="1"
|
||||
DisplayName="Size"
|
||||
Switch="-O1"
|
||||
/>
|
||||
<EnumValue
|
||||
Name="2"
|
||||
DisplayName="Speed"
|
||||
Switch="-O3"
|
||||
/>
|
||||
</EnumProperty>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.properties_onEnumNoSwitches()
|
||||
createVar {
|
||||
name = "OptimizationLevel",
|
||||
display = "Optimization Level",
|
||||
values = {
|
||||
[0] = "None",
|
||||
[1] = "Size",
|
||||
[2] = "Speed",
|
||||
},
|
||||
value = 2,
|
||||
}
|
||||
|
||||
local r = test.getRule("MyRule")
|
||||
m.properties(r)
|
||||
test.capture [[
|
||||
<EnumProperty
|
||||
Name="OptimizationLevel"
|
||||
HelpContext="0"
|
||||
DisplayName="Optimization Level">
|
||||
<EnumValue
|
||||
Name="0"
|
||||
DisplayName="None"
|
||||
/>
|
||||
<EnumValue
|
||||
Name="1"
|
||||
DisplayName="Size"
|
||||
/>
|
||||
<EnumValue
|
||||
Name="2"
|
||||
DisplayName="Speed"
|
||||
/>
|
||||
</EnumProperty>
|
||||
]]
|
||||
end
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_rule_xml.lua
|
||||
-- Validate generation of custom rules
|
||||
-- Author Jason Perkins
|
||||
-- Copyright (c) 2016 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs2010_rule_xml")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
local m = p.vstudio.vs2010.rules.xml
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
rule "MyRule"
|
||||
wks, prj = test.createWorkspace()
|
||||
rules { "MyRule" }
|
||||
end
|
||||
|
||||
local function createVar(def)
|
||||
rule "MyRule"
|
||||
propertydefinition(def)
|
||||
project "MyProject"
|
||||
end
|
||||
|
||||
|
||||
|
||||
---
|
||||
-- Property definitions
|
||||
---
|
||||
|
||||
function suite.properties_onStringNoSwitch()
|
||||
createVar { name="MyVar", kind="string" }
|
||||
local r = test.getRule("MyRule")
|
||||
m.properties(r)
|
||||
test.capture [[
|
||||
<StringProperty
|
||||
Name="MyVar"
|
||||
HelpContext="0"
|
||||
DisplayName="MyVar"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.properties_onString()
|
||||
createVar { name="MyVar", kind="string", switch="[value]" }
|
||||
local r = test.getRule("MyRule")
|
||||
m.properties(r)
|
||||
test.capture [[
|
||||
<StringProperty
|
||||
Name="MyVar"
|
||||
HelpContext="0"
|
||||
DisplayName="MyVar"
|
||||
Switch="[value]"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.properties_onStringWithNoKind()
|
||||
createVar { name="MyVar" }
|
||||
local r = test.getRule("MyRule")
|
||||
m.properties(r)
|
||||
test.capture [[
|
||||
<StringProperty
|
||||
Name="MyVar"
|
||||
HelpContext="0"
|
||||
DisplayName="MyVar"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.properties_onBooleanNoSwitch()
|
||||
createVar { name="MyVar", kind="boolean" }
|
||||
local r = test.getRule("MyRule")
|
||||
m.properties(r)
|
||||
test.capture [[
|
||||
<BoolProperty
|
||||
Name="MyVar"
|
||||
HelpContext="0"
|
||||
DisplayName="MyVar"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.properties_onBoolean()
|
||||
createVar { name="MyVar", kind="boolean", switch="[value]" }
|
||||
local r = test.getRule("MyRule")
|
||||
m.properties(r)
|
||||
test.capture [[
|
||||
<BoolProperty
|
||||
Name="MyVar"
|
||||
HelpContext="0"
|
||||
DisplayName="MyVar"
|
||||
Switch="[value]"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.properties_onEnum()
|
||||
createVar {
|
||||
name = "OptimizationLevel",
|
||||
display = "Optimization Level",
|
||||
values = {
|
||||
[0] = "None",
|
||||
[1] = "Size",
|
||||
[2] = "Speed",
|
||||
},
|
||||
switch = {
|
||||
[0] = "-O0",
|
||||
[1] = "-O1",
|
||||
[2] = "-O3",
|
||||
},
|
||||
value = 2,
|
||||
}
|
||||
|
||||
local r = test.getRule("MyRule")
|
||||
m.properties(r)
|
||||
test.capture [[
|
||||
<EnumProperty
|
||||
Name="OptimizationLevel"
|
||||
HelpContext="0"
|
||||
DisplayName="Optimization Level">
|
||||
<EnumValue
|
||||
Name="0"
|
||||
DisplayName="None"
|
||||
Switch="-O0"
|
||||
/>
|
||||
<EnumValue
|
||||
Name="1"
|
||||
DisplayName="Size"
|
||||
Switch="-O1"
|
||||
/>
|
||||
<EnumValue
|
||||
Name="2"
|
||||
DisplayName="Speed"
|
||||
Switch="-O3"
|
||||
/>
|
||||
</EnumProperty>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.properties_onEnumNoSwitches()
|
||||
createVar {
|
||||
name = "OptimizationLevel",
|
||||
display = "Optimization Level",
|
||||
values = {
|
||||
[0] = "None",
|
||||
[1] = "Size",
|
||||
[2] = "Speed",
|
||||
},
|
||||
value = 2,
|
||||
}
|
||||
|
||||
local r = test.getRule("MyRule")
|
||||
m.properties(r)
|
||||
test.capture [[
|
||||
<EnumProperty
|
||||
Name="OptimizationLevel"
|
||||
HelpContext="0"
|
||||
DisplayName="Optimization Level">
|
||||
<EnumValue
|
||||
Name="0"
|
||||
DisplayName="None"
|
||||
/>
|
||||
<EnumValue
|
||||
Name="1"
|
||||
DisplayName="Size"
|
||||
/>
|
||||
<EnumValue
|
||||
Name="2"
|
||||
DisplayName="Speed"
|
||||
/>
|
||||
</EnumProperty>
|
||||
]]
|
||||
end
|
@ -1,131 +1,131 @@
|
||||
--
|
||||
-- vs200x_vcproj_user.lua
|
||||
-- Generate a Visual Studio 2002-2008 C/C++ project .user file
|
||||
-- Copyright (c) 2011-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local m = p.vstudio.vc200x
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Generate a Visual Studio 200x C++ user file, with support for the new platforms API.
|
||||
--
|
||||
|
||||
m.elements.user = function(cfg)
|
||||
return {
|
||||
m.debugSettings,
|
||||
}
|
||||
end
|
||||
|
||||
function m.generateUser(prj)
|
||||
p.indent("\t")
|
||||
|
||||
-- Only want output if there is something to configure
|
||||
local contents = {}
|
||||
local size = 0
|
||||
|
||||
for cfg in p.project.eachconfig(prj) do
|
||||
contents[cfg] = p.capture(function()
|
||||
p.push(4)
|
||||
p.callArray(m.elements.user, cfg)
|
||||
p.pop(4)
|
||||
end)
|
||||
size = size + #contents[cfg]
|
||||
end
|
||||
|
||||
if size > 0 then
|
||||
m.xmlElement()
|
||||
m.visualStudioUserFile()
|
||||
p.push('<Configurations>')
|
||||
for cfg in p.project.eachconfig(prj) do
|
||||
m.userConfiguration(cfg)
|
||||
p.push('<DebugSettings')
|
||||
if #contents[cfg] > 0 then
|
||||
p.outln(contents[cfg])
|
||||
end
|
||||
p.pop('/>')
|
||||
p.pop('</Configuration>')
|
||||
end
|
||||
p.pop('</Configurations>')
|
||||
p.pop('</VisualStudioUserFile>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
---
|
||||
-- Output the opening project tag.
|
||||
---
|
||||
|
||||
function m.visualStudioUserFile()
|
||||
p.push('<VisualStudioUserFile')
|
||||
p.w('ProjectType="Visual C++"')
|
||||
m.version()
|
||||
p.w('ShowAllFiles="false"')
|
||||
p.w('>')
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Write out the <Configuration> element, describing a specific Premake
|
||||
-- build configuration/platform pairing.
|
||||
--
|
||||
|
||||
function m.userConfiguration(cfg)
|
||||
p.push('<Configuration')
|
||||
p.x('Name="%s"', p.vstudio.projectConfig(cfg))
|
||||
p.w('>')
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Write out the debug settings for this project.
|
||||
--
|
||||
|
||||
m.elements.debugSettings = function(cfg)
|
||||
return {
|
||||
m.debugCommand,
|
||||
m.debugDir,
|
||||
m.debugArgs,
|
||||
m.debugEnvironment,
|
||||
}
|
||||
end
|
||||
|
||||
function m.debugSettings(cfg)
|
||||
p.callArray(m.elements.debugSettings, cfg)
|
||||
end
|
||||
|
||||
|
||||
function m.debugArgs(cfg)
|
||||
if #cfg.debugargs > 0 then
|
||||
p.x('CommandArguments="%s"', table.concat(cfg.debugargs, " "))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function m.debugCommand(cfg)
|
||||
if cfg.debugcommand then
|
||||
p.x('Command="%s"', p.vstudio.path(cfg, cfg.debugcommand))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function m.debugDir(cfg)
|
||||
if cfg.debugdir then
|
||||
p.x('WorkingDirectory="%s"', p.vstudio.path(cfg, cfg.debugdir))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function m.debugEnvironment(cfg)
|
||||
if #cfg.debugenvs > 0 then
|
||||
p.x('Environment="%s"', table.concat(cfg.debugenvs, "\n"))
|
||||
if cfg.flags.DebugEnvsDontMerge then
|
||||
p.x('EnvironmentMerge="false"')
|
||||
end
|
||||
end
|
||||
end
|
||||
--
|
||||
-- vs200x_vcproj_user.lua
|
||||
-- Generate a Visual Studio 2002-2008 C/C++ project .user file
|
||||
-- Copyright (c) 2011-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local m = p.vstudio.vc200x
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Generate a Visual Studio 200x C++ user file, with support for the new platforms API.
|
||||
--
|
||||
|
||||
m.elements.user = function(cfg)
|
||||
return {
|
||||
m.debugSettings,
|
||||
}
|
||||
end
|
||||
|
||||
function m.generateUser(prj)
|
||||
p.indent("\t")
|
||||
|
||||
-- Only want output if there is something to configure
|
||||
local contents = {}
|
||||
local size = 0
|
||||
|
||||
for cfg in p.project.eachconfig(prj) do
|
||||
contents[cfg] = p.capture(function()
|
||||
p.push(4)
|
||||
p.callArray(m.elements.user, cfg)
|
||||
p.pop(4)
|
||||
end)
|
||||
size = size + #contents[cfg]
|
||||
end
|
||||
|
||||
if size > 0 then
|
||||
m.xmlElement()
|
||||
m.visualStudioUserFile()
|
||||
p.push('<Configurations>')
|
||||
for cfg in p.project.eachconfig(prj) do
|
||||
m.userConfiguration(cfg)
|
||||
p.push('<DebugSettings')
|
||||
if #contents[cfg] > 0 then
|
||||
p.outln(contents[cfg])
|
||||
end
|
||||
p.pop('/>')
|
||||
p.pop('</Configuration>')
|
||||
end
|
||||
p.pop('</Configurations>')
|
||||
p.pop('</VisualStudioUserFile>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
---
|
||||
-- Output the opening project tag.
|
||||
---
|
||||
|
||||
function m.visualStudioUserFile()
|
||||
p.push('<VisualStudioUserFile')
|
||||
p.w('ProjectType="Visual C++"')
|
||||
m.version()
|
||||
p.w('ShowAllFiles="false"')
|
||||
p.w('>')
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Write out the <Configuration> element, describing a specific Premake
|
||||
-- build configuration/platform pairing.
|
||||
--
|
||||
|
||||
function m.userConfiguration(cfg)
|
||||
p.push('<Configuration')
|
||||
p.x('Name="%s"', p.vstudio.projectConfig(cfg))
|
||||
p.w('>')
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Write out the debug settings for this project.
|
||||
--
|
||||
|
||||
m.elements.debugSettings = function(cfg)
|
||||
return {
|
||||
m.debugCommand,
|
||||
m.debugDir,
|
||||
m.debugArgs,
|
||||
m.debugEnvironment,
|
||||
}
|
||||
end
|
||||
|
||||
function m.debugSettings(cfg)
|
||||
p.callArray(m.elements.debugSettings, cfg)
|
||||
end
|
||||
|
||||
|
||||
function m.debugArgs(cfg)
|
||||
if #cfg.debugargs > 0 then
|
||||
p.x('CommandArguments="%s"', table.concat(cfg.debugargs, " "))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function m.debugCommand(cfg)
|
||||
if cfg.debugcommand then
|
||||
p.x('Command="%s"', p.vstudio.path(cfg, cfg.debugcommand))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function m.debugDir(cfg)
|
||||
if cfg.debugdir then
|
||||
p.x('WorkingDirectory="%s"', p.vstudio.path(cfg, cfg.debugdir))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function m.debugEnvironment(cfg)
|
||||
if #cfg.debugenvs > 0 then
|
||||
p.x('Environment="%s"', table.concat(cfg.debugenvs, "\n"))
|
||||
if cfg.flags.DebugEnvsDontMerge then
|
||||
p.x('EnvironmentMerge="false"')
|
||||
end
|
||||
end
|
||||
end
|
@ -17,7 +17,7 @@
|
||||
-- Map Premake tokens to the corresponding Visual Studio variables.
|
||||
---
|
||||
|
||||
vstudio.pathVars = {
|
||||
vs2010.pathVars = {
|
||||
["cfg.objdir"] = { absolute = true, token = "$(IntDir)" },
|
||||
["prj.location"] = { absolute = true, token = "$(ProjectDir)" },
|
||||
["prj.name"] = { absolute = false, token = "$(ProjectName)" },
|
||||
@ -163,7 +163,7 @@
|
||||
vstudio.cleanTarget(prj)
|
||||
end,
|
||||
|
||||
pathVars = vstudio.pathVars,
|
||||
pathVars = vs2010.pathVars,
|
||||
|
||||
-- This stuff is specific to the Visual Studio exporters
|
||||
|
File diff suppressed because it is too large
Load Diff
282
src/actions/vstudio/vs2010_vcxproj_user.lua → modules/vstudio/vs2010_vcxproj_user.lua
Executable file → Normal file
282
src/actions/vstudio/vs2010_vcxproj_user.lua → modules/vstudio/vs2010_vcxproj_user.lua
Executable file → Normal file
@ -1,141 +1,141 @@
|
||||
--
|
||||
-- vs2010_vcxproj_user.lua
|
||||
-- Generate a Visual Studio 201x C/C++ project .user file
|
||||
-- Copyright (c) 2011-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local m = p.vstudio.vc2010
|
||||
|
||||
|
||||
--
|
||||
-- Generate a Visual Studio 201x C++ user file.
|
||||
--
|
||||
|
||||
m.elements.user = function(cfg)
|
||||
return {
|
||||
m.debugSettings,
|
||||
}
|
||||
end
|
||||
|
||||
function m.generateUser(prj)
|
||||
-- Only want output if there is something to configure
|
||||
local contents = {}
|
||||
local size = 0
|
||||
|
||||
for cfg in p.project.eachconfig(prj) do
|
||||
contents[cfg] = p.capture(function()
|
||||
p.push(2)
|
||||
p.callArray(m.elements.user, cfg)
|
||||
p.pop(2)
|
||||
end)
|
||||
size = size + #contents[cfg]
|
||||
end
|
||||
|
||||
if size > 0 then
|
||||
m.xmlDeclaration()
|
||||
m.userProject()
|
||||
for cfg in p.project.eachconfig(prj) do
|
||||
p.push('<PropertyGroup %s>', m.condition(cfg))
|
||||
if #contents[cfg] > 0 then
|
||||
p.outln(contents[cfg])
|
||||
end
|
||||
p.pop('</PropertyGroup>')
|
||||
end
|
||||
p.pop('</Project>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Output the opening <Project> tag.
|
||||
--
|
||||
|
||||
function m.userProject()
|
||||
local action = p.action.current()
|
||||
p.push('<Project ToolsVersion="%s" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">',
|
||||
action.vstudio.toolsVersion)
|
||||
end
|
||||
|
||||
|
||||
|
||||
m.elements.debugSettings = function(cfg)
|
||||
return {
|
||||
m.localDebuggerCommand,
|
||||
m.localDebuggerWorkingDirectory,
|
||||
m.debuggerFlavor,
|
||||
m.localDebuggerCommandArguments,
|
||||
m.localDebuggerDebuggerType,
|
||||
m.localDebuggerEnvironment,
|
||||
m.localDebuggerMergeEnvironment,
|
||||
}
|
||||
end
|
||||
|
||||
function m.debugSettings(cfg)
|
||||
p.callArray(m.elements.debugSettings, cfg)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function m.debuggerFlavor(cfg)
|
||||
if cfg.debugdir or cfg.debugcommand then
|
||||
p.w('<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function m.localDebuggerCommand(cfg)
|
||||
if cfg.debugcommand then
|
||||
local dir = path.translate(cfg.debugcommand)
|
||||
p.w('<LocalDebuggerCommand>%s</LocalDebuggerCommand>', dir)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function m.localDebuggerDebuggerType(cfg)
|
||||
if cfg.debuggertype then
|
||||
p.w('<LocalDebuggerDebuggerType>%s</LocalDebuggerDebuggerType>', cfg.debuggertype)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function m.localDebuggerCommandArguments(cfg)
|
||||
if #cfg.debugargs > 0 then
|
||||
p.x('<LocalDebuggerCommandArguments>%s</LocalDebuggerCommandArguments>', table.concat(cfg.debugargs, " "))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function m.localDebuggerWorkingDirectory(cfg)
|
||||
if cfg.debugdir then
|
||||
local dir = p.vstudio.path(cfg, cfg.debugdir)
|
||||
p.x('<LocalDebuggerWorkingDirectory>%s</LocalDebuggerWorkingDirectory>', dir)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function m.localDebuggerEnvironment(cfg)
|
||||
if #cfg.debugenvs > 0 then
|
||||
local envs = table.concat(cfg.debugenvs, "\n")
|
||||
if cfg.flags.DebugEnvsInherit then
|
||||
envs = envs .. "\n$(LocalDebuggerEnvironment)"
|
||||
end
|
||||
p.w('<LocalDebuggerEnvironment>%s</LocalDebuggerEnvironment>', envs)
|
||||
|
||||
if cfg.flags.DebugEnvsDontMerge then
|
||||
p.w(2,'<LocalDebuggerMergeEnvironment>false</LocalDebuggerMergeEnvironment>')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function m.localDebuggerMergeEnvironment(cfg)
|
||||
if #cfg.debugenvs > 0 and cfg.flags.DebugEnvsDontMerge then
|
||||
p.w(2,'<LocalDebuggerMergeEnvironment>false</LocalDebuggerMergeEnvironment>')
|
||||
end
|
||||
end
|
||||
--
|
||||
-- vs2010_vcxproj_user.lua
|
||||
-- Generate a Visual Studio 201x C/C++ project .user file
|
||||
-- Copyright (c) 2011-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local m = p.vstudio.vc2010
|
||||
|
||||
|
||||
--
|
||||
-- Generate a Visual Studio 201x C++ user file.
|
||||
--
|
||||
|
||||
m.elements.user = function(cfg)
|
||||
return {
|
||||
m.debugSettings,
|
||||
}
|
||||
end
|
||||
|
||||
function m.generateUser(prj)
|
||||
-- Only want output if there is something to configure
|
||||
local contents = {}
|
||||
local size = 0
|
||||
|
||||
for cfg in p.project.eachconfig(prj) do
|
||||
contents[cfg] = p.capture(function()
|
||||
p.push(2)
|
||||
p.callArray(m.elements.user, cfg)
|
||||
p.pop(2)
|
||||
end)
|
||||
size = size + #contents[cfg]
|
||||
end
|
||||
|
||||
if size > 0 then
|
||||
m.xmlDeclaration()
|
||||
m.userProject()
|
||||
for cfg in p.project.eachconfig(prj) do
|
||||
p.push('<PropertyGroup %s>', m.condition(cfg))
|
||||
if #contents[cfg] > 0 then
|
||||
p.outln(contents[cfg])
|
||||
end
|
||||
p.pop('</PropertyGroup>')
|
||||
end
|
||||
p.pop('</Project>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Output the opening <Project> tag.
|
||||
--
|
||||
|
||||
function m.userProject()
|
||||
local action = p.action.current()
|
||||
p.push('<Project ToolsVersion="%s" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">',
|
||||
action.vstudio.toolsVersion)
|
||||
end
|
||||
|
||||
|
||||
|
||||
m.elements.debugSettings = function(cfg)
|
||||
return {
|
||||
m.localDebuggerCommand,
|
||||
m.localDebuggerWorkingDirectory,
|
||||
m.debuggerFlavor,
|
||||
m.localDebuggerCommandArguments,
|
||||
m.localDebuggerDebuggerType,
|
||||
m.localDebuggerEnvironment,
|
||||
m.localDebuggerMergeEnvironment,
|
||||
}
|
||||
end
|
||||
|
||||
function m.debugSettings(cfg)
|
||||
p.callArray(m.elements.debugSettings, cfg)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function m.debuggerFlavor(cfg)
|
||||
if cfg.debugdir or cfg.debugcommand then
|
||||
p.w('<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function m.localDebuggerCommand(cfg)
|
||||
if cfg.debugcommand then
|
||||
local dir = path.translate(cfg.debugcommand)
|
||||
p.w('<LocalDebuggerCommand>%s</LocalDebuggerCommand>', dir)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function m.localDebuggerDebuggerType(cfg)
|
||||
if cfg.debuggertype then
|
||||
p.w('<LocalDebuggerDebuggerType>%s</LocalDebuggerDebuggerType>', cfg.debuggertype)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function m.localDebuggerCommandArguments(cfg)
|
||||
if #cfg.debugargs > 0 then
|
||||
p.x('<LocalDebuggerCommandArguments>%s</LocalDebuggerCommandArguments>', table.concat(cfg.debugargs, " "))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function m.localDebuggerWorkingDirectory(cfg)
|
||||
if cfg.debugdir then
|
||||
local dir = p.vstudio.path(cfg, cfg.debugdir)
|
||||
p.x('<LocalDebuggerWorkingDirectory>%s</LocalDebuggerWorkingDirectory>', dir)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function m.localDebuggerEnvironment(cfg)
|
||||
if #cfg.debugenvs > 0 then
|
||||
local envs = table.concat(cfg.debugenvs, "\n")
|
||||
if cfg.flags.DebugEnvsInherit then
|
||||
envs = envs .. "\n$(LocalDebuggerEnvironment)"
|
||||
end
|
||||
p.w('<LocalDebuggerEnvironment>%s</LocalDebuggerEnvironment>', envs)
|
||||
|
||||
if cfg.flags.DebugEnvsDontMerge then
|
||||
p.w(2,'<LocalDebuggerMergeEnvironment>false</LocalDebuggerMergeEnvironment>')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function m.localDebuggerMergeEnvironment(cfg)
|
||||
if #cfg.debugenvs > 0 and cfg.flags.DebugEnvsDontMerge then
|
||||
p.w(2,'<LocalDebuggerMergeEnvironment>false</LocalDebuggerMergeEnvironment>')
|
||||
end
|
||||
end
|
@ -6,9 +6,6 @@
|
||||
|
||||
local p = premake
|
||||
local vstudio = p.vstudio
|
||||
local cs2005 = vstudio.cs2005
|
||||
local vc2010 = vstudio.vc2010
|
||||
|
||||
|
||||
---
|
||||
-- Define the Visual Studio 2010 export action.
|
||||
@ -56,7 +53,7 @@
|
||||
vstudio.cleanTarget(prj)
|
||||
end,
|
||||
|
||||
pathVars = vstudio.pathVars,
|
||||
pathVars = vstudio.vs2010.pathVars,
|
||||
|
||||
-- This stuff is specific to the Visual Studio exporters
|
||||
|
||||
@ -68,4 +65,3 @@
|
||||
platformToolset = "v110"
|
||||
}
|
||||
}
|
||||
|
@ -5,13 +5,7 @@
|
||||
--
|
||||
|
||||
local p = premake
|
||||
p.vstudio.vc2013 = {}
|
||||
|
||||
local vstudio = p.vstudio
|
||||
local vc2010 = vstudio.vc2010
|
||||
|
||||
local m = vstudio.vc2013
|
||||
|
||||
|
||||
---
|
||||
-- Define the Visual Studio 2013 export action.
|
||||
@ -59,7 +53,7 @@
|
||||
vstudio.cleanTarget(prj)
|
||||
end,
|
||||
|
||||
pathVars = vstudio.pathVars,
|
||||
pathVars = vstudio.vs2010.pathVars,
|
||||
|
||||
-- This stuff is specific to the Visual Studio exporters
|
||||
|
@ -5,13 +5,7 @@
|
||||
--
|
||||
|
||||
local p = premake
|
||||
p.vstudio.vc2015 = {}
|
||||
|
||||
local vstudio = p.vstudio
|
||||
local vc2010 = vstudio.vc2010
|
||||
|
||||
local m = vstudio.vc2015
|
||||
|
||||
|
||||
---
|
||||
-- Define the Visual Studio 2015 export action.
|
||||
@ -59,7 +53,7 @@
|
||||
vstudio.cleanTarget(prj)
|
||||
end,
|
||||
|
||||
pathVars = vstudio.pathVars,
|
||||
pathVars = vstudio.vs2010.pathVars,
|
||||
|
||||
-- This stuff is specific to the Visual Studio exporters
|
||||
|
@ -5,13 +5,7 @@
|
||||
--
|
||||
|
||||
local p = premake
|
||||
p.vstudio.vc2017 = {}
|
||||
|
||||
local vstudio = p.vstudio
|
||||
local vc2010 = vstudio.vc2010
|
||||
|
||||
local m = vstudio.vc2017
|
||||
|
||||
|
||||
---
|
||||
-- Define the Visual Studio 2017 export action.
|
||||
@ -40,26 +34,26 @@
|
||||
-- Workspace and project generation logic
|
||||
|
||||
onWorkspace = function(wks)
|
||||
vstudio.vs2005.generateSolution(wks)
|
||||
p.vstudio.vs2005.generateSolution(wks)
|
||||
end,
|
||||
onProject = function(prj)
|
||||
vstudio.vs2010.generateProject(prj)
|
||||
p.vstudio.vs2010.generateProject(prj)
|
||||
end,
|
||||
onRule = function(rule)
|
||||
vstudio.vs2010.generateRule(rule)
|
||||
p.vstudio.vs2010.generateRule(rule)
|
||||
end,
|
||||
|
||||
onCleanWorkspace = function(wks)
|
||||
vstudio.cleanSolution(wks)
|
||||
p.vstudio.cleanSolution(wks)
|
||||
end,
|
||||
onCleanProject = function(prj)
|
||||
vstudio.cleanProject(prj)
|
||||
p.vstudio.cleanProject(prj)
|
||||
end,
|
||||
onCleanTarget = function(prj)
|
||||
vstudio.cleanTarget(prj)
|
||||
p.vstudio.cleanTarget(prj)
|
||||
end,
|
||||
|
||||
pathVars = vstudio.pathVars,
|
||||
pathVars = vstudio.vs2010.pathVars,
|
||||
|
||||
-- This stuff is specific to the Visual Studio exporters
|
||||
|
@ -1,17 +1,21 @@
|
||||
--
|
||||
-- _vstudio.lua
|
||||
-- vstudio.lua
|
||||
-- Define the Visual Studio 200x actions.
|
||||
-- Copyright (c) 2008-2013 Jason Perkins and the Premake project
|
||||
-- Copyright (c) 2002-2017 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
p.vstudio = {}
|
||||
local vstudio = p.vstudio
|
||||
|
||||
p.modules.vstudio = p.modules.vstudio or {}
|
||||
p.modules.vstudio._VERSION = p._VERSION
|
||||
|
||||
-- for backwards compatibility.
|
||||
p.vstudio = p.modules.vstudio
|
||||
|
||||
local vstudio = p.vstudio
|
||||
local project = p.project
|
||||
local config = p.config
|
||||
|
||||
|
||||
--
|
||||
-- Mapping tables from Premake systems and architectures to Visual Studio
|
||||
-- identifiers. Broken out as tables so new values can be pushed in by
|
||||
@ -616,3 +620,22 @@
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Load all required code, and return the module.
|
||||
--
|
||||
|
||||
include("vs200x_vcproj.lua")
|
||||
include("vs200x_vcproj_user.lua")
|
||||
include("vs2005_solution.lua")
|
||||
include("vs2005_csproj.lua")
|
||||
include("vs2005_csproj_user.lua")
|
||||
include("vs2010_nuget.lua")
|
||||
include("vs2010_vcxproj.lua")
|
||||
include("vs2010_vcxproj_user.lua")
|
||||
include("vs2010_vcxproj_filters.lua")
|
||||
include("vs2010_rules_props.lua")
|
||||
include("vs2010_rules_targets.lua")
|
||||
include("vs2010_rules_xml.lua")
|
||||
|
||||
return p.modules.vstudio
|
@ -64,28 +64,6 @@
|
||||
"tools/snc.lua",
|
||||
"tools/clang.lua",
|
||||
|
||||
-- Visual Studio actions
|
||||
"actions/vstudio/_vstudio.lua",
|
||||
"actions/vstudio/vs2005.lua",
|
||||
"actions/vstudio/vs2008.lua",
|
||||
"actions/vstudio/vs200x_vcproj.lua",
|
||||
"actions/vstudio/vs200x_vcproj_user.lua",
|
||||
"actions/vstudio/vs2005_solution.lua",
|
||||
"actions/vstudio/vs2005_csproj.lua",
|
||||
"actions/vstudio/vs2005_csproj_user.lua",
|
||||
"actions/vstudio/vs2010.lua",
|
||||
"actions/vstudio/vs2010_nuget.lua",
|
||||
"actions/vstudio/vs2010_vcxproj.lua",
|
||||
"actions/vstudio/vs2010_vcxproj_user.lua",
|
||||
"actions/vstudio/vs2010_vcxproj_filters.lua",
|
||||
"actions/vstudio/vs2010_rules_props.lua",
|
||||
"actions/vstudio/vs2010_rules_targets.lua",
|
||||
"actions/vstudio/vs2010_rules_xml.lua",
|
||||
"actions/vstudio/vs2012.lua",
|
||||
"actions/vstudio/vs2013.lua",
|
||||
"actions/vstudio/vs2015.lua",
|
||||
"actions/vstudio/vs2017.lua",
|
||||
|
||||
-- Clean action
|
||||
"actions/clean/_clean.lua",
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user