Initial community commit
This commit is contained in:
108
Src/external_dependencies/openmpt-trunk/include/premake/modules/vstudio/tests/_tests.lua
vendored
Normal file
108
Src/external_dependencies/openmpt-trunk/include/premake/modules/vstudio/tests/_tests.lua
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
require ("vstudio")
|
||||
|
||||
return {
|
||||
-- Visual Studio .Net projects
|
||||
"dotnet2005/projectelement.lua",
|
||||
"dotnet2005/test_nuget_framework_folders.lua",
|
||||
|
||||
-- Visual Studio 2005+ C# projects
|
||||
"cs2005/test_assembly_refs.lua",
|
||||
"cs2005/test_build_events.lua",
|
||||
"cs2005/test_common_props.lua",
|
||||
"cs2005/test_compiler_props.lua",
|
||||
"cs2005/test_no_warn.lua",
|
||||
"cs2005/test_debug_props.lua",
|
||||
"cs2005/test_debug_props_2019.lua",
|
||||
"cs2005/test_files.lua",
|
||||
"cs2005/test_icon.lua",
|
||||
"cs2005/test_netcore.lua",
|
||||
"cs2005/test_nuget_config.lua",
|
||||
"cs2005/test_nuget_packages_config.lua",
|
||||
"cs2005/test_nuget_references.lua",
|
||||
"cs2005/test_output_props.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+ 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",
|
||||
"sln2005/test_shared_projects.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+ C/C++ projects
|
||||
"vc2010/test_assembly_refs.lua",
|
||||
"vc2010/test_build_events.lua",
|
||||
"vc2010/test_build_log.lua",
|
||||
"vc2010/test_build_steps.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_fxcompile_settings.lua",
|
||||
"vc2010/test_globals.lua",
|
||||
"vc2010/test_header.lua",
|
||||
"vc2010/test_files.lua",
|
||||
"vc2010/test_filter_ids.lua",
|
||||
"vc2010/test_filters.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_nuget_package_references.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_tokens.lua",
|
||||
"vc2010/test_target_machine.lua",
|
||||
"vc2010/test_user_file.lua",
|
||||
"vc2010/test_vectorextensions.lua",
|
||||
"vc2010/test_ensure_nuget_imports.lua",
|
||||
|
||||
-- Visual Studio 2013+ C/C++ Shared Items projects
|
||||
"vc2013/test_vcxitems.lua",
|
||||
|
||||
-- Visual Studio 2019+ C/C++ Projects
|
||||
"vc2019/test_compile_settings.lua",
|
||||
"vc2019/test_link.lua",
|
||||
"vc2019/test_toolset_settings.lua",
|
||||
|
||||
-- Visual Studio 2022+ C/C++ Projects
|
||||
"vc2022/test_toolset_settings.lua"
|
||||
}
|
||||
@@ -0,0 +1,291 @@
|
||||
--
|
||||
-- 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_dn2005_projectsettings")
|
||||
local dn2005 = p.vstudio.dotnetbase
|
||||
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)
|
||||
|
||||
dn2005.prepare(cs2005)
|
||||
dn2005.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
|
||||
|
||||
|
||||
function suite.onVs2015()
|
||||
p.action.set("vs2015")
|
||||
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>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.onVs2017()
|
||||
p.action.set("vs2017")
|
||||
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.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onVs2019()
|
||||
p.action.set("vs2019")
|
||||
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.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</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
|
||||
|
||||
|
||||
--
|
||||
-- Lang version tests
|
||||
--
|
||||
|
||||
function suite.OnCSVersion()
|
||||
csversion "6"
|
||||
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>
|
||||
<LangVersion>6</LangVersion>
|
||||
</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
|
||||
@@ -0,0 +1,419 @@
|
||||
--
|
||||
-- tests/actions/vstudio/cs2005/test_assembly_refs.lua
|
||||
-- Test the assembly linking block of a Visual Studio 2005+ C# project.
|
||||
-- Copyright (c) 2012-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_cs2005_assembly_refs")
|
||||
local dn2005 = p.vstudio.dotnetbase
|
||||
|
||||
|
||||
--
|
||||
-- Setup and teardown
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
wks = test.createWorkspace()
|
||||
language "C#"
|
||||
end
|
||||
|
||||
local function prepare(platform)
|
||||
prj = test.getproject(wks, 1)
|
||||
|
||||
dn2005.references(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Block should be empty if the project has no links.
|
||||
--
|
||||
|
||||
function suite.emptyGroup_onNoLinks()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of system assemblies.
|
||||
--
|
||||
|
||||
function suite.assemblyRef_onSystemAssembly()
|
||||
links { "System" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Assemblies referenced by a path should get a hint.
|
||||
--
|
||||
|
||||
function suite.assemblyRef_onPath()
|
||||
links { "../Libraries/nunit.framework" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Assemblies referenced via a token that expands to an absolute
|
||||
-- path should still end up with a relative hint path.
|
||||
--
|
||||
|
||||
function suite.assemblyRef_onAbsoluteToken()
|
||||
links { "%{path.getdirectory(os.getcwd())}/Libraries/nunit.framework" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Add configuration condition to VS csproj references ItemGroup
|
||||
--
|
||||
|
||||
function suite.assemblyRef_onConfigurationCondition()
|
||||
links { "%{path.getdirectory(os.getcwd())}/Libraries/%{cfg.buildcfg}/nunit.framework" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\Libraries\Debug\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\Libraries\Release\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- The assembly should not be copied to the target directory if the
|
||||
-- NoCopyLocal flag has been set for the configuration.
|
||||
--
|
||||
|
||||
function suite.markedPrivate_onNoCopyLocal()
|
||||
links { "../Libraries/nunit.framework" }
|
||||
flags { "NoCopyLocal" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If there are entries in the copylocal() list, then only those
|
||||
-- specific libraries should be copied.
|
||||
--
|
||||
|
||||
function suite.markedPrivate_onCopyLocalListExclusion()
|
||||
links { "../Libraries/nunit.framework" }
|
||||
copylocal { "SomeOtherProject" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.notMarkedPrivate_onCopyLocalListInclusion()
|
||||
links { "../Libraries/nunit.framework" }
|
||||
copylocal { "../Libraries/nunit.framework" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- NuGet packages should get references.
|
||||
--
|
||||
|
||||
if _OPTIONS["test-all"] then
|
||||
function suite.nuGetPackages_net45()
|
||||
dotnetframework "4.5"
|
||||
nuget { "Newtonsoft.Json:10.0.2" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.nuGetPackages_net30()
|
||||
dotnetframework "3.0"
|
||||
nuget { "Newtonsoft.Json:10.0.2" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>packages\Newtonsoft.Json.10.0.2\lib\net20\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>packages\Newtonsoft.Json.10.0.2\lib\net20\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If there are multiple assemblies in the NuGet package, they all should be
|
||||
-- referenced.
|
||||
--
|
||||
|
||||
if _OPTIONS["test-all"] then
|
||||
function suite.nuGetPackages_multipleAssemblies()
|
||||
dotnetframework "2.0"
|
||||
nuget { "NUnit:3.6.1" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>packages\NUnit.3.6.1\lib\net20\nunit.framework.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NUnit.System.Linq">
|
||||
<HintPath>packages\NUnit.3.6.1\lib\net20\NUnit.System.Linq.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>packages\NUnit.3.6.1\lib\net20\nunit.framework.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NUnit.System.Linq">
|
||||
<HintPath>packages\NUnit.3.6.1\lib\net20\NUnit.System.Linq.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- NuGet packages should respect copylocal() and the NoCopyLocal flag.
|
||||
--
|
||||
|
||||
if _OPTIONS["test-all"] then
|
||||
function suite.nugetPackages_onNoCopyLocal()
|
||||
dotnetframework "2.0"
|
||||
nuget { "NUnit:3.6.1" }
|
||||
flags { "NoCopyLocal" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>packages\NUnit.3.6.1\lib\net20\nunit.framework.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="NUnit.System.Linq">
|
||||
<HintPath>packages\NUnit.3.6.1\lib\net20\NUnit.System.Linq.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>packages\NUnit.3.6.1\lib\net20\nunit.framework.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="NUnit.System.Linq">
|
||||
<HintPath>packages\NUnit.3.6.1\lib\net20\NUnit.System.Linq.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.nugetPackages_onCopyLocalListExclusion()
|
||||
dotnetframework "2.0"
|
||||
nuget { "NUnit:3.6.1" }
|
||||
copylocal { "SomeOtherProject" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>packages\NUnit.3.6.1\lib\net20\nunit.framework.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="NUnit.System.Linq">
|
||||
<HintPath>packages\NUnit.3.6.1\lib\net20\NUnit.System.Linq.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>packages\NUnit.3.6.1\lib\net20\nunit.framework.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="NUnit.System.Linq">
|
||||
<HintPath>packages\NUnit.3.6.1\lib\net20\NUnit.System.Linq.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.nugetPackages_onCopyLocalListInclusion()
|
||||
dotnetframework "2.0"
|
||||
nuget { "NUnit:3.6.1" }
|
||||
copylocal { "NUnit:3.6.1" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>packages\NUnit.3.6.1\lib\net20\nunit.framework.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NUnit.System.Linq">
|
||||
<HintPath>packages\NUnit.3.6.1\lib\net20\NUnit.System.Linq.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>packages\NUnit.3.6.1\lib\net20\nunit.framework.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NUnit.System.Linq">
|
||||
<HintPath>packages\NUnit.3.6.1\lib\net20\NUnit.System.Linq.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- NuGet packages with unconventional folder structures should be handled
|
||||
-- properly.
|
||||
--
|
||||
|
||||
if _OPTIONS["test-all"] then
|
||||
function suite.nuGetPackages_netFolder()
|
||||
dotnetframework "4.5"
|
||||
nuget { "MetroModernUI:1.4.0" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<Reference Include="MetroFramework.Design">
|
||||
<HintPath>packages\MetroModernUI.1.4.0.0\lib\net\MetroFramework.Design.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="MetroFramework">
|
||||
<HintPath>packages\MetroModernUI.1.4.0.0\lib\net\MetroFramework.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="MetroFramework.Fonts">
|
||||
<HintPath>packages\MetroModernUI.1.4.0.0\lib\net\MetroFramework.Fonts.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Reference Include="MetroFramework.Design">
|
||||
<HintPath>packages\MetroModernUI.1.4.0.0\lib\net\MetroFramework.Design.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="MetroFramework">
|
||||
<HintPath>packages\MetroModernUI.1.4.0.0\lib\net\MetroFramework.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="MetroFramework.Fonts">
|
||||
<HintPath>packages\MetroModernUI.1.4.0.0\lib\net\MetroFramework.Fonts.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,101 @@
|
||||
--
|
||||
-- tests/actions/vstudio/cs2005/test_build_events.lua
|
||||
-- Check generation of pre- and post-build commands for C# projects.
|
||||
-- Copyright (c) 2012-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_cs2005_build_events")
|
||||
local dn2005 = p.vstudio.dotnetbase
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj, cfg
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2005")
|
||||
p.escaper(p.vstudio.vs2010.esc)
|
||||
wks = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare(platform)
|
||||
prj = test.getproject(wks, 1)
|
||||
dn2005.buildEvents(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If no build steps are specified, nothing should be written.
|
||||
--
|
||||
|
||||
function suite.noOutput_onNoEvents()
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If one command set is used and not the other, only the one should be written.
|
||||
--
|
||||
|
||||
function suite.onlyOne_onPreBuildOnly()
|
||||
prebuildcommands { "command1" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>command1</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onlyOne_onPostBuildOnly()
|
||||
postbuildcommands { "command1" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>command1</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.both_onBoth()
|
||||
prebuildcommands { "command1" }
|
||||
postbuildcommands { "command2" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>command1</PreBuildEvent>
|
||||
<PostBuildEvent>command2</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Multiple commands should be separated with un-escaped EOLs.
|
||||
--
|
||||
|
||||
function suite.splits_onMultipleCommands()
|
||||
postbuildcommands { "command1", "command2" }
|
||||
prepare()
|
||||
test.capture ("\t<PropertyGroup>\n\t\t<PostBuildEvent>command1\r\ncommand2</PostBuildEvent>\n\t</PropertyGroup>\n")
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Quotes should not be escaped, other special characters should.
|
||||
--
|
||||
|
||||
function suite.onSpecialChars()
|
||||
postbuildcommands { '\' " < > &' }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>' " < > &</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +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 dn2005 = p.vstudio.dotnetbase
|
||||
|
||||
|
||||
--
|
||||
-- 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)
|
||||
dn2005.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,0 +1,83 @@
|
||||
--
|
||||
-- tests/actions/vstudio/cs2005/test_compiler_props.lua
|
||||
-- Test the compiler flags of a Visual Studio 2005+ C# project.
|
||||
-- Copyright (c) 2012-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_cs2005_compiler_props")
|
||||
local dn2005 = p.vstudio.dotnetbase
|
||||
local project = p.project
|
||||
|
||||
|
||||
--
|
||||
-- Setup and teardown
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2005")
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
dn2005.compilerProps(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of defines.
|
||||
--
|
||||
|
||||
function suite.defineConstants_onDefines()
|
||||
defines { "DEBUG", "TRACE" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check handling of the Unsafe flag.
|
||||
--
|
||||
|
||||
function suite.allowUnsafeBlocks_onUnsafeFlag()
|
||||
clr "Unsafe"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<DefineConstants></DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.allowUnsafeBlocks_onUnsafeFlagNonConfigOnNetcore()
|
||||
dotnetframework "netcoreapp3.1"
|
||||
clr "Unsafe"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<DefineConstants></DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of FatalWarnings flag.
|
||||
--
|
||||
|
||||
|
||||
function suite.treatWarningsAsErrors_onFatalWarningsFlag()
|
||||
flags { "FatalWarnings" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<DefineConstants></DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,106 @@
|
||||
--
|
||||
-- tests/actions/vstudio/cs2005/test_debug_props.lua
|
||||
-- Test debugging and optimization flags block of a Visual Studio 2005+ C# project.
|
||||
-- Copyright (c) 2012-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_cs2005_debug_props")
|
||||
local cs2005 = p.vstudio.cs2005
|
||||
local dn2005 = p.vstudio.dotnetbase
|
||||
local project = p.project
|
||||
|
||||
|
||||
--
|
||||
-- Setup and teardown
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2005")
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
dn2005.debugProps(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the handling of the Symbols flag.
|
||||
--
|
||||
|
||||
function suite.debugSymbols_onNoSymbolsFlag()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.debugSymbols_onSymbolsFlag()
|
||||
symbols "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
]]
|
||||
end
|
||||
|
||||
---
|
||||
--- Check handling of debug parameters.
|
||||
---
|
||||
|
||||
function suite.debugCommandParameters()
|
||||
debugargs "foobar"
|
||||
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
dn2005.debugCommandParameters(cfg)
|
||||
|
||||
test.capture [[
|
||||
<Commandlineparameters>foobar</Commandlineparameters>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.debugStartArguments()
|
||||
debugargs "foobar"
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
cs2005.localDebuggerCommandArguments(cfg)
|
||||
test.capture [[
|
||||
<StartArguments>foobar</StartArguments>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check handling of optimization flags.
|
||||
--
|
||||
|
||||
function suite.optimize_onOptimizeFlag()
|
||||
optimize "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.optimize_onOptimizeSizeFlag()
|
||||
optimize "Size"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.optimize_onOptimizeSpeedFlag()
|
||||
optimize "Speed"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,130 @@
|
||||
--
|
||||
-- tests/actions/vstudio/cs2005/test_debug_props_2019.lua
|
||||
-- Test debugging and optimization flags block of a Visual Studio 2019+ C# project.
|
||||
-- Copyright (c) 2012-2021 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_cs2005_debug_props_2019")
|
||||
local cs2005 = p.vstudio.cs2005
|
||||
local dn2005 = p.vstudio.dotnetbase
|
||||
local project = p.project
|
||||
|
||||
|
||||
--
|
||||
-- Setup and teardown
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2019")
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
dn2005.debugProps(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the handling of the Symbols flag.
|
||||
--
|
||||
|
||||
function suite.debugSymbols_onNoSymbolsFlag()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<DebugType>portable</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<Optimize>false</Optimize>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.debugSymbols_onSymbolsFlag()
|
||||
symbols "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<Optimize>false</Optimize>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.debugSymbols_fullSymbolsFlag()
|
||||
symbols "Full"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<DebugType>full</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<Optimize>false</Optimize>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.debugSymbols_offSymbolsFlag()
|
||||
symbols "Off"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<DebugType>none</DebugType>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<Optimize>false</Optimize>
|
||||
]]
|
||||
end
|
||||
|
||||
---
|
||||
--- Check handling of debug parameters.
|
||||
---
|
||||
|
||||
function suite.debugCommandParameters()
|
||||
debugargs "foobar"
|
||||
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
dn2005.debugCommandParameters(cfg)
|
||||
|
||||
test.capture [[
|
||||
<Commandlineparameters>foobar</Commandlineparameters>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.debugStartArguments()
|
||||
debugargs "foobar"
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
cs2005.localDebuggerCommandArguments(cfg)
|
||||
test.capture [[
|
||||
<StartArguments>foobar</StartArguments>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check handling of optimization flags.
|
||||
--
|
||||
|
||||
function suite.optimize_onOptimizeFlag()
|
||||
optimize "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<DebugType>portable</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<Optimize>true</Optimize>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.optimize_onOptimizeSizeFlag()
|
||||
optimize "Size"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<DebugType>portable</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<Optimize>true</Optimize>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.optimize_onOptimizeSpeedFlag()
|
||||
optimize "Speed"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<DebugType>portable</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<Optimize>true</Optimize>
|
||||
]]
|
||||
end
|
||||
401
Src/external_dependencies/openmpt-trunk/include/premake/modules/vstudio/tests/cs2005/test_files.lua
vendored
Normal file
401
Src/external_dependencies/openmpt-trunk/include/premake/modules/vstudio/tests/cs2005/test_files.lua
vendored
Normal file
@@ -0,0 +1,401 @@
|
||||
--
|
||||
-- tests/actions/vstudio/cs2005/test_files.lua
|
||||
-- Validate generation of <Files/> block in Visual Studio 2005 .csproj
|
||||
-- Copyright (c) 2009-2014 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_cs2005_files")
|
||||
local dn2005 = p.vstudio.dotnetbase
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2005")
|
||||
wks = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
prj = test.getproject(wks, 1)
|
||||
dn2005.files(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Test grouping and nesting
|
||||
--
|
||||
|
||||
function suite.SimpleSourceFile()
|
||||
files { "Hello.cs" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Compile Include="Hello.cs" />
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.NestedSourceFile()
|
||||
files { "Src/Hello.cs" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Compile Include="Src\Hello.cs" />
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.PerConfigFile()
|
||||
files { "Hello.cs" }
|
||||
configuration { 'debug' }
|
||||
files { "HelloTwo.cs" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Compile Include="Hello.cs" />
|
||||
<Compile Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' " Include="HelloTwo.cs" />
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Test file dependencies
|
||||
--
|
||||
|
||||
function suite.resourceDesignerDependency()
|
||||
files { "Resources.resx", "Resources.Designer.cs" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Compile Include="Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.publicResourceDesignerDependency()
|
||||
files { "Resources.resx", "Resources.Designer.cs" }
|
||||
resourcegenerator 'public'
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Compile Include="Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Resources.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.settingsDesignerDependency()
|
||||
files { "Properties/Settings.settings", "Properties/Settings.Designer.cs" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.datasetDesignerDependency()
|
||||
files { "DataSet.xsd", "DataSet.Designer.cs" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Compile Include="DataSet.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>DataSet.xsd</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="DataSet.xsd">
|
||||
<Generator>MSDataSetGenerator</Generator>
|
||||
<LastGenOutput>DataSet.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.datasetDependencies()
|
||||
files { "DataSet.xsd", "DataSet.xsc", "DataSet.xss" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<None Include="DataSet.xsc">
|
||||
<DependentUpon>DataSet.xsd</DependentUpon>
|
||||
</None>
|
||||
<None Include="DataSet.xsd" />
|
||||
<None Include="DataSet.xss">
|
||||
<DependentUpon>DataSet.xsd</DependentUpon>
|
||||
</None>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.textTemplatingDependency()
|
||||
files { "foobar.tt", "foobar.cs" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Compile Include="foobar.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>foobar.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Content Include="foobar.tt">
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>foobar.cs</LastGenOutput>
|
||||
</Content>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- File associations should always be made relative to the file
|
||||
-- which is doing the associating.
|
||||
--
|
||||
|
||||
function suite.resourceDependency_inSubfolder()
|
||||
files { "Forms/TreeListView.resx", "Forms/TreeListView.cs" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Compile Include="Forms\TreeListView.cs" />
|
||||
<EmbeddedResource Include="Forms\TreeListView.resx">
|
||||
<DependentUpon>TreeListView.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.datasetDependency_inSubfolder()
|
||||
files { "DataSets/DataSet.xsd", "DataSets/DataSet.Designer.cs" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Compile Include="DataSets\DataSet.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>DataSet.xsd</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="DataSets\DataSet.xsd">
|
||||
<Generator>MSDataSetGenerator</Generator>
|
||||
<LastGenOutput>DataSet.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Test build actions.
|
||||
--
|
||||
|
||||
function suite.copyAction()
|
||||
files { "Hello.txt" }
|
||||
filter "files:**.txt"
|
||||
buildaction "Copy"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Content Include="Hello.txt">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.componentAction()
|
||||
files { "Hello.cs" }
|
||||
filter "files:Hello.cs"
|
||||
buildaction "Component"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Compile Include="Hello.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.embeddedResourceAction()
|
||||
files { "Hello.ico" }
|
||||
filter "files:*.ico"
|
||||
buildaction "Embed"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<EmbeddedResource Include="Hello.ico" />
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.formAction()
|
||||
files { "HelloForm.cs" }
|
||||
filter "files:HelloForm.cs"
|
||||
buildaction "Form"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Compile Include="HelloForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.userControlAction()
|
||||
files { "Hello.cs" }
|
||||
filter "files:Hello.cs"
|
||||
buildaction "UserControl"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Compile Include="Hello.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.resourceAction()
|
||||
files { "Hello.ico" }
|
||||
filter "files:*.ico"
|
||||
buildaction "Resource"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Resource Include="Hello.ico" />
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Files that exist outside the project folder should be added as
|
||||
-- links, with a relative path. Weird but true.
|
||||
--
|
||||
|
||||
function suite.usesLink_onExternalSourceCode()
|
||||
files { "../Hello.cs" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Compile Include="..\Hello.cs">
|
||||
<Link>Hello.cs</Link>
|
||||
</Compile>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.usesLinkInFolder_onExternalSourceCode()
|
||||
files { "../Src/Hello.cs" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Compile Include="..\Src\Hello.cs">
|
||||
<Link>Src\Hello.cs</Link>
|
||||
</Compile>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.usesLinkInFolder_onExternalContent()
|
||||
files { "../Resources/Hello.txt" }
|
||||
filter "files:**.txt"
|
||||
buildaction "Copy"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Content Include="..\Resources\Hello.txt">
|
||||
<Link>Resources\Hello.txt</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.usesLinkInFolder_onExternalReference()
|
||||
files { "../Resources/Hello.txt" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<None Include="..\Resources\Hello.txt">
|
||||
<Link>Resources\Hello.txt</Link>
|
||||
</None>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Files that exist outside the project's folder are allowed to be
|
||||
-- placed into a folder using a virtual path, which is better than
|
||||
-- dropping them at the root. Files within the project folder cannot
|
||||
-- use virtual paths, because Visual Studio won't allow it.
|
||||
--
|
||||
|
||||
function suite.usesLinks_onVpath_onLocalSourceFile()
|
||||
files { "Hello.cs" }
|
||||
vpaths { ["Sources"] = "**.cs" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Compile Include="Hello.cs" />
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.usesLinks_onVpath_onExternalSourceFile()
|
||||
files { "../Src/Hello.cs" }
|
||||
vpaths { ["Sources"] = "../**.cs" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Compile Include="..\Src\Hello.cs">
|
||||
<Link>Sources\Hello.cs</Link>
|
||||
</Compile>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check WPF XAML handling.
|
||||
--
|
||||
|
||||
function suite.associatesFiles_onXamlForm()
|
||||
files { "MainWindow.xaml", "MainWindow.xaml.cs" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.xamlApp_onAppXaml()
|
||||
files { "App.xaml", "App.xaml.cs" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.xamlApp_onBuildAction()
|
||||
files { "MyApp.xaml", "MyApp.xaml.cs" }
|
||||
filter "files:MyApp.xaml"
|
||||
buildaction "Application"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ApplicationDefinition Include="MyApp.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="MyApp.xaml.cs">
|
||||
<DependentUpon>MyApp.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
]]
|
||||
end
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
--
|
||||
-- tests/actions/vstudio/cs2005/test_icon.lua
|
||||
-- Validate generation of the application icon declaration.
|
||||
-- Copyright (c) 2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_cs2005_icon")
|
||||
local dn2005 = p.vstudio.dotnetbase
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2005")
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
prj = test.getproject(wks, 1)
|
||||
dn2005.applicationIcon(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- By default, there should be no output.
|
||||
--
|
||||
|
||||
function suite.noOutput_onNoIcon()
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If an icon is specified, output the property group.
|
||||
--
|
||||
|
||||
function suite.doesOutput_onIcon()
|
||||
icon "MyApp.ico"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>MyApp.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,134 @@
|
||||
--
|
||||
-- tests/actions/vstudio/cs2005/test_output_props.lua
|
||||
-- Test the target output settings of a Visual Studio 2005+ C# project.
|
||||
-- Copyright (c) 2012-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_cs2005_netcore_prj")
|
||||
local dn2005 = p.vstudio.dotnetbase
|
||||
local cs2005 = p.vstudio.cs2005
|
||||
local project = p.project
|
||||
|
||||
|
||||
--
|
||||
-- Setup and teardown
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2005")
|
||||
wks, prj = test.createWorkspace()
|
||||
language "C#"
|
||||
end
|
||||
|
||||
local function targetFrameworkPrepare()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
dn2005.netcore.targetFramework(cfg)
|
||||
end
|
||||
|
||||
local function targetFrameworkVersionPrepare()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
dn2005.targetFrameworkVersion(cfg)
|
||||
end
|
||||
|
||||
local function prepareNetcore()
|
||||
dn2005.projectElement(prj)
|
||||
end
|
||||
|
||||
local function prepareProjectProperties()
|
||||
local localProj = test.getproject(wks, 1)
|
||||
|
||||
dn2005.prepare(cs2005)
|
||||
dn2005.projectProperties(localProj)
|
||||
end
|
||||
|
||||
function suite.targetFrameworkProperty_framework()
|
||||
dotnetframework "4.7.2"
|
||||
targetFrameworkPrepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
function suite.targetFrameworkProperty_core()
|
||||
dotnetframework "netcoreapp2.2"
|
||||
targetFrameworkPrepare()
|
||||
test.capture [[
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.targetFrameworkProperty_standard()
|
||||
dotnetframework "netstandard1.2"
|
||||
targetFrameworkPrepare()
|
||||
test.capture [[
|
||||
<TargetFramework>netstandard1.2</TargetFramework>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.targetFrameworkVersionProperty_framework()
|
||||
dotnetframework "4.7.2"
|
||||
targetFrameworkVersionPrepare()
|
||||
test.capture [[
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.targetFrameworkVersionProperty_core()
|
||||
dotnetframework "netcoreapp2.2"
|
||||
targetFrameworkVersionPrepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
function suite.targetFrameworkVersionProperty_standard()
|
||||
dotnetframework "netstandard1.2"
|
||||
targetFrameworkVersionPrepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
function suite.project_element_standard()
|
||||
dotnetframework "netstandard1.2"
|
||||
prepareNetcore()
|
||||
test.capture [[
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.project_element_core()
|
||||
dotnetframework "netcoreapp1.2"
|
||||
prepareNetcore()
|
||||
test.capture [[
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.project_element_net5()
|
||||
dotnetframework "net5.0"
|
||||
prepareNetcore()
|
||||
test.capture [[
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.project_element_framework()
|
||||
dotnetframework "4.7.2"
|
||||
prepareNetcore()
|
||||
test.capture [[
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.allowUnsafeProperty_core()
|
||||
dotnetframework "netcoreapp2.2"
|
||||
clr "Unsafe"
|
||||
prepareProjectProperties()
|
||||
test.capture [[
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,50 @@
|
||||
--
|
||||
-- tests/actions/vstudio/cs2005/test_no_warn.lua
|
||||
-- Validate generation of disabling warnings for Visual Studio 2010 and newer.
|
||||
-- Copyright (c) 2012-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_cs2005_no_warn")
|
||||
local dn2005 = p.vstudio.dotnetbase
|
||||
local project = p.project
|
||||
|
||||
|
||||
--
|
||||
-- Setup and teardown
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
dn2005.NoWarn
|
||||
(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If no disableWarnings are specified, nothing should be written.
|
||||
--
|
||||
|
||||
function suite.noOutput_onNoDisableWarnings()
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
--
|
||||
-- Handling of disableWarnings
|
||||
--
|
||||
|
||||
function suite.output_onDisableWarnings()
|
||||
disablewarnings { "1018", "1019" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<NoWarn>1018;1019</NoWarn>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,83 @@
|
||||
--
|
||||
-- tests/actions/vstudio/cs2005/test_nuget_config.lua
|
||||
-- Validate generation of NuGet.Config files for Visual Studio 2010 and newer
|
||||
-- Copyright (c) 2017 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_cs2005_nuget_config")
|
||||
local cs2005 = p.vstudio.cs2005
|
||||
local nuget2010 = p.vstudio.nuget2010
|
||||
|
||||
|
||||
--
|
||||
-- Setup and teardown
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
wks = test.createWorkspace()
|
||||
language "C#"
|
||||
end
|
||||
|
||||
local function prepare(platform)
|
||||
prj = test.getproject(wks, 1)
|
||||
nuget2010.generateNuGetConfig(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Shouldn't output a file if no packages or sources have been set.
|
||||
--
|
||||
|
||||
function suite.noOutputIfNoPackages()
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Shouldn't output a file if no package sources have been set.
|
||||
--
|
||||
|
||||
function suite.noOutputIfNoPackageSources()
|
||||
dotnetframework "4.6"
|
||||
nuget "NUnit:3.6.1"
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Shouldn't output a file if no packages have been set.
|
||||
--
|
||||
|
||||
function suite.noOutputIfNoPackagesButSource()
|
||||
dotnetframework "4.6"
|
||||
nugetsource "https://www.myget.org/F/premake-nuget-test/api/v3/index.json"
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Writes the NuGet.Config file properly.
|
||||
--
|
||||
|
||||
function suite.structureIsCorrect()
|
||||
dotnetframework "4.6"
|
||||
nuget "NUnit:3.6.1"
|
||||
nugetsource "https://www.myget.org/F/premake-nuget-test/api/v3/index.json"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<clear />
|
||||
<add key="https://www.myget.org/F/premake-nuget-test/api/v3/index.json" value="https://www.myget.org/F/premake-nuget-test/api/v3/index.json" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,58 @@
|
||||
--
|
||||
-- tests/actions/vstudio/cs2005/test_assembly_refs.lua
|
||||
-- Validate generation of NuGet packages.config file for Visual Studio 2010 and newer.
|
||||
-- Copyright (c) 2012-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_cs2005_nuget_packages_config")
|
||||
local cs2005 = p.vstudio.cs2005
|
||||
local nuget2010 = p.vstudio.nuget2010
|
||||
|
||||
|
||||
--
|
||||
-- Setup and teardown
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
wks = test.createWorkspace()
|
||||
language "C#"
|
||||
end
|
||||
|
||||
local function prepare(platform)
|
||||
prj = test.getproject(wks, 1)
|
||||
nuget2010.generatePackagesConfig(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Should not output anything if no packages have been set.
|
||||
--
|
||||
|
||||
function suite.noOutputIfNoPackages()
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Writes the packages.config file properly.
|
||||
--
|
||||
|
||||
function suite.structureIsCorrect()
|
||||
dotnetframework "4.6"
|
||||
nuget { "Newtonsoft.Json:10.0.2", "NUnit:3.6.1", "SSH.NET:2016.0.0" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="10.0.2" targetFramework="net46" />
|
||||
<package id="NUnit" version="3.6.1" targetFramework="net46" />
|
||||
<package id="SSH.NET" version="2016.0.0" targetFramework="net46" />
|
||||
</packages>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,41 @@
|
||||
--
|
||||
-- tests/actions/vstudio/cs2005/test_nuget_references.lua
|
||||
-- Validate generation of NuGet package references files for Visual Studio 2010 and newer
|
||||
-- Copyright (c) 2017 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_cs2005_nuget_references")
|
||||
local dn2005 = p.vstudio.dotnetbase
|
||||
local nuget2010 = p.vstudio.nuget2010
|
||||
|
||||
|
||||
--
|
||||
-- Setup and teardown
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
_OPTIONS.os = "macosx"
|
||||
p.action.set("vs2010")
|
||||
wks = test.createWorkspace()
|
||||
language "C#"
|
||||
end
|
||||
|
||||
local function prepare(platform)
|
||||
prj = test.getproject(wks, 1)
|
||||
dn2005.nuGetReferences(prj)
|
||||
end
|
||||
|
||||
--
|
||||
-- Check that we process Unix-style paths correctly.
|
||||
--
|
||||
|
||||
if _OPTIONS["test-all"] then
|
||||
function suite.unixPaths()
|
||||
dotnetframework "4.6"
|
||||
nuget "Mono.Cecil:0.9.6.4"
|
||||
prepare()
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,66 @@
|
||||
--
|
||||
-- tests/actions/vstudio/cs2005/test_output_props.lua
|
||||
-- Test the target output settings of a Visual Studio 2005+ C# project.
|
||||
-- Copyright (c) 2012-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_cs2005_output_props")
|
||||
local dn2005 = p.vstudio.dotnetbase
|
||||
local project = p.project
|
||||
|
||||
|
||||
--
|
||||
-- Setup and teardown
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2005")
|
||||
wks, prj = test.createWorkspace()
|
||||
language "C#"
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
dn2005.outputProps(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of the output directory.
|
||||
--
|
||||
|
||||
function suite.outputDirectory_onTargetDir()
|
||||
targetdir "../build"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<OutputPath>..\build\</OutputPath>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of the intermediates directory.
|
||||
--
|
||||
|
||||
function suite.intermediateDirectory_onVs2008()
|
||||
p.action.set("vs2008")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<IntermediateOutputPath>obj\Debug\</IntermediateOutputPath>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.intermediateDirectory_onVs2010()
|
||||
p.action.set("vs2010")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<BaseIntermediateOutputPath>obj\Debug\</BaseIntermediateOutputPath>
|
||||
<IntermediateOutputPath>$(BaseIntermediateOutputPath)</IntermediateOutputPath>
|
||||
]]
|
||||
end
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
--
|
||||
-- tests/actions/vstudio/cs2005/test_platform_groups.lua
|
||||
-- Check creation of per-platform property groups in VS2005+ C# projects.
|
||||
-- Copyright (c) 2009-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_cs2005_platform_groups")
|
||||
local dn2005 = p.vstudio.dotnetbase
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
wks = workspace("MyWorkspace")
|
||||
configurations { "Debug", "Release" }
|
||||
language "C#"
|
||||
end
|
||||
|
||||
local function prepare(platform)
|
||||
local prj = project("MyProject")
|
||||
local cfg = test.getconfig(prj, "Debug", platform)
|
||||
dn2005.propertyGroup(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check defaults.
|
||||
--
|
||||
|
||||
function suite.vs2008()
|
||||
p.action.set("vs2008")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.vs2010()
|
||||
p.action.set("vs2010")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of specific architectures.
|
||||
--
|
||||
|
||||
function suite.vs2008_onAnyCpu()
|
||||
p.action.set("vs2008")
|
||||
platforms "Any CPU"
|
||||
prepare("Any CPU")
|
||||
test.capture [[
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.vs2010_onAnyCpu()
|
||||
p.action.set("vs2010")
|
||||
platforms "Any CPU"
|
||||
prepare("Any CPU")
|
||||
test.capture [[
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onX86()
|
||||
platforms "x86"
|
||||
prepare("x86")
|
||||
test.capture [[
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.onX86_64()
|
||||
platforms "x86_64"
|
||||
prepare("x86_64")
|
||||
test.capture [[
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.onArbitrary64bitPlatform()
|
||||
platforms "Win64"
|
||||
system "Windows"
|
||||
architecture "x86_64"
|
||||
prepare("Win64")
|
||||
test.capture [[
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug Win64|x64' ">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
]]
|
||||
end
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
--
|
||||
-- tests/actions/vstudio/cs2005/test_project_refs.lua
|
||||
-- Test the project dependencies block of a Visual Studio 2005+ C# project.
|
||||
-- Copyright (c) 2012 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_cs2005_project_refs")
|
||||
local dn2005 = p.vstudio.dotnetbase
|
||||
|
||||
|
||||
--
|
||||
-- Setup and teardown
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2008")
|
||||
wks = test.createWorkspace()
|
||||
uuid "00112233-4455-6677-8888-99AABBCCDDEE"
|
||||
test.createproject(wks)
|
||||
end
|
||||
|
||||
local function prepare(platform)
|
||||
prj = test.getproject(wks, 2)
|
||||
dn2005.projectReferences(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Block should be empty if the project has no dependencies.
|
||||
--
|
||||
|
||||
function suite.emptyGroup_onNoDependencies()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a sibling project is listed in links()/dependson(), an item group should
|
||||
-- be written with a reference to that sibling project.
|
||||
--
|
||||
|
||||
function suite.projectReferenceAdded_onSiblingProjectLink()
|
||||
links { "MyProject" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="MyProject.vcproj">
|
||||
<Project>{00112233-4455-6677-8888-99AABBCCDDEE}</Project>
|
||||
<Name>MyProject</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.projectReferenceNotAdded_onSiblingProjectDependson()
|
||||
dependson { "MyProject" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Project references should always be specified relative to the
|
||||
-- project doing the referencing.
|
||||
--
|
||||
|
||||
function suite.referencesAreRelative_onDifferentProjectLocation()
|
||||
links { "MyProject" }
|
||||
location "build/MyProject2"
|
||||
project("MyProject")
|
||||
location "build/MyProject"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MyProject\MyProject.vcproj">
|
||||
<Project>{00112233-4455-6677-8888-99AABBCCDDEE}</Project>
|
||||
<Name>MyProject</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- The assembly should not be copied to the target directory if the
|
||||
-- NoCopyLocal flag has been set for the configuration.
|
||||
--
|
||||
|
||||
function suite.markedPrivate_onNoCopyLocal()
|
||||
links { "MyProject" }
|
||||
flags { "NoCopyLocal" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="MyProject.vcproj">
|
||||
<Project>{00112233-4455-6677-8888-99AABBCCDDEE}</Project>
|
||||
<Name>MyProject</Name>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If there are entries in the copylocal() list, then only those
|
||||
-- specific libraries should be copied.
|
||||
--
|
||||
|
||||
function suite.markedPrivate_onCopyLocalListExclusion()
|
||||
links { "MyProject" }
|
||||
copylocal { "SomeOtherProject" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="MyProject.vcproj">
|
||||
<Project>{00112233-4455-6677-8888-99AABBCCDDEE}</Project>
|
||||
<Name>MyProject</Name>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.notMarkedPrivate_onCopyLocalListInclusion()
|
||||
links { "MyProject" }
|
||||
copylocal { "MyProject" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="MyProject.vcproj">
|
||||
<Project>{00112233-4455-6677-8888-99AABBCCDDEE}</Project>
|
||||
<Name>MyProject</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
@@ -0,0 +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
|
||||
@@ -0,0 +1,50 @@
|
||||
--
|
||||
-- tests/actions/vstudio/cs2005/test_user_file.lua
|
||||
-- Verify handling of empty and non-empty .user files for VC#.
|
||||
-- Copyright (c) 2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_cs2005_user_file")
|
||||
local cs2005 = p.vstudio.cs2005
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2008")
|
||||
wks = test.createWorkspace()
|
||||
language "C#"
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local prj = test.getproject(wks, 1)
|
||||
cs2005.generateUser(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If no debugger settings have been specified, then the .user
|
||||
-- file should not be written at all.
|
||||
--
|
||||
|
||||
function suite.noOutput_onNoSettings()
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a debugger setting has been specified, output.
|
||||
--
|
||||
|
||||
function suite.doesOutput_onDebugSettings()
|
||||
debugargs { "hello" }
|
||||
prepare()
|
||||
test.hasoutput()
|
||||
end
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
--
|
||||
-- tests/actions/vstudio/dotnet2005/projectelement.lua
|
||||
-- Validate generation of <Project/> element in Visual Studio 2005+ .csproj
|
||||
-- Copyright (c) 2009-2017 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_dn2005_projectelement")
|
||||
local dn2005 = p.vstudio.dotnetbase
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
dn2005.xmlDeclaration()
|
||||
dn2005.projectElement(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Tests
|
||||
--
|
||||
|
||||
function suite.on2005()
|
||||
p.action.set("vs2005")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.on2008()
|
||||
p.action.set("vs2008")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.on2010()
|
||||
p.action.set("vs2010")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.on2012()
|
||||
p.action.set("vs2012")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.on2013()
|
||||
p.action.set("vs2013")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.on2015()
|
||||
p.action.set("vs2015")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.on2017()
|
||||
p.action.set("vs2017")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.on2019()
|
||||
p.action.set("vs2019")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,42 @@
|
||||
--
|
||||
-- modules/vstudio/tests/dotnet2005/test_nuget_framework_folders.lua
|
||||
-- Validate parsing of framework versions from folder names for
|
||||
-- Visual Studio 2010 and newer
|
||||
-- Copyright (c) 2017 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_dn2005_nuget_framework_folders")
|
||||
local dn2005 = p.vstudio.dotnetbase
|
||||
|
||||
|
||||
function suite.net()
|
||||
test.isequal(dn2005.frameworkVersionForFolder("net451"), "4510000000")
|
||||
test.isequal(dn2005.frameworkVersionForFolder("net45"), "4500000000")
|
||||
test.isequal(dn2005.frameworkVersionForFolder("net20"), "2000000000")
|
||||
test.isequal(dn2005.frameworkVersionForFolder("net35"), "3500000000")
|
||||
test.isequal(dn2005.frameworkVersionForFolder("net"), "0000000000")
|
||||
end
|
||||
|
||||
function suite.numeric()
|
||||
test.isequal(dn2005.frameworkVersionForFolder("10"), "1000000000")
|
||||
test.isequal(dn2005.frameworkVersionForFolder("11"), "1100000000")
|
||||
test.isequal(dn2005.frameworkVersionForFolder("20"), "2000000000")
|
||||
test.isequal(dn2005.frameworkVersionForFolder("45"), "4500000000")
|
||||
end
|
||||
|
||||
function suite.numericWithDots()
|
||||
test.isequal(dn2005.frameworkVersionForFolder("1.0"), "1000000000")
|
||||
test.isequal(dn2005.frameworkVersionForFolder("1.1"), "1100000000")
|
||||
test.isequal(dn2005.frameworkVersionForFolder("2.0"), "2000000000")
|
||||
test.isequal(dn2005.frameworkVersionForFolder("4.5"), "4500000000")
|
||||
end
|
||||
|
||||
function suite.invalid()
|
||||
test.isnil(dn2005.frameworkVersionForFolder("netstandard1.3"))
|
||||
test.isnil(dn2005.frameworkVersionForFolder("sl4"))
|
||||
test.isnil(dn2005.frameworkVersionForFolder("sl5"))
|
||||
test.isnil(dn2005.frameworkVersionForFolder("uap10"))
|
||||
test.isnil(dn2005.frameworkVersionForFolder("wp8"))
|
||||
test.isnil(dn2005.frameworkVersionForFolder("wp71"))
|
||||
end
|
||||
@@ -0,0 +1,289 @@
|
||||
--
|
||||
-- tests/actions/vstudio/fs2005/projectsettings.lua
|
||||
-- Validate generation of root <PropertyGroup/> in Visual Studio 2005+ .fsproj
|
||||
-- Copyright (c) 2009-2017 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_dn2005_projectsettings")
|
||||
local dn2005 = p.vstudio.dotnetbase
|
||||
local cs2005 = p.vstudio.cs2005
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2005")
|
||||
wks = test.createWorkspace()
|
||||
language "F#"
|
||||
uuid "AE61726D-187C-E440-BD07-2556188A6565"
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
prj = test.getproject(wks, 1)
|
||||
|
||||
dn2005.prepare(cs2005)
|
||||
dn2005.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
|
||||
|
||||
|
||||
function suite.onVs2015()
|
||||
p.action.set("vs2015")
|
||||
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>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.onVs2017()
|
||||
p.action.set("vs2017")
|
||||
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>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onVs2019()
|
||||
p.action.set("vs2019")
|
||||
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.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onVs2015_462()
|
||||
p.action.set("vs2015")
|
||||
framework "4.6.2"
|
||||
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.6.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</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
|
||||
@@ -0,0 +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
|
||||
@@ -0,0 +1,78 @@
|
||||
--
|
||||
-- tests/actions/vstudio/sln2005/test_header.lua
|
||||
-- Validate generation of Visual Studio 2005+ solution header.
|
||||
-- Copyright (c) 2009-2014 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_sln2005_header")
|
||||
local sln2005 = p.vstudio.sln2005
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
wks = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
sln2005.header()
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Each supported action should output the corresponding version numbers.
|
||||
--
|
||||
|
||||
function suite.on2005()
|
||||
p.action.set("vs2005")
|
||||
prepare()
|
||||
test.capture [[
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.on2008()
|
||||
p.action.set("vs2008")
|
||||
prepare()
|
||||
test.capture [[
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.on2010()
|
||||
p.action.set("vs2010")
|
||||
prepare()
|
||||
test.capture [[
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.on2012()
|
||||
p.action.set("vs2012")
|
||||
prepare()
|
||||
test.capture [[
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.on2013()
|
||||
p.action.set("vs2013")
|
||||
prepare()
|
||||
test.capture [[
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,104 @@
|
||||
--
|
||||
-- tests/actions/vstudio/sln2005/test_nested_projects.lua
|
||||
-- Check Visual Studio 2005+ Nested Projects solution block.
|
||||
-- Copyright (c) 2012-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_sln2005_nested_projects")
|
||||
local sln2005 = p.vstudio.sln2005
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2008")
|
||||
wks = workspace("MyWorkspace")
|
||||
configurations { "Debug", "Release" }
|
||||
language "C++"
|
||||
kind "ConsoleApp"
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
sln2005.nestedProjects(wks)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- This block should only be written if solution groups are present.
|
||||
--
|
||||
|
||||
function suite.isEmpty_onNoGroups()
|
||||
project "MyProject"
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Should be written even if first entry in project tree is not a group.
|
||||
--
|
||||
|
||||
function suite.writesBlock_onUngroupedFirstProject()
|
||||
project "MyProject"
|
||||
group "Alpha"
|
||||
project "MyProject2"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check nesting with a single group and project.
|
||||
--
|
||||
|
||||
function suite.onSingleGroup()
|
||||
group "Alpha"
|
||||
project "MyProject"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{42B5DBC6-AE1F-903D-F75D-41E363076E92} = {D2C41116-3E7A-8A0B-C76E-84E23323810F}
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check nesting with multiple levels of groups.
|
||||
--
|
||||
|
||||
function suite.onNestedGroups()
|
||||
group "Alpha/Beta"
|
||||
project "MyProject"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{BD0520A9-A9FE-3EFB-D230-2480BE881E07} = {D2C41116-3E7A-8A0B-C76E-84E23323810F}
|
||||
{42B5DBC6-AE1F-903D-F75D-41E363076E92} = {BD0520A9-A9FE-3EFB-D230-2480BE881E07}
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Ungrouped projects should not appear in the list.
|
||||
--
|
||||
|
||||
function suite.onUngroupedProject()
|
||||
group "Alpha"
|
||||
project "MyProject"
|
||||
group ""
|
||||
project "MyProject2"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{42B5DBC6-AE1F-903D-F75D-41E363076E92} = {D2C41116-3E7A-8A0B-C76E-84E23323810F}
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,804 @@
|
||||
--
|
||||
-- tests/actions/vstudio/sln2005/test_platforms.lua
|
||||
-- Test the Visual Studio 2005-2010 platform mapping blocks.
|
||||
-- Copyright (c) 2009-2014 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_sln2005_platforms")
|
||||
local sln2005 = p.vstudio.sln2005
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2008")
|
||||
wks = workspace("MyWorkspace")
|
||||
configurations { "Debug", "Release" }
|
||||
language "C++"
|
||||
end
|
||||
|
||||
local function prepare(lang)
|
||||
filter {}
|
||||
uuid "C9135098-6047-8142-B10E-D27E7F73FCB3"
|
||||
wks = test.getWorkspace(wks)
|
||||
sln2005.configurationPlatforms(wks)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the default settings, when no platforms or architectures are used.
|
||||
--
|
||||
|
||||
function suite.onSingleCpp_noPlatforms_noArchs()
|
||||
project "MyProject"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onSingleCs_noPlatforms_noArchs()
|
||||
project "MyProject"
|
||||
language "C#"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onMixedLanguage_noPlatforms_noArchs()
|
||||
project "MyProject1"
|
||||
language "C#"
|
||||
uuid "52AD9329-0D74-4F66-A213-E649D8CCD737"
|
||||
|
||||
project "MyProject2"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Mixed Platforms = Debug|Mixed Platforms
|
||||
Release|Mixed Platforms = Release|Mixed Platforms
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Mixed Platforms.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If platforms are specified, use it to identify the configurations.
|
||||
--
|
||||
|
||||
function suite.onSingleCpp_withPlatforms_noArchs()
|
||||
platforms { "DLL", "Static" }
|
||||
project "MyProject"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|DLL = Debug|DLL
|
||||
Debug|Static = Debug|Static
|
||||
Release|DLL = Release|DLL
|
||||
Release|Static = Release|Static
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL.ActiveCfg = Debug DLL|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL.Build.0 = Debug DLL|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Static.ActiveCfg = Debug Static|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Static.Build.0 = Debug Static|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL.ActiveCfg = Release DLL|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL.Build.0 = Release DLL|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Static.ActiveCfg = Release Static|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Static.Build.0 = Release Static|Win32
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onSingleCs_withPlatforms_noArchs()
|
||||
platforms { "DLL", "Static" }
|
||||
project "MyProject"
|
||||
language "C#"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|DLL = Debug|DLL
|
||||
Debug|Static = Debug|Static
|
||||
Release|DLL = Release|DLL
|
||||
Release|Static = Release|Static
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL.ActiveCfg = Debug DLL|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL.Build.0 = Debug DLL|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Static.ActiveCfg = Debug Static|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Static.Build.0 = Debug Static|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL.ActiveCfg = Release DLL|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL.Build.0 = Release DLL|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Static.ActiveCfg = Release Static|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Static.Build.0 = Release Static|Any CPU
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onMixedLanguage_withPlatforms_noArchs()
|
||||
platforms { "DLL", "Static" }
|
||||
|
||||
project "MyProject1"
|
||||
language "C#"
|
||||
uuid "52AD9329-0D74-4F66-A213-E649D8CCD737"
|
||||
|
||||
project "MyProject2"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|DLL = Debug|DLL
|
||||
Debug|Static = Debug|Static
|
||||
Release|DLL = Release|DLL
|
||||
Release|Static = Release|Static
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Debug|DLL.ActiveCfg = Debug DLL|Any CPU
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Debug|DLL.Build.0 = Debug DLL|Any CPU
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Debug|Static.ActiveCfg = Debug Static|Any CPU
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Debug|Static.Build.0 = Debug Static|Any CPU
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Release|DLL.ActiveCfg = Release DLL|Any CPU
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Release|DLL.Build.0 = Release DLL|Any CPU
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Release|Static.ActiveCfg = Release Static|Any CPU
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Release|Static.Build.0 = Release Static|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL.ActiveCfg = Debug DLL|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL.Build.0 = Debug DLL|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Static.ActiveCfg = Debug Static|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Static.Build.0 = Debug Static|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL.ActiveCfg = Release DLL|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL.Build.0 = Release DLL|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Static.ActiveCfg = Release Static|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Static.Build.0 = Release Static|Win32
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If the projects contained by the solution specify a consistent
|
||||
-- architecture, bubble that up.
|
||||
--
|
||||
|
||||
function suite.onSingleCpp_noPlatforms_singleArch()
|
||||
project "MyProject"
|
||||
architecture "x86_64"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|x64.Build.0 = Debug|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|x64.ActiveCfg = Release|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onSingleCs_noPlatforms_singleArch()
|
||||
project "MyProject"
|
||||
architecture "x86_64"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|x64.Build.0 = Debug|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|x64.ActiveCfg = Release|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onMixedLanguage_noPlatforms_singleArch()
|
||||
architecture "x86_64"
|
||||
|
||||
project "MyProject1"
|
||||
language "C#"
|
||||
uuid "52AD9329-0D74-4F66-A213-E649D8CCD737"
|
||||
|
||||
project "MyProject2"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Debug|x64.Build.0 = Debug|x64
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Release|x64.ActiveCfg = Release|x64
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Release|x64.Build.0 = Release|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|x64.Build.0 = Debug|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|x64.ActiveCfg = Release|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If the projects contain a mix of architectures, handle that.
|
||||
--
|
||||
|
||||
function suite.onMixedLanguage_noPlatforms_multipleArch()
|
||||
project "MyProject1"
|
||||
language "C#"
|
||||
uuid "52AD9329-0D74-4F66-A213-E649D8CCD737"
|
||||
|
||||
project "MyProject2"
|
||||
architecture "x86_64"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Mixed Platforms = Debug|Mixed Platforms
|
||||
Release|Mixed Platforms = Release|Mixed Platforms
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Mixed Platforms.Build.0 = Debug|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Mixed Platforms.ActiveCfg = Release|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Mixed Platforms.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Use the right variant for 32-bit architectures.
|
||||
--
|
||||
|
||||
function suite.onSingleCpp_noPlatforms_x86()
|
||||
architecture "x86"
|
||||
project "MyProject"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onSingleCs_noPlatforms_x86()
|
||||
architecture "x86"
|
||||
project "MyProject"
|
||||
language "C#"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|x86.Build.0 = Debug|x86
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|x86.ActiveCfg = Release|x86
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onMixedLanguage_noPlatforms_x86()
|
||||
architecture "x86"
|
||||
|
||||
project "MyProject1"
|
||||
language "C#"
|
||||
uuid "52AD9329-0D74-4F66-A213-E649D8CCD737"
|
||||
|
||||
project "MyProject2"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Debug|x86.Build.0 = Debug|x86
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Release|x86.ActiveCfg = Release|x86
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Release|x86.Build.0 = Release|x86
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|x86.Build.0 = Debug|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|x86.ActiveCfg = Release|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If both platforms and architectures are used, break it all out correctly.
|
||||
--
|
||||
|
||||
function suite.onSingleCpp_withPlatforms_withArchs()
|
||||
platforms { "DLL32", "DLL64" }
|
||||
filter "platforms:DLL32"
|
||||
architecture "x86"
|
||||
filter "platforms:DLL64"
|
||||
architecture "x86_64"
|
||||
|
||||
project "MyProject"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|DLL32 = Debug|DLL32
|
||||
Debug|DLL64 = Debug|DLL64
|
||||
Release|DLL32 = Release|DLL32
|
||||
Release|DLL64 = Release|DLL64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL32.ActiveCfg = Debug DLL32|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL32.Build.0 = Debug DLL32|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL64.ActiveCfg = Debug DLL64|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL64.Build.0 = Debug DLL64|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL32.ActiveCfg = Release DLL32|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL32.Build.0 = Release DLL32|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL64.ActiveCfg = Release DLL64|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL64.Build.0 = Release DLL64|x64
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onSingleCs_withPlatforms_withArchs()
|
||||
platforms { "DLL32", "DLL64" }
|
||||
filter "platforms:DLL32"
|
||||
architecture "x86"
|
||||
filter "platforms:DLL64"
|
||||
architecture "x86_64"
|
||||
|
||||
project "MyProject"
|
||||
language "C#"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|DLL32 = Debug|DLL32
|
||||
Debug|DLL64 = Debug|DLL64
|
||||
Release|DLL32 = Release|DLL32
|
||||
Release|DLL64 = Release|DLL64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL32.ActiveCfg = Debug DLL32|x86
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL32.Build.0 = Debug DLL32|x86
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL64.ActiveCfg = Debug DLL64|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL64.Build.0 = Debug DLL64|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL32.ActiveCfg = Release DLL32|x86
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL32.Build.0 = Release DLL32|x86
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL64.ActiveCfg = Release DLL64|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL64.Build.0 = Release DLL64|x64
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onMixedLanguage_withPlatforms_withArchs()
|
||||
platforms { "DLL32", "DLL64" }
|
||||
filter "platforms:DLL32"
|
||||
architecture "x86"
|
||||
filter "platforms:DLL64"
|
||||
architecture "x86_64"
|
||||
|
||||
project "MyProject1"
|
||||
language "C#"
|
||||
uuid "52AD9329-0D74-4F66-A213-E649D8CCD737"
|
||||
|
||||
project "MyProject2"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|DLL32 = Debug|DLL32
|
||||
Debug|DLL64 = Debug|DLL64
|
||||
Release|DLL32 = Release|DLL32
|
||||
Release|DLL64 = Release|DLL64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Debug|DLL32.ActiveCfg = Debug DLL32|x86
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Debug|DLL32.Build.0 = Debug DLL32|x86
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Debug|DLL64.ActiveCfg = Debug DLL64|x64
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Debug|DLL64.Build.0 = Debug DLL64|x64
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Release|DLL32.ActiveCfg = Release DLL32|x86
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Release|DLL32.Build.0 = Release DLL32|x86
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Release|DLL64.ActiveCfg = Release DLL64|x64
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Release|DLL64.Build.0 = Release DLL64|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL32.ActiveCfg = Debug DLL32|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL32.Build.0 = Debug DLL32|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL64.ActiveCfg = Debug DLL64|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL64.Build.0 = Debug DLL64|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL32.ActiveCfg = Release DLL32|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL32.Build.0 = Release DLL32|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL64.ActiveCfg = Release DLL64|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL64.Build.0 = Release DLL64|x64
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.onSingleCs_withPlatformsMatchingArch_noArchs()
|
||||
platforms { "x86", "x86_64" }
|
||||
project "MyProject"
|
||||
language "C#"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|x64.Build.0 = Debug|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|x86.Build.0 = Debug|x86
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|x64.ActiveCfg = Release|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|x64.Build.0 = Release|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|x86.ActiveCfg = Release|x86
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onMixedLanguage_withPlatformsMatchingArch_noArchs()
|
||||
platforms { "x86", "x86_64" }
|
||||
project "MyProject1"
|
||||
language "C#"
|
||||
uuid "52AD9329-0D74-4F66-A213-E649D8CCD737"
|
||||
|
||||
project "MyProject2"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Debug|x64.Build.0 = Debug|x64
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Debug|x86.Build.0 = Debug|x86
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Release|x64.ActiveCfg = Release|x64
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Release|x64.Build.0 = Release|x64
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Release|x86.ActiveCfg = Release|x86
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Release|x86.Build.0 = Release|x86
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|x64.Build.0 = Debug|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|x86.Build.0 = Debug|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|x64.ActiveCfg = Release|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|x64.Build.0 = Release|x64
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|x86.ActiveCfg = Release|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the handling of the "Any CPU" .NET architecture.
|
||||
--
|
||||
|
||||
function suite.onSingleCpp_withAnyCpuPlatform()
|
||||
platforms { "Any CPU" }
|
||||
project "MyProject"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Any CPU.ActiveCfg = Debug Any CPU|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Any CPU.Build.0 = Debug Any CPU|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Any CPU.ActiveCfg = Release Any CPU|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Any CPU.Build.0 = Release Any CPU|Win32
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onSingleCs_withAnyCpuPlatform()
|
||||
platforms { "Any CPU" }
|
||||
project "MyProject"
|
||||
language "C#"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onMixedLanguage_withAnyCpuPlatform()
|
||||
platforms { "Any CPU" }
|
||||
project "MyProject1"
|
||||
language "C#"
|
||||
uuid "52AD9329-0D74-4F66-A213-E649D8CCD737"
|
||||
|
||||
project "MyProject2"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{52AD9329-0D74-4F66-A213-E649D8CCD737}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Any CPU.ActiveCfg = Debug Any CPU|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Any CPU.Build.0 = Debug Any CPU|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Any CPU.ActiveCfg = Release Any CPU|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Any CPU.Build.0 = Release Any CPU|Win32
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Check the sort order of the configurations.
|
||||
---
|
||||
|
||||
function suite.sortsByBuildCfgAndPlatform()
|
||||
platforms { "Windows", "Linux" }
|
||||
project "MyProject"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Linux = Debug|Linux
|
||||
Debug|Windows = Debug|Windows
|
||||
Release|Linux = Release|Linux
|
||||
Release|Windows = Release|Windows
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Linux.ActiveCfg = Debug Linux|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Linux.Build.0 = Debug Linux|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Windows.ActiveCfg = Debug Windows|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Windows.Build.0 = Debug Windows|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Linux.ActiveCfg = Release Linux|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Linux.Build.0 = Release Linux|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Windows.ActiveCfg = Release Windows|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Windows.Build.0 = Release Windows|Win32
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Configurations with a kind of "None" should be excluded from the build.
|
||||
---
|
||||
|
||||
function suite.excludesFromBuild_onNone()
|
||||
project "MyProject"
|
||||
kind "None"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Win32.ActiveCfg = Release|Win32
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Excluded configurations should write an ActiveCfg entry, pointing to some
|
||||
-- arbitrary project configuration, and skip the Build.0 entry. Try to match
|
||||
-- the available project configurations as closely as possible.
|
||||
---
|
||||
|
||||
function suite.onExcludedBuildCfg()
|
||||
platforms { "DLL", "Static" }
|
||||
project "MyProject"
|
||||
removeconfigurations { "Debug" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|DLL = Debug|DLL
|
||||
Debug|Static = Debug|Static
|
||||
Release|DLL = Release|DLL
|
||||
Release|Static = Release|Static
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL.ActiveCfg = Release DLL|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Static.ActiveCfg = Release Static|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL.ActiveCfg = Release DLL|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL.Build.0 = Release DLL|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Static.ActiveCfg = Release Static|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Static.Build.0 = Release Static|Win32
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.onBuildCfgExcludedByFlag()
|
||||
platforms { "DLL", "Static" }
|
||||
project "MyProject"
|
||||
filter "configurations:Debug"
|
||||
flags "ExcludeFromBuild"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|DLL = Debug|DLL
|
||||
Debug|Static = Debug|Static
|
||||
Release|DLL = Release|DLL
|
||||
Release|Static = Release|Static
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL.ActiveCfg = Debug DLL|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Static.ActiveCfg = Debug Static|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL.ActiveCfg = Release DLL|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL.Build.0 = Release DLL|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Static.ActiveCfg = Release Static|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Static.Build.0 = Release Static|Win32
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.onExcludedPlatform()
|
||||
platforms { "DLL", "Static" }
|
||||
project "MyProject"
|
||||
removeplatforms { "Static" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|DLL = Debug|DLL
|
||||
Debug|Static = Debug|Static
|
||||
Release|DLL = Release|DLL
|
||||
Release|Static = Release|Static
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL.ActiveCfg = Debug DLL|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL.Build.0 = Debug DLL|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Static.ActiveCfg = Debug DLL|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL.ActiveCfg = Release DLL|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL.Build.0 = Release DLL|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Static.ActiveCfg = Release DLL|Win32
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.onPlatformExcludedByFlag()
|
||||
platforms { "DLL", "Static" }
|
||||
project "MyProject"
|
||||
filter "platforms:Static"
|
||||
flags "ExcludeFromBuild"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|DLL = Debug|DLL
|
||||
Debug|Static = Debug|Static
|
||||
Release|DLL = Release|DLL
|
||||
Release|Static = Release|Static
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL.ActiveCfg = Debug DLL|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|DLL.Build.0 = Debug DLL|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Static.ActiveCfg = Debug Static|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL.ActiveCfg = Release DLL|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|DLL.Build.0 = Release DLL|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Static.ActiveCfg = Release Static|Win32
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onExcludedBuildCfg_noPlatforms()
|
||||
project "MyProject"
|
||||
removeconfigurations { "Debug" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Win32.ActiveCfg = Release|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Check that when a default platform is specified it is written in a separate
|
||||
-- configuration block so that Visual Studio picks it up as default.
|
||||
---
|
||||
|
||||
function suite.onDefaultPlatforms()
|
||||
platforms { "x86", "x86_64" }
|
||||
defaultplatform "x86_64"
|
||||
project "MyProject"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
---
|
||||
-- Check that when a shared items project is specified that no entries are added
|
||||
-- to the project configuration platforms
|
||||
---
|
||||
|
||||
function suite.onSharedItemsProject()
|
||||
p.action.set("vs2013")
|
||||
project "MyProject"
|
||||
kind "SharedItems"
|
||||
prepare()
|
||||
test.capture [[
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,198 @@
|
||||
--
|
||||
-- tests/actions/vstudio/sln2005/test_projects.lua
|
||||
-- Validate generation of Visual Studio 2005+ solution project entries.
|
||||
-- Copyright (c) 2009-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_sln2005_projects")
|
||||
local sln2005 = p.vstudio.sln2005
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2005")
|
||||
p.escaper(p.vstudio.vs2005.esc)
|
||||
wks = workspace("MyWorkspace")
|
||||
configurations { "Debug", "Release" }
|
||||
language "C++"
|
||||
kind "ConsoleApp"
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
sln2005.reorderProjects(wks)
|
||||
sln2005.projects(wks)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the format of a C/C++ project entry
|
||||
--
|
||||
|
||||
function suite.structureIsOkay_onCpp()
|
||||
project "MyProject"
|
||||
prepare()
|
||||
test.capture [[
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyProject", "MyProject.vcproj", "{42B5DBC6-AE1F-903D-F75D-41E363076E92}"
|
||||
EndProject
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the format of a VS2005/V2008 C# project entry
|
||||
--
|
||||
|
||||
function suite.structureIsOkay_onCSharp()
|
||||
project "MyProject"
|
||||
language "C#"
|
||||
prepare()
|
||||
test.capture [[
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyProject", "MyProject.csproj", "{42B5DBC6-AE1F-903D-F75D-41E363076E92}"
|
||||
EndProject
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Project names should be XML escaped.
|
||||
--
|
||||
|
||||
function suite.projectNamesAreEscaped()
|
||||
project 'My "x64" Project'
|
||||
filename 'My "x64" Project'
|
||||
prepare()
|
||||
test.capture [[
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "My "x64" Project", "My "x64" Project.vcproj", "{48E4ED8F-34DD-0CE2-5D0F-F2664967ECED}"
|
||||
EndProject
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the structure of a top-level group entry.
|
||||
--
|
||||
|
||||
function suite.onSingleTopLevelGroup()
|
||||
group "Alpha"
|
||||
project "MyProject"
|
||||
prepare()
|
||||
test.capture [[
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Alpha", "Alpha", "{D2C41116-3E7A-8A0B-C76E-84E23323810F}"
|
||||
EndProject
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Nested groups should be listed individually.
|
||||
--
|
||||
|
||||
function suite.OnNestedGroups()
|
||||
group "Alpha/Beta"
|
||||
project "MyProject"
|
||||
prepare()
|
||||
test.capture [[
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Alpha", "Alpha", "{D2C41116-3E7A-8A0B-C76E-84E23323810F}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Beta", "Beta", "{BD0520A9-A9FE-3EFB-D230-2480BE881E07}"
|
||||
EndProject
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a startup project is specified, it should appear first in the list.
|
||||
--
|
||||
|
||||
function suite.startupProjectFirst_onNoGroups()
|
||||
startproject "MyProject2"
|
||||
project "MyProject1"
|
||||
project "MyProject2"
|
||||
project "MyProject3"
|
||||
prepare()
|
||||
test.capture [[
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyProject2", "MyProject2.vcproj", "{B45D52A2-A015-94EF-091D-6D4BF5F32EE0}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyProject1", "MyProject1.vcproj", "{B35D52A2-9F15-94EF-081D-6D4BF4F32EE0}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyProject3", "MyProject3.vcproj", "{B55D52A2-A115-94EF-0A1D-6D4BF6F32EE0}"
|
||||
EndProject
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If the startup project is contained by a group, that group (and any parent
|
||||
-- groups) should appear first in the list.
|
||||
--
|
||||
|
||||
function suite.startupProjectFirst_onSingleGroup()
|
||||
startproject "MyProject2"
|
||||
project "MyProject1"
|
||||
group "Zed"
|
||||
project "MyProject2"
|
||||
group "Beta"
|
||||
project "MyProject3"
|
||||
prepare()
|
||||
test.capture [[
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Zed", "Zed", "{2FCAF67E-9B34-ABF5-E472-5C9B501C894A}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyProject2", "MyProject2.vcproj", "{B45D52A2-A015-94EF-091D-6D4BF5F32EE0}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Beta", "Beta", "{68E9C25D-54A1-04AB-BDA8-DD06A97F9F9B}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyProject3", "MyProject3.vcproj", "{B55D52A2-A115-94EF-0A1D-6D4BF6F32EE0}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyProject1", "MyProject1.vcproj", "{B35D52A2-9F15-94EF-081D-6D4BF4F32EE0}"
|
||||
EndProject
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.startupProjectFirst_onMultipleGroups()
|
||||
startproject "MyProject2"
|
||||
project "MyProject1"
|
||||
group "Zed"
|
||||
project "MyProject3"
|
||||
group "Alpha/Beta"
|
||||
project "MyProject2"
|
||||
prepare()
|
||||
test.capture [[
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Alpha", "Alpha", "{D2C41116-3E7A-8A0B-C76E-84E23323810F}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Beta", "Beta", "{BD0520A9-A9FE-3EFB-D230-2480BE881E07}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyProject2", "MyProject2.vcproj", "{B45D52A2-A015-94EF-091D-6D4BF5F32EE0}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyProject1", "MyProject1.vcproj", "{B35D52A2-9F15-94EF-081D-6D4BF4F32EE0}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Zed", "Zed", "{2FCAF67E-9B34-ABF5-E472-5C9B501C894A}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyProject3", "MyProject3.vcproj", "{B55D52A2-A115-94EF-0A1D-6D4BF6F32EE0}"
|
||||
EndProject
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Environment variables in the form of $(...) need to be translated
|
||||
-- to old school %...% DOS style.
|
||||
--
|
||||
|
||||
function suite.translatesEnvironmentVars()
|
||||
externalproject "MyProject"
|
||||
location "$(SDK_LOCATION)/MyProject"
|
||||
uuid "30A1B994-C2C6-485F-911B-FB4674366DA8"
|
||||
kind "SharedLib"
|
||||
prepare()
|
||||
test.capture [[
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyProject", "%SDK_LOCATION%\MyProject\MyProject.vcproj", "{30A1B994-C2C6-485F-911B-FB4674366DA8}"
|
||||
EndProject
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,54 @@
|
||||
--
|
||||
-- tests/actions/vstudio/sln2005/test_sections.lua
|
||||
-- Validate generation of Visual Studio 2005+ solution section entries.
|
||||
-- Copyright (c) 2009-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_sln2005_sections")
|
||||
local sln2005 = p.vstudio.sln2005
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks
|
||||
|
||||
function suite.setup()
|
||||
_MAIN_SCRIPT = "c:\\test\\premake5.lua"
|
||||
|
||||
p.escaper(p.vstudio.vs2005.esc)
|
||||
wks = workspace("MyWorkspace")
|
||||
wks.location = "c:\\test\\build"
|
||||
|
||||
configurations { "Debug", "Release" }
|
||||
language "C++"
|
||||
kind "ConsoleApp"
|
||||
end
|
||||
|
||||
--
|
||||
-- Test the editorintegration switch.
|
||||
--
|
||||
function suite.extensibilityGlobalsOn()
|
||||
editorintegration "On"
|
||||
|
||||
project "MyProject"
|
||||
sln2005.extensibilityGlobals(wks)
|
||||
|
||||
test.capture [[
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.extensibilityGlobalsOff()
|
||||
editorintegration "Off"
|
||||
|
||||
project "MyProject"
|
||||
sln2005.extensibilityGlobals(wks)
|
||||
|
||||
local res = p.captured()
|
||||
if (#res > 0) then
|
||||
test.fail("no editorintegration output was expected");
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,72 @@
|
||||
--
|
||||
-- tests/actions/vstudio/sln2005/test_shared_projects.lua
|
||||
-- Validate generation of Visual Studio 2005+ SharedMSBuildProjectFiles entries.
|
||||
-- Copyright (c) Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_sln2005_shared_projects")
|
||||
local sln2005 = p.vstudio.sln2005
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2013")
|
||||
p.escaper(p.vstudio.vs2005.esc)
|
||||
wks = workspace("MyWorkspace")
|
||||
configurations { "Debug", "Release" }
|
||||
language "C++"
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
sln2005.reorderProjects(wks)
|
||||
sln2005.sharedProjects(wks)
|
||||
end
|
||||
|
||||
--
|
||||
-- Test the shared projects listing
|
||||
--
|
||||
|
||||
function suite.noSharedProjects()
|
||||
project "MyProject"
|
||||
kind "ConsoleApp"
|
||||
prepare()
|
||||
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
function suite.onSharedProjects()
|
||||
project "MyProject"
|
||||
kind "SharedItems"
|
||||
prepare()
|
||||
|
||||
test.capture [[
|
||||
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
||||
MyProject.vcxitems*{42b5dbc6-ae1f-903d-f75d-41e363076e92}*SharedItemsImports = 9
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.onLinkedSharedProjects()
|
||||
project "MyProject"
|
||||
kind "SharedItems"
|
||||
|
||||
project "MyProject2"
|
||||
kind "ConsoleApp"
|
||||
links { "MyProject" }
|
||||
prepare()
|
||||
|
||||
test.capture [[
|
||||
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
||||
MyProject.vcxitems*{42b5dbc6-ae1f-903d-f75d-41e363076e92}*SharedItemsImports = 9
|
||||
MyProject.vcxitems*{b45d52a2-a015-94ef-091d-6d4bf5f32ee0}*SharedItemsImports = 4
|
||||
EndGlobalSection
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,86 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc200x/test_assembly_refs.lua
|
||||
-- Validate managed assembly references in Visual Studio 2010 C/C++ projects.
|
||||
-- Copyright (c) 2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs200x_assembly_refs")
|
||||
local vc200x = p.vstudio.vc200x
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2005")
|
||||
wks = test.createWorkspace()
|
||||
clr "On"
|
||||
end
|
||||
|
||||
local function prepare(platform)
|
||||
prj = test.getproject(wks, 1)
|
||||
vc200x.assemblyReferences(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If there are no managed assemblies listed in links, output nothing.
|
||||
--
|
||||
|
||||
function suite.noOutput_onNoAssemblies()
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- To distinguish between managed and unmanaged libraries, the ".dll"
|
||||
-- extension must be explicitly supplied.
|
||||
--
|
||||
|
||||
function suite.listsAssemblies()
|
||||
links { "System.dll", "System.Data.dll" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<AssemblyReference
|
||||
RelativePath="System.dll"
|
||||
/>
|
||||
<AssemblyReference
|
||||
RelativePath="System.Data.dll"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Any unmanaged libraries included in the list should be ignored.
|
||||
--
|
||||
|
||||
function suite.ignoresUnmanagedLibraries()
|
||||
links { "m", "System.dll" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<AssemblyReference
|
||||
RelativePath="System.dll"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Local (non-system) assemblies can be referenced with a relative path.
|
||||
--
|
||||
|
||||
function suite.canReferenceLocalAssembly()
|
||||
links { "../nunit.framework.dll" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<AssemblyReference
|
||||
RelativePath="..\nunit.framework.dll"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,76 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc200x/test_build_steps.lua
|
||||
-- Test generation of custom build step elements.
|
||||
-- Copyright (c) 2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs200x_build_steps")
|
||||
local vc200x = p.vstudio.vc200x
|
||||
|
||||
|
||||
--
|
||||
-- Setup/teardown
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2005")
|
||||
p.escaper(p.vstudio.vs2005.esc)
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
vc200x.VCPreBuildEventTool(cfg)
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Should output empty element wrapper on no build steps.
|
||||
---
|
||||
|
||||
function suite.noCommandLine_onNoBuildSteps()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Should insert CR-LF at end of each command line.
|
||||
---
|
||||
|
||||
function suite.addsCRLF()
|
||||
prebuildcommands { "command_1", "command_2" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
CommandLine="command_1
command_2"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- If a message is specified, it should be included.
|
||||
--
|
||||
|
||||
function suite.onMessageProvided()
|
||||
prebuildcommands { "command1" }
|
||||
prebuildmessage "Pre-building..."
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
Description="Pre-building..."
|
||||
CommandLine="command1"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,676 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc200x/test_compiler_block.lua
|
||||
-- Validate generation the VCCLCompiler element in Visual Studio 200x C/C++ projects.
|
||||
-- Copyright (c) 2011-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs200x_compiler_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.VCCLCompilerTool(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the basic structure of the compiler block with no flags or settings.
|
||||
--
|
||||
|
||||
function suite.looksGood_onDefaultSettings()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If include directories are specified, the <AdditionalIncludeDirectories> should be added.
|
||||
--
|
||||
|
||||
|
||||
function suite.additionalIncludeDirs_onIncludeDirs()
|
||||
includedirs { "include/lua", "include/zlib" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="include\lua;include\zlib"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Ensure macros are not truncated (see issue #63)
|
||||
--
|
||||
|
||||
|
||||
function suite.additionalIncludeDirs_onIncludeDirs_with_vs_macros()
|
||||
includedirs { "$(Macro1)/foo/bar/$(Macro2)/baz" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="$(Macro1)\foo\bar\$(Macro2)\baz"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the handling of the Symbols flag. The format must be set, and the
|
||||
-- debug runtime library must be selected.
|
||||
--
|
||||
|
||||
function suite.looksGood_onSymbolsFlag()
|
||||
symbols "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the handling of the Symbols in conjunction with the Optimize flag.
|
||||
-- The release runtime library must be used.
|
||||
--
|
||||
|
||||
function suite.looksGood_onSymbolsAndOptimizeFlags()
|
||||
symbols "On"
|
||||
optimize "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the handling of the C7 debug information format.
|
||||
--
|
||||
|
||||
function suite.looksGood_onC7DebugFormat()
|
||||
symbols "On"
|
||||
debugformat "C7"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="1"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Test precompiled header handling; the header should be treated as
|
||||
-- a plain string value, with no path manipulation applied, since it
|
||||
-- needs to match the value of the #include statement used in the
|
||||
-- project code.
|
||||
---
|
||||
|
||||
function suite.compilerBlock_OnPCH()
|
||||
location "build"
|
||||
pchheader "include/common.h"
|
||||
pchsource "source/common.cpp"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderThrough="include/common.h"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Floating point flag tests
|
||||
--
|
||||
|
||||
function suite.compilerBlock_OnFpFast()
|
||||
floatingpoint "Fast"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
FloatingPointModel="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.compilerBlock_OnFpStrict()
|
||||
floatingpoint "Strict"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
FloatingPointModel="1"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check that the "minimal rebuild" flag is applied correctly.
|
||||
--
|
||||
|
||||
function suite.minimalRebuildFlagsSet_onMinimalRebuildAndSymbols()
|
||||
flags { "NoMinimalRebuild" }
|
||||
symbols "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check that the "no buffer security check" flag is applied correctly.
|
||||
--
|
||||
|
||||
function suite.noBufferSecurityFlagSet_onBufferSecurityCheck()
|
||||
flags { "NoBufferSecurityCheck" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
BasicRuntimeChecks="3"
|
||||
BufferSecurityCheck="false"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check that the CompileAs value is set correctly for C language projects.
|
||||
--
|
||||
|
||||
function suite.compileAsSet_onC()
|
||||
language "C"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="0"
|
||||
CompileAs="1"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the correct runtime library is used when symbols are enabled.
|
||||
--
|
||||
|
||||
function suite.runtimeLibraryIsDebug_onSymbolsNoOptimize()
|
||||
symbols "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the correct warnings settings are used when extra warnings are enabled.
|
||||
--
|
||||
|
||||
function suite.runtimeLibraryIsDebug_onExtraWarnings()
|
||||
warnings "Extra"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.runtimeLibraryIsDebug_onHighWarnings()
|
||||
warnings "High"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the correct warnings settings are used when FatalWarnings are enabled.
|
||||
--
|
||||
|
||||
function suite.runtimeLibraryIsDebug_onFatalWarnings()
|
||||
flags { "FatalWarnings" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the correct warnings settings are used when no warnings are enabled.
|
||||
--
|
||||
|
||||
function suite.runtimeLibraryIsDebug_onNoWarnings_whichDisablesAllOtherWarningsFlags()
|
||||
flags { "FatalWarnings" }
|
||||
warnings "Off"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="0"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the correct Detect64BitPortabilityProblems settings are used when _ACTION < "VS2008".
|
||||
--
|
||||
|
||||
function suite._64BitPortabilityOn_onVS2005()
|
||||
p.action.set("vs2005")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite._64BitPortabilityOff_onVS2005_andCLR()
|
||||
p.action.set("vs2005")
|
||||
clr "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the correct warnings settings are used when no warnings are enabled.
|
||||
--
|
||||
|
||||
function suite.runtimeLibraryIsDebug_onVS2005_NoWarnings()
|
||||
p.action.set("vs2005")
|
||||
warnings "Off"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="0"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check handling of forced includes.
|
||||
--
|
||||
|
||||
function suite.forcedIncludeFiles()
|
||||
forceincludes { "stdafx.h", "include/sys.h" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="0"
|
||||
ForcedIncludeFiles="stdafx.h;include\sys.h"
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.forcedUsingFiles()
|
||||
forceusings { "stdafx.h", "include/sys.h" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="0"
|
||||
ForcedUsingFiles="stdafx.h;include\sys.h"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify handling of the NoRuntimeChecks flag.
|
||||
--
|
||||
|
||||
function suite.onNoRuntimeChecks()
|
||||
flags { "NoRuntimeChecks" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
RuntimeLibrary="2"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of the EnableMultiProcessorCompile flag.
|
||||
--
|
||||
|
||||
function suite.onMultiProcessorCompile()
|
||||
flags { "MultiProcessorCompile" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/MP"
|
||||
Optimization="0"
|
||||
BasicRuntimeChecks="3"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of the runtime API; should override the
|
||||
-- default behavior of linking the debug runtime when symbols are
|
||||
-- enabled with no optimizations.
|
||||
--
|
||||
|
||||
function suite.releaseRuntime_onFlag()
|
||||
runtime "Release"
|
||||
symbols "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="2"
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.releaseRuntime_onStaticAndReleaseRuntime()
|
||||
runtime "Release"
|
||||
staticruntime "On"
|
||||
symbols "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="0"
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check the LinkTimeOptimization flag.
|
||||
--
|
||||
|
||||
function suite.flags_onLinkTimeOptimization()
|
||||
flags { "LinkTimeOptimization" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
WholeProgramOptimization="true"
|
||||
]]
|
||||
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the optimization flags.
|
||||
--
|
||||
|
||||
function suite.optimization_onOptimize()
|
||||
optimize "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
StringPooling="true"
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.optimization_onOptimizeSize()
|
||||
optimize "Size"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="1"
|
||||
StringPooling="true"
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.optimization_onOptimizeSpeed()
|
||||
optimize "Speed"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
StringPooling="true"
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.optimization_onOptimizeFull()
|
||||
optimize "Full"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
StringPooling="true"
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.optimization_onOptimizeOff()
|
||||
optimize "Off"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
BasicRuntimeChecks="3"
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.optimization_onOptimizeDebug()
|
||||
optimize "Debug"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
BasicRuntimeChecks="3"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of the OmitDefaultLibrary flag.
|
||||
--
|
||||
|
||||
function suite.onOmitDefaultLibrary()
|
||||
flags { "OmitDefaultLibrary" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="0"
|
||||
OmitDefaultLibName="true"
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +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
|
||||
@@ -0,0 +1,137 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc200x/test_debugdir.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_vs200x_debugdir")
|
||||
local vc200x = p.vstudio.vc200x
|
||||
local project = p.project
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2005")
|
||||
p.escaper(p.vstudio.vs2005.esc)
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
vc200x.debugSettings(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If no debug settings are specified, an empty block should be generated.
|
||||
--
|
||||
|
||||
function suite.emptyBlock_onNoSettings()
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a debug command is provided, it should be specified relative to
|
||||
-- the project.
|
||||
--
|
||||
|
||||
function suite.debugCommand_onRelativePath()
|
||||
location "build"
|
||||
debugcommand "bin/emulator.exe"
|
||||
prepare()
|
||||
test.capture [[
|
||||
Command="..\bin\emulator.exe"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a working directory is provided, it should be specified relative to
|
||||
-- the project.
|
||||
--
|
||||
|
||||
function suite.workingDir_onRelativePath()
|
||||
location "build"
|
||||
debugdir "bin/debug"
|
||||
prepare()
|
||||
test.capture [[
|
||||
WorkingDirectory="..\bin\debug"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Make sure debug arguments are being written.
|
||||
--
|
||||
|
||||
function suite.commandArguments_onDebugArgs()
|
||||
debugargs { "arg1", "arg2" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
CommandArguments="arg1 arg2"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Make sure environment variables are being written.
|
||||
--
|
||||
|
||||
function suite.environmentVarsSet_onDebugEnvs()
|
||||
debugenvs { "key=value" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
Environment="key=value"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Make sure quotes around environment variables are properly escaped.
|
||||
--
|
||||
|
||||
function suite.environmentVarsEscaped_onQuotes()
|
||||
debugenvs { 'key="value"' }
|
||||
prepare()
|
||||
test.capture [[
|
||||
Environment="key="value""
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If multiple environment variables are specified, make sure they get
|
||||
-- separated properly.
|
||||
--
|
||||
|
||||
function suite.environmentVars_onMultipleValues()
|
||||
debugenvs { "key=value", "foo=bar" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
Environment="key=value
foo=bar"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Make sure that environment merging is turned off if the build
|
||||
-- flag is set.
|
||||
--
|
||||
|
||||
function suite.environmentVarsSet_onDebugEnvsAndDebugEnvsDontMerge()
|
||||
debugenvs { "key=value" }
|
||||
flags { "DebugEnvsDontMerge" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
Environment="key=value"
|
||||
EnvironmentMerge="false"
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,75 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc200x/test_excluded_configs.lua
|
||||
-- Check handling of configurations which have been excluded from the build.
|
||||
-- Copyright (c) 2012-2014 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs200x_excluded_configs")
|
||||
local vc200x = p.vstudio.vc200x
|
||||
local config = p.config
|
||||
|
||||
--
|
||||
-- Setup/teardown
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2008")
|
||||
|
||||
wks = workspace("MyWorkspace")
|
||||
configurations { "Debug", "Release" }
|
||||
platforms { "Zeus", "Ares" }
|
||||
language "C++"
|
||||
|
||||
prj = project("MyProject")
|
||||
kind "ConsoleApp"
|
||||
links { "MyProject2", "MyProject3" }
|
||||
|
||||
project("MyProject2")
|
||||
kind "StaticLib"
|
||||
|
||||
project("MyProject3")
|
||||
kind "StaticLib"
|
||||
removeplatforms { "Ares" }
|
||||
end
|
||||
|
||||
local function prepare(platform)
|
||||
local cfg = test.getconfig(prj, "Debug", platform)
|
||||
vc200x.VCLinkerTool(cfg, config.toolset(cfg))
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- If a sibling is included in one configuration and excluded from
|
||||
-- another, the included configuration should link as normal.
|
||||
--
|
||||
|
||||
function suite.normalLink_onIncludedConfig()
|
||||
prepare("Zeus")
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/NOLOGO"
|
||||
OutputFile="$(OutDir)\MyProject.exe"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a sibling is included in one configuration and excluded from
|
||||
-- another, the excluded configuration should force explicit linking
|
||||
-- and not list the excluded library.
|
||||
--
|
||||
|
||||
function suite.explicitLink_onExcludedConfig()
|
||||
prepare("Ares")
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/NOLOGO"
|
||||
AdditionalDependencies="bin\Ares\Debug\MyProject2.lib"
|
||||
]]
|
||||
end
|
||||
844
Src/external_dependencies/openmpt-trunk/include/premake/modules/vstudio/tests/vc200x/test_files.lua
vendored
Normal file
844
Src/external_dependencies/openmpt-trunk/include/premake/modules/vstudio/tests/vc200x/test_files.lua
vendored
Normal file
@@ -0,0 +1,844 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc200x/test_files.lua
|
||||
-- Validate generation of <files/> block in Visual Studio 200x projects.
|
||||
-- Copyright (c) 2009-2014 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs200x_files")
|
||||
local vc200x = p.vstudio.vc200x
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2008")
|
||||
p.escaper(p.vstudio.vs2005.esc)
|
||||
wks = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
prj = test.getproject(wks, 1)
|
||||
vc200x.files(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the structure of an individual file element.
|
||||
--
|
||||
|
||||
function suite.file_onDefaults()
|
||||
files { "hello.cpp" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="hello.cpp"
|
||||
>
|
||||
</File>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the structure of a file contained in a folder.
|
||||
--
|
||||
|
||||
function suite.file_onSingleLevelFolder()
|
||||
files { "src/hello.cpp", "so_long.cpp" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<Filter
|
||||
Name="src"
|
||||
>
|
||||
<File
|
||||
RelativePath="src\hello.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath="so_long.cpp"
|
||||
>
|
||||
</File>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the structure of a file contained in multiple folders.
|
||||
--
|
||||
|
||||
function suite.file_onMultipleFolderLevels()
|
||||
files { "src/greetings/hello.cpp", "so_long.cpp" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<Filter
|
||||
Name="src"
|
||||
>
|
||||
<Filter
|
||||
Name="greetings"
|
||||
>
|
||||
<File
|
||||
RelativePath="src\greetings\hello.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath="so_long.cpp"
|
||||
>
|
||||
</File>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the structure of a file with a virtual path.
|
||||
--
|
||||
|
||||
function suite.file_onVpath()
|
||||
files { "src/hello.cpp", "so_long.h" }
|
||||
vpaths { ["Source Files"] = "**.cpp" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath="src\hello.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Make sure that the special "build a C code" logic only gets triggered
|
||||
-- by actual C source code files.
|
||||
--
|
||||
|
||||
function suite.file_markedAsNonBuildable_onSupportFiles()
|
||||
language "C"
|
||||
files { "hello.lua" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="hello.lua"
|
||||
>
|
||||
</File>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- When a C code file is listed in a C++ project, it should still be
|
||||
-- compiled as C (and not C++), and vice versa.
|
||||
--
|
||||
|
||||
function suite.compileAsSet_onCFileInCppProject()
|
||||
language "C++"
|
||||
files { "hello.c" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="hello.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
CompileAs="1"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.compileAsSet_onCppFileInCProject()
|
||||
language "C"
|
||||
files { "hello.cpp" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="hello.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
CompileAs="2"
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check handling of per-file compileas options.
|
||||
--
|
||||
|
||||
function suite.onCompileAs_C_as_CPP()
|
||||
language "C"
|
||||
files { "hello.c" }
|
||||
filter {"files:hello.c"}
|
||||
compileas "C++"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="hello.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
CompileAs="2"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
CompileAs="2"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Files>
|
||||
]]
|
||||
end
|
||||
|
||||
-- make sure compileas is still omitted when it matches the language.
|
||||
function suite.onCompileAs_C_as_CPP_in_CPP()
|
||||
language "C++"
|
||||
files { "hello.c" }
|
||||
filter {"files:hello.c"}
|
||||
compileas "C++"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="hello.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
CompileAs="2"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
CompileAs="2"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Files>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onCompileAs_C_as_CPP_release()
|
||||
language "C"
|
||||
files { "hello.c" }
|
||||
filter {"files:hello.c", "configurations:release"}
|
||||
compileas "C++"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="hello.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
CompileAs="2"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Files>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onCompileAs_CPP_as_C()
|
||||
language "C++"
|
||||
files { "hello.cpp" }
|
||||
filter {"files:hello.cpp"}
|
||||
compileas "C"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="hello.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
CompileAs="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
CompileAs="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Files>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onCompileAs_CPP_as_C_release()
|
||||
language "C++"
|
||||
files { "hello.cpp" }
|
||||
filter {"files:hello.cpp", "configurations:release"}
|
||||
compileas "C"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="hello.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
CompileAs="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Files>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- A PCH source file should be marked as such.
|
||||
--
|
||||
|
||||
function suite.usePrecompiledHeadersSet_onPchSource()
|
||||
files { "afxwin.cpp" }
|
||||
pchsource "afxwin.cpp"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="afxwin.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- A file flagged with NoPCH should be marked as such.
|
||||
--
|
||||
|
||||
function suite.useNoPCHFlag()
|
||||
files { "test.cpp" }
|
||||
filter { "files:test.cpp" }
|
||||
flags { "NoPCH" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="test.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- A file excluded from a specific configuration should be marked as such.
|
||||
--
|
||||
|
||||
function suite.excludedFromBuild_onExcludedFile()
|
||||
files { "hello.cpp" }
|
||||
filter "Debug"
|
||||
removefiles { "hello.cpp" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="hello.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.excludedFromBuild_onExcludeFlag()
|
||||
files { "hello.cpp" }
|
||||
filter "files:hello.cpp"
|
||||
flags { "ExcludeFromBuild" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="hello.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.excludedFromBuild_onCustomBuildRule_excludedFile()
|
||||
files { "hello.cg" }
|
||||
filter "files:**.cg"
|
||||
buildcommands { "cgc $(InputFile)" }
|
||||
buildoutputs { "$(InputName).obj" }
|
||||
filter "Debug"
|
||||
removefiles { "hello.cg" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="hello.cg"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.excludedFromBuild_onCustomBuildRule_excludeFlag()
|
||||
files { "hello.cg" }
|
||||
filter "files:**.cg"
|
||||
buildcommands { "cgc $(InputFile)" }
|
||||
buildoutputs { "$(InputName).obj" }
|
||||
flags { "ExcludeFromBuild" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="hello.cg"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="cgc $(InputFile)"
|
||||
Outputs="$(InputName).obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a custom build rule is supplied, the custom build tool settings should be used.
|
||||
--
|
||||
|
||||
function suite.customBuildTool_onBuildRule()
|
||||
files { "hello.x" }
|
||||
filter "files:**.x"
|
||||
buildmessage "Compiling $(InputFile)"
|
||||
buildcommands {
|
||||
'cxc -c "$(InputFile)" -o "$(IntDir)/$(InputName).xo"',
|
||||
'c2o -c "$(IntDir)/$(InputName).xo" -o "$(IntDir)/$(InputName).obj"'
|
||||
}
|
||||
buildoutputs { "$(IntDir)/$(InputName).obj" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="hello.x"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="cxc -c "$(InputFile)" -o "$(IntDir)/$(InputName).xo"
c2o -c "$(IntDir)/$(InputName).xo" -o "$(IntDir)/$(InputName).obj""
|
||||
Outputs="$(IntDir)/$(InputName).obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.customBuildTool_onBuildRuleMultipleBuildOutputs()
|
||||
files { "hello.x" }
|
||||
filter "files:**.x"
|
||||
buildmessage "Compiling $(InputFile)"
|
||||
buildcommands {
|
||||
'cp "$(InputFile)" "$(IntDir)/$(InputName).a"',
|
||||
'cp "$(InputFile)" "$(IntDir)/$(InputName).b"'
|
||||
}
|
||||
buildoutputs { "$(IntDir)/$(InputName).a", "$(IntDir)/$(InputName).b" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="hello.x"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="cp "$(InputFile)" "$(IntDir)/$(InputName).a"
cp "$(InputFile)" "$(IntDir)/$(InputName).b""
|
||||
Outputs="$(IntDir)/$(InputName).a;$(IntDir)/$(InputName).b"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.customBuildTool_onBuildRuleWithTokens()
|
||||
files { "hello.x" }
|
||||
objdir "../tmp/%{cfg.name}"
|
||||
filter "files:**.x"
|
||||
buildmessage "Compiling $(InputFile)"
|
||||
buildcommands {
|
||||
'cxc -c %{file.relpath} -o %{cfg.objdir}/%{file.basename}.xo',
|
||||
'c2o -c %{cfg.objdir}/%{file.basename}.xo -o %{cfg.objdir}/%{file.basename}.obj'
|
||||
}
|
||||
buildoutputs { "%{cfg.objdir}/%{file.basename}.obj" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="hello.x"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="cxc -c hello.x -o ../tmp/Debug/hello.xo
c2o -c ../tmp/Debug/hello.xo -o ../tmp/Debug/hello.obj"
|
||||
Outputs="../tmp/Debug/hello.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.customBuildTool_onBuildRuleWithAdditionalInputs()
|
||||
files { "hello.x" }
|
||||
filter "files:**.x"
|
||||
buildmessage "Compiling $(InputFile)"
|
||||
buildcommands {
|
||||
'cxc -c "$(InputFile)" -o "$(IntDir)/$(InputName).xo"',
|
||||
'c2o -c "$(IntDir)/$(InputName).xo" -o "$(IntDir)/$(InputName).obj"'
|
||||
}
|
||||
buildoutputs { "$(IntDir)/$(InputName).obj" }
|
||||
buildinputs { "common.x.inc", "common.x.inc2" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="hello.x"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="cxc -c "$(InputFile)" -o "$(IntDir)/$(InputName).xo"
c2o -c "$(IntDir)/$(InputName).xo" -o "$(IntDir)/$(InputName).obj""
|
||||
Outputs="$(IntDir)/$(InputName).obj"
|
||||
AdditionalDependencies="common.x.inc;common.x.inc2"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If two files at different folder levels have the same name, a different
|
||||
-- object file name should be used for each.
|
||||
--
|
||||
|
||||
function suite.uniqueObjectNames_onSourceNameCollision()
|
||||
files { "hello.cpp", "greetings/hello.cpp" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<Filter
|
||||
Name="greetings"
|
||||
>
|
||||
<File
|
||||
RelativePath="greetings\hello.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath="hello.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\hello1.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\hello1.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of per-file forced includes.
|
||||
--
|
||||
|
||||
function suite.forcedIncludeFiles()
|
||||
files { "hello.cpp" }
|
||||
filter "files:**.cpp"
|
||||
forceincludes { "../include/force1.h", "../include/force2.h" }
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="hello.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ForcedIncludeFiles="..\include\force1.h;..\include\force2.h"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of per-file command line build options.
|
||||
--
|
||||
|
||||
function suite.additionalOptions()
|
||||
files { "hello.cpp" }
|
||||
filter "files:**.cpp"
|
||||
buildoptions { "/Xc" }
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="hello.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/Xc"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of per-file optimization levels.
|
||||
--
|
||||
|
||||
function suite.onOptimize()
|
||||
files { "hello.cpp" }
|
||||
filter "files:**.cpp"
|
||||
optimize "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="hello.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.onOptimizeSize()
|
||||
files { "hello.cpp" }
|
||||
filter "files:**.cpp"
|
||||
optimize "Size"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="hello.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="1"
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onOptimizeSpeed()
|
||||
files { "hello.cpp" }
|
||||
filter "files:**.cpp"
|
||||
optimize "Speed"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="hello.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onOptimizeFull()
|
||||
files { "hello.cpp" }
|
||||
filter "files:**.cpp"
|
||||
optimize "Full"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="hello.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onOptimizeOff()
|
||||
files { "hello.cpp" }
|
||||
filter "files:**.cpp"
|
||||
optimize "Off"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="hello.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onOptimizeDebug()
|
||||
files { "hello.cpp" }
|
||||
filter "files:**.cpp"
|
||||
optimize "Debug"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="hello.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of per-file defines.
|
||||
--
|
||||
|
||||
function suite.defines()
|
||||
files { "hello.cpp" }
|
||||
filter "files:hello.cpp"
|
||||
defines { "HELLO" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="hello.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="HELLO"
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +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
|
||||
@@ -0,0 +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
|
||||
@@ -0,0 +1,123 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc200x/test_nmake_settings.lua
|
||||
-- Validate generation the VCNMakeTool element in Visual Studio 200x C/C++ projects.
|
||||
-- Copyright (c) 2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs200x_nmake_settings")
|
||||
local vc200x = p.vstudio.vc200x
|
||||
|
||||
|
||||
--
|
||||
-- Setup/teardown
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2005")
|
||||
p.escaper(p.vstudio.vs2005.esc)
|
||||
wks, prj = test.createWorkspace()
|
||||
kind "Makefile"
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
vc200x.VCNMakeTool(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the basic structure of the compiler block with no flags or settings.
|
||||
--
|
||||
|
||||
function suite.onDefaultSettings()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCNMakeTool"
|
||||
BuildCommandLine=""
|
||||
ReBuildCommandLine=""
|
||||
CleanCommandLine=""
|
||||
Output="$(OutDir)MyProject"
|
||||
PreprocessorDefinitions=""
|
||||
IncludeSearchPath=""
|
||||
ForcedIncludes=""
|
||||
AssemblySearchPath=""
|
||||
ForcedUsingAssemblies=""
|
||||
CompileAsManaged=""
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Make sure the target file extension is included.
|
||||
--
|
||||
|
||||
function suite.usesTargetExtension()
|
||||
targetextension ".exe"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCNMakeTool"
|
||||
BuildCommandLine=""
|
||||
ReBuildCommandLine=""
|
||||
CleanCommandLine=""
|
||||
Output="$(OutDir)MyProject.exe"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify generation of the build commands.
|
||||
--
|
||||
|
||||
function suite.buildCommandLine_onSingleCommand()
|
||||
buildcommands { "command 1" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCNMakeTool"
|
||||
BuildCommandLine="command 1"
|
||||
ReBuildCommandLine=""
|
||||
CleanCommandLine=""
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.buildCommandLine_onMultipleCommands()
|
||||
buildcommands { "command 1", "command 2" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCNMakeTool"
|
||||
BuildCommandLine="command 1
command 2"
|
||||
ReBuildCommandLine=""
|
||||
CleanCommandLine=""
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.rebuildCommandLine()
|
||||
rebuildcommands { "command 1" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCNMakeTool"
|
||||
BuildCommandLine=""
|
||||
ReBuildCommandLine="command 1"
|
||||
CleanCommandLine=""
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.cleanCommandLine()
|
||||
cleancommands { "command 1" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCNMakeTool"
|
||||
BuildCommandLine=""
|
||||
ReBuildCommandLine=""
|
||||
CleanCommandLine="command 1"
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,80 @@
|
||||
--
|
||||
-- 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
|
||||
@@ -0,0 +1,214 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc200x/test_project.lua
|
||||
-- Validate generation of the opening <VisualStudioProject> element.
|
||||
-- Copyright (c) 2011-2014 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs200x_project")
|
||||
local vc200x = p.vstudio.vc200x
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2008")
|
||||
wks = test.createWorkspace()
|
||||
uuid "AE61726D-187C-E440-BD07-2556188A6565"
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
prj = test.getproject(wks, 1)
|
||||
vc200x.visualStudioProject(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the version numbers for each action.
|
||||
--
|
||||
|
||||
function suite.hasCorrectVersion_on2005()
|
||||
p.action.set("vs2005")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.hasCorrectVersion_on2008()
|
||||
p.action.set("vs2008")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the structure with the default project values.
|
||||
--
|
||||
|
||||
function suite.structureIsCorrect_onDefaultValues()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="MyProject"
|
||||
ProjectGUID="{AE61726D-187C-E440-BD07-2556188A6565}"
|
||||
RootNamespace="MyProject"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="0"
|
||||
>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Use the correct keyword for Managed C++ projects.
|
||||
--
|
||||
|
||||
function suite.keywordIsCorrect_onManagedC()
|
||||
clr "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="MyProject"
|
||||
ProjectGUID="{AE61726D-187C-E440-BD07-2556188A6565}"
|
||||
RootNamespace="MyProject"
|
||||
Keyword="ManagedCProj"
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Omit Keyword and RootNamespace for non-Windows projects.
|
||||
--
|
||||
|
||||
function suite.noKeyword_onNotWindows()
|
||||
system "Linux"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="MyProject"
|
||||
ProjectGUID="{AE61726D-187C-E440-BD07-2556188A6565}"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Include Keyword and RootNamespace for mixed system projects.
|
||||
--
|
||||
|
||||
function suite.includeKeyword_onMixedConfigs()
|
||||
filter "Debug"
|
||||
system "Windows"
|
||||
filter "Release"
|
||||
system "Linux"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="MyProject"
|
||||
ProjectGUID="{AE61726D-187C-E440-BD07-2556188A6565}"
|
||||
RootNamespace="MyProject"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="0"
|
||||
>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Makefile projects set new keyword. It should also drop the root
|
||||
-- namespace, but I need to figure out a better way to test for
|
||||
-- empty configurations in the project first.
|
||||
--
|
||||
|
||||
function suite.keywordIsCorrect_onMakefile()
|
||||
kind "Makefile"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="MyProject"
|
||||
ProjectGUID="{AE61726D-187C-E440-BD07-2556188A6565}"
|
||||
RootNamespace="MyProject"
|
||||
Keyword="MakeFileProj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.keywordIsCorrect_onNone()
|
||||
kind "None"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="MyProject"
|
||||
ProjectGUID="{AE61726D-187C-E440-BD07-2556188A6565}"
|
||||
RootNamespace="MyProject"
|
||||
Keyword="MakeFileProj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Makefile projects which do not support all of the solution configurations
|
||||
-- add back the RootNamespace element.
|
||||
---
|
||||
|
||||
function suite.keywordIsCorrect_onMakefileWithMixedConfigs()
|
||||
removeconfigurations { "Release" }
|
||||
kind "Makefile"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="MyProject"
|
||||
ProjectGUID="{AE61726D-187C-E440-BD07-2556188A6565}"
|
||||
RootNamespace="MyProject"
|
||||
Keyword="MakeFileProj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.keywordIsCorrect_onNoneWithMixedConfigs()
|
||||
removeconfigurations { "Release" }
|
||||
kind "None"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="MyProject"
|
||||
ProjectGUID="{AE61726D-187C-E440-BD07-2556188A6565}"
|
||||
RootNamespace="MyProject"
|
||||
Keyword="MakeFileProj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
]]
|
||||
end
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc200x/test_project_refs.lua
|
||||
-- Validate project references in Visual Studio 200x C/C++ projects.
|
||||
-- Copyright (c) 2011-2012 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs200x_project_refs")
|
||||
local vc200x = p.vstudio.vc200x
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2008")
|
||||
wks = test.createWorkspace()
|
||||
uuid "00112233-4455-6677-8888-99AABBCCDDEE"
|
||||
test.createproject(wks)
|
||||
end
|
||||
|
||||
local function prepare(platform)
|
||||
prj = test.getproject(wks, 2)
|
||||
vc200x.projectReferences(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If there are no sibling projects listed in links(), then the
|
||||
-- entire project references item group should be skipped.
|
||||
--
|
||||
|
||||
function suite.noProjectReferencesGroup_onNoSiblingReferences()
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a sibling project is listed in links(), an item group should
|
||||
-- be written with a reference to that sibling project.
|
||||
--
|
||||
|
||||
function suite.projectReferenceAdded_onSiblingProjectLink()
|
||||
links { "MyProject" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ProjectReference
|
||||
ReferencedProjectIdentifier="{00112233-4455-6677-8888-99AABBCCDDEE}"
|
||||
RelativePathToProject=".\MyProject.vcproj"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Project references should always be specified relative to the
|
||||
-- *solution* doing the referencing. Which is kind of weird, since it
|
||||
-- would be incorrect if the project were included in more than one
|
||||
-- solution file, yes?
|
||||
--
|
||||
|
||||
function suite.referencesAreRelative_onDifferentProjectLocation()
|
||||
links { "MyProject" }
|
||||
location "build/MyProject2"
|
||||
project("MyProject")
|
||||
location "build/MyProject"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ProjectReference
|
||||
ReferencedProjectIdentifier="{00112233-4455-6677-8888-99AABBCCDDEE}"
|
||||
RelativePathToProject=".\build\MyProject\MyProject.vcproj"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc200x/test_resource_compiler.lua
|
||||
-- Validate generation the VCResourceCompilerTool element in Visual Studio 200x C/C++ projects.
|
||||
-- Copyright (c) 2012-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs200x_resource_compiler")
|
||||
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.VCResourceCompilerTool(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify the basic structure of the compiler block with no flags or settings.
|
||||
--
|
||||
|
||||
function suite.looksGood_onDefaultSettings()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Both includedirs and resincludedirs should be used.
|
||||
--
|
||||
|
||||
function suite.usesBothIncludeAndResIncludeDirs()
|
||||
includedirs { "../include" }
|
||||
resincludedirs { "../res/include" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
AdditionalIncludeDirectories="..\include;..\res\include"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Test locale conversion to culture codes.
|
||||
--
|
||||
|
||||
function suite.culture_en_NZ()
|
||||
locale "en-NZ"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
Culture="5129"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,49 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc200x/test_user_file.lua
|
||||
-- Verify handling of empty and non-empty .user files for VC'200x.
|
||||
-- Copyright (c) 2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs200x_user_file")
|
||||
local vc200x = p.vstudio.vc200x
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2008")
|
||||
wks = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local prj = test.getproject(wks, 1)
|
||||
vc200x.generateUser(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If no debugger settings have been specified, then the .user
|
||||
-- file should not be written at all.
|
||||
--
|
||||
|
||||
function suite.noOutput_onNoSettings()
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a debugger setting has been specified, output.
|
||||
--
|
||||
|
||||
function suite.doesOutput_onDebugSettings()
|
||||
debugcommand "bin/emulator.exe"
|
||||
prepare()
|
||||
test.hasoutput()
|
||||
end
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_assembly_refs.lua
|
||||
-- Validate managed assembly references in Visual Studio 2010 C/C++ projects.
|
||||
-- Copyright (c) 2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs2010_assembly_refs")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
wks = test.createWorkspace()
|
||||
clr "On"
|
||||
end
|
||||
|
||||
local function prepare(platform)
|
||||
prj = test.getproject(wks, 1)
|
||||
vc2010.assemblyReferences(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If there are no managed assemblies listed in links, output nothing.
|
||||
--
|
||||
|
||||
function suite.noOutput_onNoAssemblies()
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- To distinguish between managed and unmanaged libraries, the ".dll"
|
||||
-- extension must be explicitly supplied.
|
||||
--
|
||||
|
||||
function suite.listsAssemblies()
|
||||
links { "System.dll", "System.Data.dll" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Any unmanaged libraries included in the list should be ignored.
|
||||
--
|
||||
|
||||
function suite.ignoresUnmanagedLibraries()
|
||||
links { "m", "System.dll" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Local (non-system) assemblies can be referenced with a relative path.
|
||||
--
|
||||
|
||||
function suite.canReferenceLocalAssembly()
|
||||
links { "../nunit.framework.dll" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,131 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_build_events.lua
|
||||
-- Check generation of pre- and post-build commands for C++ projects.
|
||||
-- Copyright (c) 2012-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vc2010_build_events")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj, cfg
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
p.escaper(p.vstudio.vs2010.esc)
|
||||
wks = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare(platform)
|
||||
prj = test.getproject(wks, 1)
|
||||
vc2010.buildEvents(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If no build steps are specified, nothing should be written.
|
||||
--
|
||||
|
||||
function suite.noOutput_onNoEvents()
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If one command set is used and not the other, only the one should be written.
|
||||
--
|
||||
|
||||
function suite.onlyOne_onPreBuildOnly()
|
||||
prebuildcommands { "command1" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PreBuildEvent>
|
||||
<Command>command1</Command>
|
||||
</PreBuildEvent>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onlyOne_onPostBuildOnly()
|
||||
postbuildcommands { "command1" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PostBuildEvent>
|
||||
<Command>command1</Command>
|
||||
</PostBuildEvent>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.both_onBoth()
|
||||
prebuildcommands { "command1" }
|
||||
postbuildcommands { "command2" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PreBuildEvent>
|
||||
<Command>command1</Command>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
<Command>command2</Command>
|
||||
</PostBuildEvent>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Multiple commands should be separated with un-escaped EOLs.
|
||||
--
|
||||
|
||||
function suite.splits_onMultipleCommands()
|
||||
postbuildcommands { "command1", "command2" }
|
||||
prepare()
|
||||
test.capture ("<PostBuildEvent>\n\t<Command>command1\r\ncommand2</Command>\n</PostBuildEvent>\n")
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Multiple of the same command should be emit.
|
||||
--
|
||||
|
||||
function suite.onCommandTwice()
|
||||
postbuildcommands { "command", "command" }
|
||||
prepare()
|
||||
test.capture ("<PostBuildEvent>\n\t<Command>command\r\ncommand</Command>\n</PostBuildEvent>\n")
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Quotes should not be escaped, other special characters should.
|
||||
--
|
||||
|
||||
function suite.onSpecialChars()
|
||||
postbuildcommands { '\' " < > &' }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PostBuildEvent>
|
||||
<Command>' " < > &</Command>
|
||||
</PostBuildEvent>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a message is specified, it should be included.
|
||||
--
|
||||
|
||||
function suite.onMessageProvided()
|
||||
postbuildcommands { "command1" }
|
||||
postbuildmessage "Post-building..."
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PostBuildEvent>
|
||||
<Command>command1</Command>
|
||||
<Message>Post-building...</Message>
|
||||
</PostBuildEvent>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,52 @@
|
||||
---
|
||||
-- tests/actions/vstudio/vc2010/test_build_log.lua
|
||||
-- Validate build log settings in Visual Studio 2010 C/C++ projects.
|
||||
-- Copyright (c) 2015 Jason Perkins and the Premake project
|
||||
---
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs2010_build_log")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare(platform)
|
||||
local cfg = test.getconfig(prj, "Debug", platform)
|
||||
vc2010.buildLog(cfg)
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Nothing should be written by default.
|
||||
--
|
||||
|
||||
function suite.isIgnoredByDefault()
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Write out relative path if provided.
|
||||
--
|
||||
|
||||
function suite.writesPathIfSet()
|
||||
buildlog "logs/MyCustomLogFile.log"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<BuildLog>
|
||||
<Path>logs\MyCustomLogFile.log</Path>
|
||||
</BuildLog>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,92 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_compile_settings.lua
|
||||
-- Validate compiler settings in Visual Studio 2010 C/C++ projects.
|
||||
-- Copyright (c) 2011-2020 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs2010_build_steps")
|
||||
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(platform)
|
||||
local cfg = test.getconfig(prj, "Debug", platform)
|
||||
vc2010.buildStep(cfg)
|
||||
end
|
||||
|
||||
--
|
||||
-- Check that we output nothing unless there is something to output
|
||||
--
|
||||
|
||||
function suite.buildStepNone()
|
||||
prepare()
|
||||
test.capture [[
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check the basic build step example
|
||||
--
|
||||
|
||||
function suite.buildStepBasic()
|
||||
buildcommands("Example.exe")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<CustomBuildStep>
|
||||
<Command>Example.exe</Command>
|
||||
</CustomBuildStep>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check a normal build step setup
|
||||
--
|
||||
|
||||
function suite.buildStepCommon()
|
||||
buildcommands("Example.exe")
|
||||
buildoutputs("Example.out")
|
||||
buildinputs("Example.in")
|
||||
buildmessage("Hello World")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<CustomBuildStep>
|
||||
<Command>Example.exe</Command>
|
||||
<Message>Hello World</Message>
|
||||
<Outputs>Example.out</Outputs>
|
||||
<Inputs>Example.in</Inputs>
|
||||
</CustomBuildStep>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check a more complex build step setup
|
||||
--
|
||||
|
||||
function suite.buildStepComplex()
|
||||
buildcommands ( "Example.exe" )
|
||||
buildoutputs { "Example.out", "Example2.out" }
|
||||
buildinputs { "Example.in", "Example2.in" }
|
||||
buildmessage("Hello World")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<CustomBuildStep>
|
||||
<Command>Example.exe</Command>
|
||||
<Message>Hello World</Message>
|
||||
<Outputs>Example.out;Example2.out</Outputs>
|
||||
<Inputs>Example.in;Example2.in</Inputs>
|
||||
</CustomBuildStep>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,57 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_character_set.lua
|
||||
-- Validate generation Unicode/MBCS settings.
|
||||
-- Copyright (c) 2011-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs2010_character_set")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
|
||||
|
||||
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.characterSet(cfg)
|
||||
end
|
||||
|
||||
|
||||
function suite.onDefault()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.onUnicode()
|
||||
characterset "Unicode"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.onMBCS()
|
||||
characterset "MBCS"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onASCII()
|
||||
characterset "ASCII"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
]]
|
||||
end
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,355 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_config_props.lua
|
||||
-- Validate generation of the configuration property group.
|
||||
-- Copyright (c) 2011-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs2010_config_props")
|
||||
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()
|
||||
cfg = test.getconfig(prj, "Debug")
|
||||
vc2010.configurationProperties(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the structure with the default project values.
|
||||
--
|
||||
|
||||
function suite.structureIsCorrect_onDefaultValues()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v100</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the configuration type for differenet project kinds.
|
||||
--
|
||||
|
||||
function suite.configurationType_onConsoleApp()
|
||||
kind "ConsoleApp"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.configurationType_onWindowedApp()
|
||||
kind "WindowedApp"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.configurationType_onSharedLib()
|
||||
kind "SharedLib"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.configurationType_onStaticLib()
|
||||
kind "StaticLib"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Debug configurations (for some definition of "debug") should use the debug libraries.
|
||||
--
|
||||
|
||||
function suite.debugLibraries_onDebugConfig()
|
||||
symbols "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the support for Managed C++.
|
||||
--
|
||||
|
||||
function suite.clrSupport_onClrOn()
|
||||
clr "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.clrSupport_onClrOff()
|
||||
clr "Off"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.clrSupport_onClrUnsafe()
|
||||
clr "Unsafe"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CLRSupport>true</CLRSupport>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.clrSupport_onClrSafe()
|
||||
clr "Safe"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CLRSupport>Safe</CLRSupport>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.clrSupport_onClrPure()
|
||||
clr "Pure"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CLRSupport>Pure</CLRSupport>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.clrSupport_onClrNetCore()
|
||||
clr "NetCore"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CLRSupport>NetCore</CLRSupport>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the support for building with MFC.
|
||||
--
|
||||
|
||||
function suite.useOfMfc_onDynamicRuntime()
|
||||
flags "MFC"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.useOfMfc_onStaticRuntime()
|
||||
flags { "MFC" }
|
||||
staticruntime "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check the support for building with ATL.
|
||||
--
|
||||
|
||||
function suite.useOfAtl_onDynamicRuntime()
|
||||
atl "Dynamic"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<UseOfATL>Dynamic</UseOfATL>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.useOfAtl_onStaticRuntime()
|
||||
atl "Static"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<UseOfATL>Static</UseOfATL>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check handling of the ReleaseRuntime flag; should override the
|
||||
-- default behavior of linking the debug runtime when symbols are
|
||||
-- enabled with no optimizations.
|
||||
--
|
||||
|
||||
function suite.releaseRuntime_onFlag()
|
||||
runtime "Release"
|
||||
symbols "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the default settings for a Makefile configuration: new
|
||||
-- configuration type, no character set, output and intermediate
|
||||
-- folders are moved up from their normal location in the output
|
||||
-- configuration element.
|
||||
--
|
||||
|
||||
function suite.structureIsCorrect_onMakefile()
|
||||
kind "Makefile"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Makefile</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<OutDir>bin\Debug\</OutDir>
|
||||
<IntDir>obj\Debug\</IntDir>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.structureIsCorrect_onNone()
|
||||
kind "None"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Makefile</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<OutDir>bin\Debug\</OutDir>
|
||||
<IntDir>obj\Debug\</IntDir>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Same as above but for Utility
|
||||
--
|
||||
|
||||
function suite.structureIsCorrect_onUtility()
|
||||
kind "Utility"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Utility</ConfigurationType>
|
||||
<PlatformToolset>v100</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check the LinkTimeOptimization flag
|
||||
--
|
||||
|
||||
function suite.useOfLinkTimeOptimization()
|
||||
flags { "LinkTimeOptimization" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v100</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the WindowsSDKDesktopARMSupport element
|
||||
--
|
||||
|
||||
function suite.WindowsSDKDesktopARMSupport_off()
|
||||
system "ios"
|
||||
architecture "ARM"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v100</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.WindowsSDKDesktopARMSupport_on()
|
||||
system "windows"
|
||||
architecture "ARM"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v100</PlatformToolset>
|
||||
<WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.WindowsSDKDesktopARM64Support()
|
||||
system "windows"
|
||||
architecture "ARM64"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v100</PlatformToolset>
|
||||
<WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,148 @@
|
||||
--
|
||||
-- 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_onMultipleDebugEnv()
|
||||
debugenvs { "key=value", "foo=bar" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<LocalDebuggerEnvironment>key=value
|
||||
foo=bar</LocalDebuggerEnvironment>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Test debugger flavors
|
||||
--
|
||||
|
||||
function suite.debugger_OnWindowsDefault()
|
||||
debugger "Default"
|
||||
prepare()
|
||||
test.capture [[
|
||||
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.debugger_OnWindowsUnavailable()
|
||||
debugger "GDB"
|
||||
prepare()
|
||||
test.capture [[
|
||||
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.debugger_OnWindowsLocal()
|
||||
debugger "VisualStudioLocal"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.debuggerFlavor_OnWindowsRemote()
|
||||
debugger "VisualStudioRemote"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<DebuggerFlavor>WindowsRemoteDebugger</DebuggerFlavor>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.debuggerFlavor_OnDebugDirAndDebugger()
|
||||
debugdir "bin/debug"
|
||||
debugger "VisualStudioRemote"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<LocalDebuggerWorkingDirectory>bin\debug</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsRemoteDebugger</DebuggerFlavor>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,60 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_ensure_nuget_imports.lua
|
||||
-- Check the EnsureNuGetPackageBuildImports block of a VS 2010 project.
|
||||
-- Copyright (c) 2016 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs2010_ensure_nuget_imports")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
local project = p.project
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
wks = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local prj = p.workspace.getproject(wks, 1)
|
||||
vc2010.ensureNuGetPackageBuildImports(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Should not output anything if no packages have been set.
|
||||
--
|
||||
|
||||
function suite.noOutputIfNoPackages()
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Writes the pre-build check that makes sure that all packages are installed.
|
||||
--
|
||||
|
||||
if _OPTIONS["test-all"] then
|
||||
function suite.structureIsCorrect()
|
||||
nuget { "boost:1.59.0-b1", "sdl2.v140:2.0.3", "sdl2.v140.redist:2.0.3" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('packages\boost.1.59.0-b1\build\native\boost.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\boost.1.59.0-b1\build\native\boost.targets'))" />
|
||||
<Error Condition="!Exists('packages\sdl2.v140.2.0.3\build\native\sdl2.v140.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\sdl2.v140.2.0.3\build\native\sdl2.v140.targets'))" />
|
||||
<Error Condition="!Exists('packages\sdl2.v140.redist.2.0.3\build\native\sdl2.v140.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\sdl2.v140.redist.2.0.3\build\native\sdl2.v140.redist.targets'))" />
|
||||
</Target>
|
||||
]]
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,78 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_excluded_configs.lua
|
||||
-- Check handling of configurations which have been excluded from the build.
|
||||
-- Copyright (c) 2012-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs2010_excluded_configs")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
|
||||
|
||||
--
|
||||
-- Setup/teardown
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
|
||||
wks = workspace("MyWorkspace")
|
||||
configurations { "Debug", "Release" }
|
||||
platforms { "Zeus", "Ares" }
|
||||
language "C++"
|
||||
|
||||
prj = project("MyProject")
|
||||
kind "ConsoleApp"
|
||||
links { "MyProject2", "MyProject3" }
|
||||
|
||||
project("MyProject2")
|
||||
kind "StaticLib"
|
||||
|
||||
project("MyProject3")
|
||||
kind "StaticLib"
|
||||
removeplatforms { "Ares" }
|
||||
end
|
||||
|
||||
local function prepare(platform)
|
||||
local cfg = test.getconfig(prj, "Debug", platform)
|
||||
vc2010.linker(cfg)
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- If a sibling is included in one configuration and excluded from
|
||||
-- another, the included configuration should link as normal.
|
||||
--
|
||||
|
||||
function suite.normalLink_onIncludedConfig()
|
||||
prepare("Zeus")
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- If a sibling is included in one configuration and excluded from
|
||||
-- another, the excluded configuration should force explicit linking
|
||||
-- and not list the excluded library.
|
||||
--
|
||||
|
||||
function suite.explicitLink_onExcludedConfig()
|
||||
prepare("Ares")
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<AdditionalDependencies>bin\Ares\Debug\MyProject2.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>false</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,90 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_extension_settings.lua
|
||||
-- Check the import extension settings block of a VS 2010 project.
|
||||
-- Copyright (c) 2014 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs2010_extension_settings")
|
||||
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.importExtensionSettings(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Writes an empty element when no custom rules are specified.
|
||||
--
|
||||
|
||||
function suite.structureIsCorrect_onDefaultValues()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Writes entries for each project scoped custom rules path.
|
||||
--
|
||||
|
||||
function suite.addsImport_onEachRulesFile()
|
||||
rules { "MyRules", "MyOtherRules" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
<Import Project="MyRules.props" />
|
||||
<Import Project="MyOtherRules.props" />
|
||||
</ImportGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Rule files use a project relative path.
|
||||
--
|
||||
|
||||
function suite.usesProjectRelativePaths()
|
||||
rules "MyRules"
|
||||
location "build"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
<Import Project="..\MyRules.props" />
|
||||
</ImportGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- the asm 'file category' should add the right settings.
|
||||
--
|
||||
|
||||
function suite.hasAssemblyFiles()
|
||||
files { "test.asm" }
|
||||
location "build"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props" />
|
||||
</ImportGroup>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,110 @@
|
||||
--
|
||||
-- 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.
|
||||
--
|
||||
|
||||
if _OPTIONS["test-all"] then
|
||||
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
|
||||
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
|
||||
905
Src/external_dependencies/openmpt-trunk/include/premake/modules/vstudio/tests/vc2010/test_files.lua
vendored
Normal file
905
Src/external_dependencies/openmpt-trunk/include/premake/modules/vstudio/tests/vc2010/test_files.lua
vendored
Normal file
@@ -0,0 +1,905 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_files.lua
|
||||
-- Validate generation of files block in Visual Studio 2010 C/C++ projects.
|
||||
-- Copyright (c) 2011-2014 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs2010_files")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
|
||||
rule "Animation"
|
||||
fileextension ".dae"
|
||||
propertydefinition {
|
||||
name = "AdditionalOptions",
|
||||
kind = "list",
|
||||
separator = ";"
|
||||
}
|
||||
|
||||
wks = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
prj = test.getproject(wks, 1)
|
||||
vc2010.files(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Test filtering of source files into the correct categories.
|
||||
--
|
||||
|
||||
function suite.clInclude_onHFile()
|
||||
files { "include/hello.h" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClInclude Include="include\hello.h" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.clCompile_onCFile()
|
||||
files { "hello.c" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="hello.c" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.resourceCompile_onRCFile()
|
||||
files { "resources/hello.rc" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="resources\hello.rc" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.midlCompile_onIDLFile()
|
||||
files { "idl/interfaces.idl" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<Midl Include="idl\interfaces.idl" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.none_onTxtFile()
|
||||
files { "docs/hello.txt" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<None Include="docs\hello.txt" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of buildaction.
|
||||
--
|
||||
function suite.customBuildTool_onBuildAction()
|
||||
files { "test.x", "test2.cpp", "test3.cpp" }
|
||||
filter "files:**.x"
|
||||
buildaction "FxCompile"
|
||||
filter "files:test2.cpp"
|
||||
buildaction "None"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="test3.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<FxCompile Include="test.x" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="test2.cpp" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of files with custom build rules.
|
||||
--
|
||||
|
||||
function suite.customBuild_onBuildRule()
|
||||
files { "hello.cg" }
|
||||
filter "files:**.cg"
|
||||
buildcommands { "cgc $(InputFile)" }
|
||||
buildoutputs { "$(InputName).obj" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="hello.cg">
|
||||
<FileType>Document</FileType>
|
||||
<Command>cgc $(InputFile)</Command>
|
||||
<Outputs>$(InputName).obj</Outputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.customBuild_onBuildRuleMultipleBuildOutputs()
|
||||
files { "hello.cg" }
|
||||
filter "files:**.cg"
|
||||
buildcommands { "cgc $(InputFile)" }
|
||||
buildoutputs { "$(InputName).a", "$(InputName).b" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="hello.cg">
|
||||
<FileType>Document</FileType>
|
||||
<Command>cgc $(InputFile)</Command>
|
||||
<Outputs>$(InputName).a;$(InputName).b</Outputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.customBuild_onBuildRuleWithMessage()
|
||||
files { "hello.cg" }
|
||||
filter "files:**.cg"
|
||||
buildmessage "Compiling shader $(InputFile)"
|
||||
buildcommands { "cgc $(InputFile)" }
|
||||
buildoutputs { "$(InputName).obj" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="hello.cg">
|
||||
<FileType>Document</FileType>
|
||||
<Command>cgc $(InputFile)</Command>
|
||||
<Outputs>$(InputName).obj</Outputs>
|
||||
<Message>Compiling shader $(InputFile)</Message>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.customBuild_onBuildRuleWithAdditionalInputs()
|
||||
files { "hello.cg" }
|
||||
filter "files:**.cg"
|
||||
buildcommands { "cgc $(InputFile)" }
|
||||
buildoutputs { "$(InputName).obj" }
|
||||
buildinputs { "common.cg.inc", "common.cg.inc2" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="hello.cg">
|
||||
<FileType>Document</FileType>
|
||||
<Command>cgc $(InputFile)</Command>
|
||||
<Outputs>$(InputName).obj</Outputs>
|
||||
<AdditionalInputs>common.cg.inc;common.cg.inc2</AdditionalInputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a PCH source is specified, ensure it is included in the file configuration.
|
||||
--
|
||||
|
||||
function suite.precompiledHeader_onPchSource()
|
||||
files { "afxwin.cpp" }
|
||||
pchheader "afxwin.h"
|
||||
pchsource "afxwin.cpp"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="afxwin.cpp">
|
||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a file is excluded from a configuration, make sure it is marked as such.
|
||||
--
|
||||
|
||||
function suite.excludedFromBuild_onExcludedFile()
|
||||
files { "hello.cpp" }
|
||||
filter "Debug"
|
||||
removefiles { "hello.cpp" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="hello.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.excludedFromBuild_onExcludeFlag()
|
||||
files { "hello.cpp" }
|
||||
filter "files:hello.cpp"
|
||||
flags { "ExcludeFromBuild" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="hello.cpp">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.excludedFromBuild_onResourceFile_excludedFile()
|
||||
files { "hello.rc" }
|
||||
filter "Debug"
|
||||
removefiles { "hello.rc" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="hello.rc">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.excludedFromBuild_onResourceFile_excludeFlag()
|
||||
files { "hello.rc" }
|
||||
filter "files:hello.rc"
|
||||
flags { "ExcludeFromBuild" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="hello.rc">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.excludedFromBuild_onResourceFile_excludeFlag_nonWindows()
|
||||
files { "hello.rc" }
|
||||
system "Linux"
|
||||
filter "files:hello.rc"
|
||||
flags { "ExcludeFromBuild" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="hello.rc">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.includedFromBuild_onResourceFile_nonWindows()
|
||||
files { "hello.rc" }
|
||||
system "Linux"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="hello.rc" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.excludedFromBuild_onCustomBuildRule_excludedFile()
|
||||
files { "hello.cg" }
|
||||
filter "files:**.cg"
|
||||
buildcommands { "cgc $(InputFile)" }
|
||||
buildoutputs { "$(InputName).obj" }
|
||||
filter "Debug"
|
||||
removefiles { "hello.cg" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="hello.cg">
|
||||
<FileType>Document</FileType>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">cgc $(InputFile)</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(InputName).obj</Outputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.excludedFromBuild_onCustomBuildRule_excludeFlag()
|
||||
files { "hello.cg" }
|
||||
filter "files:**.cg"
|
||||
buildcommands { "cgc $(InputFile)" }
|
||||
buildoutputs { "$(InputName).obj" }
|
||||
flags { "ExcludeFromBuild" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="hello.cg">
|
||||
<FileType>Document</FileType>
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
<Command>cgc $(InputFile)</Command>
|
||||
<Outputs>$(InputName).obj</Outputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.excludedFromBuild_onCustomBuildRule_withNoCommands()
|
||||
files { "hello.cg" }
|
||||
filter { "files:**.cg", "Debug" }
|
||||
buildcommands { "cgc $(InputFile)" }
|
||||
buildoutputs { "$(InputName).obj" }
|
||||
filter { "files:**.cg" }
|
||||
flags { "ExcludeFromBuild" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="hello.cg">
|
||||
<FileType>Document</FileType>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cgc $(InputFile)</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(InputName).obj</Outputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a custom rule outputs an object file, it's automatically linked, unless
|
||||
-- we explicitly specify that it isn't with linkbuildoutputs.
|
||||
--
|
||||
|
||||
function suite.linkBuildOutputs_onNotSpecified()
|
||||
files { "hello.x" }
|
||||
filter "files:**.x"
|
||||
buildcommands { "echo $(InputFile)" }
|
||||
buildoutputs { "$(InputName).obj" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="hello.x">
|
||||
<FileType>Document</FileType>
|
||||
<Command>echo $(InputFile)</Command>
|
||||
<Outputs>$(InputName).obj</Outputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.linkBuildOutputs_onOff()
|
||||
files { "hello.x" }
|
||||
filter "files:**.x"
|
||||
buildcommands { "echo $(InputFile)" }
|
||||
buildoutputs { "$(InputName).obj" }
|
||||
linkbuildoutputs "Off"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="hello.x">
|
||||
<FileType>Document</FileType>
|
||||
<Command>echo $(InputFile)</Command>
|
||||
<Outputs>$(InputName).obj</Outputs>
|
||||
<LinkObjects>false</LinkObjects>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.linkBuildOutputs_onOn()
|
||||
files { "hello.x" }
|
||||
filter "files:**.x"
|
||||
buildcommands { "echo $(InputFile)" }
|
||||
buildoutputs { "$(InputName).obj" }
|
||||
linkbuildoutputs "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="hello.x">
|
||||
<FileType>Document</FileType>
|
||||
<Command>echo $(InputFile)</Command>
|
||||
<Outputs>$(InputName).obj</Outputs>
|
||||
<LinkObjects>true</LinkObjects>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If two files at different folder levels have the same name, a different
|
||||
-- object file name should be used for each.
|
||||
--
|
||||
|
||||
function suite.uniqueObjectNames_onSourceNameCollision()
|
||||
files { "hello.cpp", "greetings/hello.cpp" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="greetings\hello.cpp" />
|
||||
<ClCompile Include="hello.cpp">
|
||||
<ObjectFileName>$(IntDir)\hello1.obj</ObjectFileName>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.uniqueObjectNames_onBaseNameCollision1()
|
||||
files { "a/hello.cpp", "b/hello.cpp", "c/hello1.cpp" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="a\hello.cpp" />
|
||||
<ClCompile Include="b\hello.cpp">
|
||||
<ObjectFileName>$(IntDir)\hello1.obj</ObjectFileName>
|
||||
</ClCompile>
|
||||
<ClCompile Include="c\hello1.cpp">
|
||||
<ObjectFileName>$(IntDir)\hello11.obj</ObjectFileName>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.uniqueObjectNames_onBaseNameCollision2()
|
||||
files { "a/hello1.cpp", "b/hello.cpp", "c/hello.cpp" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="a\hello1.cpp" />
|
||||
<ClCompile Include="b\hello.cpp" />
|
||||
<ClCompile Include="c\hello.cpp">
|
||||
<ObjectFileName>$(IntDir)\hello2.obj</ObjectFileName>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.uniqueObjectNames_onBaseNameCollision_Release()
|
||||
files { "a/hello.cpp", "b/hello.cpp", "c/hello1.cpp", "d/hello11.cpp" }
|
||||
filter "configurations:Debug"
|
||||
excludes {"b/hello.cpp"}
|
||||
filter "configurations:Release"
|
||||
excludes {"d/hello11.cpp"}
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="a\hello.cpp" />
|
||||
<ClCompile Include="b\hello.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)\hello1.obj</ObjectFileName>
|
||||
</ClCompile>
|
||||
<ClCompile Include="c\hello1.cpp">
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)\hello11.obj</ObjectFileName>
|
||||
</ClCompile>
|
||||
<ClCompile Include="d\hello11.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Test that changes in case are treated as if multiple files of the same name are being built
|
||||
--
|
||||
|
||||
function suite.uniqueObjectNames_onSourceNameCollision_ignoreCase()
|
||||
files { "hello.cpp", "greetings/Hello.cpp" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="greetings\Hello.cpp" />
|
||||
<ClCompile Include="hello.cpp">
|
||||
<ObjectFileName>$(IntDir)\hello1.obj</ObjectFileName>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.uniqueObjectNames_onBaseNameCollision_ignoreCase1()
|
||||
files { "a/hello.cpp", "b/Hello.cpp", "c/hello1.cpp" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="a\hello.cpp" />
|
||||
<ClCompile Include="b\Hello.cpp">
|
||||
<ObjectFileName>$(IntDir)\Hello1.obj</ObjectFileName>
|
||||
</ClCompile>
|
||||
<ClCompile Include="c\hello1.cpp">
|
||||
<ObjectFileName>$(IntDir)\hello11.obj</ObjectFileName>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.uniqueObjectNames_onBaseNameCollision_ignoreCase2()
|
||||
files { "a/hello1.cpp", "b/Hello.cpp", "c/hello.cpp" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="a\hello1.cpp" />
|
||||
<ClCompile Include="b\Hello.cpp" />
|
||||
<ClCompile Include="c\hello.cpp">
|
||||
<ObjectFileName>$(IntDir)\hello2.obj</ObjectFileName>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.uniqueObjectNames_onBaseNameCollision_Release_ignoreCase()
|
||||
files { "a/Hello.cpp", "b/hello.cpp", "c/hello1.cpp", "d/hello11.cpp" }
|
||||
filter "configurations:Debug"
|
||||
excludes {"b/hello.cpp"}
|
||||
filter "configurations:Release"
|
||||
excludes {"d/hello11.cpp"}
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="a\Hello.cpp" />
|
||||
<ClCompile Include="b\hello.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)\hello1.obj</ObjectFileName>
|
||||
</ClCompile>
|
||||
<ClCompile Include="c\hello1.cpp">
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)\hello11.obj</ObjectFileName>
|
||||
</ClCompile>
|
||||
<ClCompile Include="d\hello11.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of per-file forced includes.
|
||||
--
|
||||
|
||||
function suite.forcedIncludeFiles()
|
||||
files { "hello.cpp" }
|
||||
filter "files:**.cpp"
|
||||
forceincludes { "../include/force1.h", "../include/force2.h" }
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="hello.cpp">
|
||||
<ForcedIncludeFiles>..\include\force1.h;..\include\force2.h</ForcedIncludeFiles>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of per-file command line build options.
|
||||
--
|
||||
|
||||
function suite.additionalOptions()
|
||||
files { "hello.cpp" }
|
||||
filter "files:**.cpp"
|
||||
buildoptions { "/Xc" }
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="hello.cpp">
|
||||
<AdditionalOptions>/Xc %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check handling of per-file compileas options.
|
||||
--
|
||||
|
||||
function suite.onCompileAs()
|
||||
files { "hello.c" }
|
||||
filter "files:hello.c"
|
||||
compileas "C++"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="hello.c">
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onCompileAsDebug()
|
||||
files { "hello.c" }
|
||||
filter { "configurations:Debug", "files:hello.c" }
|
||||
compileas "C++"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="hello.c">
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsCpp</CompileAs>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check handling of per-file optimization levels.
|
||||
--
|
||||
|
||||
function suite.onOptimize()
|
||||
files { "hello.cpp" }
|
||||
filter "files:hello.cpp"
|
||||
optimize "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="hello.cpp">
|
||||
<Optimization>Full</Optimization>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.onOptimizeSize()
|
||||
files { "hello.cpp" }
|
||||
filter "files:hello.cpp"
|
||||
optimize "Size"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="hello.cpp">
|
||||
<Optimization>MinSpace</Optimization>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onOptimizeSpeed()
|
||||
files { "hello.cpp" }
|
||||
filter "files:hello.cpp"
|
||||
optimize "Speed"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="hello.cpp">
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onOptimizeFull()
|
||||
files { "hello.cpp" }
|
||||
filter "files:hello.cpp"
|
||||
optimize "Full"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="hello.cpp">
|
||||
<Optimization>Full</Optimization>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onOptimizeOff()
|
||||
files { "hello.cpp" }
|
||||
filter "files:hello.cpp"
|
||||
optimize "Off"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="hello.cpp">
|
||||
<Optimization>Disabled</Optimization>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onOptimizeDebug()
|
||||
files { "hello.cpp" }
|
||||
filter "files:hello.cpp"
|
||||
optimize "Debug"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="hello.cpp">
|
||||
<Optimization>Disabled</Optimization>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of per-file optimization levels.
|
||||
--
|
||||
|
||||
function suite.onPerFileRttiOn()
|
||||
files { "hello.cpp" }
|
||||
filter "files:hello.cpp"
|
||||
rtti "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="hello.cpp">
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onPerFileRttiOff()
|
||||
files { "hello.cpp" }
|
||||
filter "files:hello.cpp"
|
||||
rtti "Off"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="hello.cpp">
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check handling of per-file no PCH build options.
|
||||
--
|
||||
|
||||
function suite.excludedFromPCH()
|
||||
files { "hello.cpp" }
|
||||
filter "files:**.cpp"
|
||||
flags { "NoPCH" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="hello.cpp">
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of per-file command line build options.
|
||||
--
|
||||
|
||||
function suite.perFileDefines()
|
||||
files { "hello.cpp" }
|
||||
filter "files:**.cpp"
|
||||
defines { "IS_CPP" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="hello.cpp">
|
||||
<PreprocessorDefinitions>IS_CPP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of per-file command line build options.
|
||||
--
|
||||
|
||||
function suite.perFileSEH()
|
||||
files { "hello.asm", "hello.cpp" }
|
||||
filter "files:**.asm"
|
||||
exceptionhandling 'SEH'
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="hello.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Masm Include="hello.asm">
|
||||
<UseSafeExceptionHandlers>true</UseSafeExceptionHandlers>
|
||||
</Masm>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Make sure that the sort order of the source files is maintained even
|
||||
-- when virtual paths are used to organize them.
|
||||
--
|
||||
|
||||
function suite.maintainsSortOrder_onVirtualPaths()
|
||||
files { "SystemTray.h", "PrefsWriter.h", "SystemTray.cpp", "PrefsWriter.cpp" }
|
||||
vpaths {
|
||||
["source/mfc"] = { "PrefsWriter.*" },
|
||||
["source/core"] = { "SystemTray.*" },
|
||||
}
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClInclude Include="PrefsWriter.h" />
|
||||
<ClInclude Include="SystemTray.h" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of per-file vector extensions.
|
||||
--
|
||||
|
||||
function suite.perFileVectorExtensions()
|
||||
files { "hello.cpp" }
|
||||
filter "files:**.cpp"
|
||||
vectorextensions "sse2"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="hello.cpp">
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of files using custom rule definitions.
|
||||
--
|
||||
|
||||
function suite.isCategorizedByRule()
|
||||
rules "Animation"
|
||||
files { "hello.dae" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<Animation Include="hello.dae" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.listsPerConfigRuleVars()
|
||||
rules "Animation"
|
||||
files { "hello.dae" }
|
||||
filter { "files:hello.*", "configurations:Debug" }
|
||||
animationVars { AdditionalOptions = { "File1", "File2" }}
|
||||
filter { "files:hello.*", "configurations:Release" }
|
||||
animationVars { AdditionalOptions = { "File3" }}
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<Animation Include="hello.dae">
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">File1;File2</AdditionalOptions>
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">File3</AdditionalOptions>
|
||||
</Animation>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- test warning level set for a single file
|
||||
--
|
||||
|
||||
function suite.warningLevelPerFile()
|
||||
warnings 'Off'
|
||||
files { "hello.cpp", "hello2.cpp" }
|
||||
filter { "files:hello.cpp" }
|
||||
warnings 'Extra'
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ClCompile Include="hello.cpp">
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
</ClCompile>
|
||||
<ClCompile Include="hello2.cpp" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,108 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_filter_ids.lua
|
||||
-- Validate generation of filter unique identifiers.
|
||||
-- Copyright (c) 2011-2012 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs2010_filter_ids")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
|
||||
|
||||
--
|
||||
-- Setup/teardown
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
wks = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
prj = test.getproject(wks)
|
||||
vc2010.uniqueIdentifiers(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Files in the root folder (the same one as the project) don't get identifiers.
|
||||
--
|
||||
|
||||
function suite.groupIsEmpty_onOnlyRootFiles()
|
||||
files { "hello.c", "goodbye.c" }
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Folders shared between multiple files should be reduced to a single identifier.
|
||||
--
|
||||
|
||||
function suite.singleIdentifier_onMultipleFilesInSameFolder()
|
||||
files { "src/hello.c", "src/goodbye.c", "so_long.h" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<Filter Include="src">
|
||||
<UniqueIdentifier>{2DAB880B-99B4-887C-2230-9F7C8E38947C}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Nested folders should each get their own unique identifier.
|
||||
--
|
||||
|
||||
function suite.multipleIdentifiers_forNestedFolders()
|
||||
files { "src/hello.c", "src/departures/goodbye.c", "so_long.h" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<Filter Include="src">
|
||||
<UniqueIdentifier>{2DAB880B-99B4-887C-2230-9F7C8E38947C}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="src\departures">
|
||||
<UniqueIdentifier>{BB36ED8F-A704-E195-9098-51BC7C05BDFA}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a file has a virtual path, that should be used to build the filters.
|
||||
--
|
||||
|
||||
function suite.filterUsesVpath_onVpath()
|
||||
files { "hello.c", "goodbye.h" }
|
||||
vpaths { ["Source Files"] = "**.c" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.filterUsesVpath_onMultipleVpaths()
|
||||
files { "hello.h", "goodbye.c" }
|
||||
vpaths { ["Source Files"] = "*.c", ["Header Files"] = "*.h" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{21EB8090-0D4E-1035-B6D3-48EBA215DCB7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{E9C7FDCE-D52A-8D73-7EB0-C5296AF258F6}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,214 @@
|
||||
--
|
||||
-- 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_onMasmSection()
|
||||
files { "hello.asm" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<Masm Include="hello.asm" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check handling of image files
|
||||
--
|
||||
function suite.filerImage()
|
||||
files { "hello.png" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<Image Include="hello.png" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,53 @@
|
||||
---
|
||||
-- tests/actions/vstudio/vc2010/test_floatingpoint.lua
|
||||
-- Validate handling of vectorextensions() in VS 2010 C/C++ projects.
|
||||
--
|
||||
-- Created 26 Mar 2015 by Jason Perkins
|
||||
-- Copyright (c) 2015 Jason Perkins and the Premake project
|
||||
---
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs2010_vc_floatingpoint")
|
||||
local m = p.vstudio.vc2010
|
||||
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
m.floatingPointModel(cfg)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function suite.instructionSet_onNotSet()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
function suite.floatingPoint_onFloatFast()
|
||||
floatingpoint "fast"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.floatingPoint_onFloatStrict()
|
||||
floatingpoint "strict"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<FloatingPointModel>Strict</FloatingPointModel>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.floatingPoint_onDefault()
|
||||
floatingpoint "Default"
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
@@ -0,0 +1,258 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_fxcompile_settings.lua
|
||||
-- Validate FxCompile settings in Visual Studio 2010 C/C++ projects.
|
||||
-- Copyright (c) 2014 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs2010_fxcompile_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(platform)
|
||||
local cfg = test.getconfig(prj, "Debug", platform)
|
||||
vc2010.fxCompile(cfg)
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Check the basic element structure with default settings.
|
||||
-- Project should not generate this block if no hlsl files or no shader settings sets.
|
||||
---
|
||||
|
||||
function suite.empty()
|
||||
prepare()
|
||||
test.capture [[
|
||||
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.defaultSettings()
|
||||
files { "shader.hlsl" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
|
||||
]]
|
||||
end
|
||||
|
||||
---
|
||||
-- Test FxCompilePreprocessorDefinition
|
||||
---
|
||||
|
||||
function suite.onFxCompilePreprocessorDefinition()
|
||||
files { "shader.hlsl" }
|
||||
shaderdefines { "DEFINED_VALUE" }
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
<FxCompile>
|
||||
<PreprocessorDefinitions>DEFINED_VALUE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</FxCompile>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.onFxCompilePreprocessorDefinition_multipleDefines()
|
||||
files { "shader.hlsl" }
|
||||
shaderdefines { "DEFINED_VALUE", "OTHER_DEFINED_VALUE" }
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
<FxCompile>
|
||||
<PreprocessorDefinitions>DEFINED_VALUE;OTHER_DEFINED_VALUE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</FxCompile>
|
||||
]]
|
||||
end
|
||||
|
||||
---
|
||||
-- Test FxCompileAdditionalIncludeDirectories
|
||||
---
|
||||
|
||||
function suite.onFxCompileAdditionalIncludeDirectories()
|
||||
files { "shader.hlsl" }
|
||||
shaderincludedirs { "../includes" }
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
<FxCompile>
|
||||
<AdditionalIncludeDirectories>..\includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</FxCompile>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.onFxCompileAdditionalIncludeDirectories_multipleDefines()
|
||||
files { "shader.hlsl" }
|
||||
shaderincludedirs { "../includes", "otherpath/embedded" }
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
<FxCompile>
|
||||
<AdditionalIncludeDirectories>..\includes;otherpath\embedded;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</FxCompile>
|
||||
]]
|
||||
end
|
||||
|
||||
---
|
||||
-- Test FxCompileShaderType
|
||||
---
|
||||
|
||||
function suite.onFxCompileShaderType()
|
||||
files { "shader.hlsl" }
|
||||
shadertype "Effect"
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
<FxCompile>
|
||||
<ShaderType>Effect</ShaderType>
|
||||
</FxCompile>
|
||||
]]
|
||||
end
|
||||
|
||||
---
|
||||
-- Test FxCompileShaderModel
|
||||
---
|
||||
|
||||
function suite.onFxCompileShaderModel()
|
||||
files { "shader.hlsl" }
|
||||
shadermodel "5.0"
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
<FxCompile>
|
||||
<ShaderModel>5.0</ShaderModel>
|
||||
</FxCompile>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Test FxCompileShaderEntry
|
||||
---
|
||||
|
||||
function suite.onFxCompileShaderEntry()
|
||||
files { "shader.hlsl" }
|
||||
shaderentry "NewEntry"
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
<FxCompile>
|
||||
<EntryPointName>NewEntry</EntryPointName>
|
||||
</FxCompile>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Test FxCompileShaderVariableName
|
||||
---
|
||||
|
||||
function suite.onFxCompileShaderVariableName()
|
||||
files { "shader.hlsl" }
|
||||
shadervariablename "ShaderVar"
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
<FxCompile>
|
||||
<VariableName>ShaderVar</VariableName>
|
||||
</FxCompile>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Test FxCompileShaderHeaderOutput
|
||||
---
|
||||
|
||||
function suite.onFxCompileShaderHeaderOutput()
|
||||
files { "shader.hlsl" }
|
||||
shaderheaderfileoutput "%%(filename).hlsl.h"
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
<FxCompile>
|
||||
<HeaderFileOutput>%(filename).hlsl.h</HeaderFileOutput>
|
||||
</FxCompile>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Test FxCompileShaderObjectOutput
|
||||
---
|
||||
|
||||
function suite.onFxCompileShaderObjectOutput()
|
||||
files { "shader.hlsl" }
|
||||
shaderobjectfileoutput "%%(filename).hlsl.o"
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
<FxCompile>
|
||||
<ObjectFileOutput>%(filename).hlsl.o</ObjectFileOutput>
|
||||
</FxCompile>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Test FxCompileShaderAssembler
|
||||
---
|
||||
|
||||
function suite.onFxCompileShaderAssembler()
|
||||
files { "shader.hlsl" }
|
||||
shaderassembler "AssemblyCode"
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
<FxCompile>
|
||||
<AssemblerOutput>AssemblyCode</AssemblerOutput>
|
||||
</FxCompile>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Test FxCompileShaderAssemblerOutput
|
||||
---
|
||||
|
||||
function suite.onFxCompileShaderAssemblerOutput()
|
||||
files { "shader.hlsl" }
|
||||
shaderassembleroutput "%%(filename).hlsl.asm.o"
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
<FxCompile>
|
||||
<AssemblerOutputFile>%(filename).hlsl.asm.o</AssemblerOutputFile>
|
||||
</FxCompile>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Test FxCompileShaderAdditionalOptions
|
||||
---
|
||||
|
||||
function suite.onFxCompileShaderAdditionalOptions()
|
||||
files { "shader.hlsl" }
|
||||
shaderoptions "-opt"
|
||||
|
||||
prepare()
|
||||
test.capture [[
|
||||
<FxCompile>
|
||||
<AdditionalOptions>-opt %(AdditionalOptions)</AdditionalOptions>
|
||||
</FxCompile>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,445 @@
|
||||
--
|
||||
-- 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()
|
||||
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
|
||||
|
||||
function suite.windowsTargetPlatformVersionMissing_on2013()
|
||||
p.action.set("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()
|
||||
p.action.set("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()
|
||||
p.action.set("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
|
||||
|
||||
---
|
||||
-- Check handling of systemversion("latest")
|
||||
---
|
||||
|
||||
function suite.windowsTargetPlatformVersion_latest_on2015()
|
||||
p.action.set("vs2015")
|
||||
systemversion "latest"
|
||||
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_latest_on2017()
|
||||
p.action.set("vs2017")
|
||||
systemversion "latest"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
<LatestTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</LatestTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.canSetXPDeprecationWarningToFalse_withV141XP()
|
||||
toolset "v141_xp"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Globals">
|
||||
<XPDeprecationWarning>false</XPDeprecationWarning>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Globals">
|
||||
<XPDeprecationWarning>false</XPDeprecationWarning>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.canSetXPDeprecationWarningToFalse_perConfig_withV141XP()
|
||||
filter "Release"
|
||||
toolset "v141_xp"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Globals">
|
||||
<XPDeprecationWarning>false</XPDeprecationWarning>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.windowsTargetPlatformVersion_latest_on2019()
|
||||
p.action.set("vs2019")
|
||||
systemversion "latest"
|
||||
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</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- Check handling of per-configuration systemversion
|
||||
---
|
||||
|
||||
function suite.windowsTargetPlatformVersion_perConfig_on2015()
|
||||
p.action.set("vs2015")
|
||||
systemversion "8.1"
|
||||
filter "Debug"
|
||||
systemversion "10.0.10240.0"
|
||||
filter "Release"
|
||||
systemversion "10.0.10240.1"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Globals">
|
||||
<WindowsTargetPlatformVersion>10.0.10240.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Globals">
|
||||
<WindowsTargetPlatformVersion>10.0.10240.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.windowsTargetPlatformVersion_perConfig_on2017()
|
||||
p.action.set("vs2017")
|
||||
systemversion "8.1"
|
||||
filter "Debug"
|
||||
systemversion "latest"
|
||||
filter "Release"
|
||||
systemversion "10.0.10240.1"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
<LatestTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</LatestTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Globals">
|
||||
<WindowsTargetPlatformVersion>$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Globals">
|
||||
<WindowsTargetPlatformVersion>10.0.10240.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.disableFastUpToDateCheck()
|
||||
fastuptodate "Off"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.setToolsVersion2015()
|
||||
toolsversion "14.27.29110"
|
||||
p.action.set("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.setToolsVersion2017()
|
||||
toolsversion "14.27.29110"
|
||||
p.action.set("vs2017")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
<LatestTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</LatestTargetPlatformVersion>
|
||||
<VCToolsVersion>14.27.29110</VCToolsVersion>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,47 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_header.lua
|
||||
-- Validate generation of the project file header block.
|
||||
-- Copyright (c) 2011-2012 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vc2010_header")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
|
||||
|
||||
--
|
||||
-- If a default build target is specified, it should be included in the
|
||||
-- generated Project element.
|
||||
--
|
||||
|
||||
function suite.project_on2010()
|
||||
p.action.set("vs2010")
|
||||
vc2010.project()
|
||||
test.capture [[
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.project_on2011()
|
||||
p.action.set("vs2012")
|
||||
vc2010.project()
|
||||
test.capture [[
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.project_on2013()
|
||||
p.action.set("vs2013")
|
||||
vc2010.project()
|
||||
test.capture [[
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.project_on2019()
|
||||
p.action.set("vs2019")
|
||||
vc2010.project()
|
||||
test.capture [[
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,98 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_item_def_group.lua
|
||||
-- Check the item definition groups, containing compile and link flags.
|
||||
-- Copyright (c) 2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs2010_item_def_group")
|
||||
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(buildcfg)
|
||||
local cfg = test.getconfig(prj, buildcfg or "Debug")
|
||||
vc2010.itemDefinitionGroup(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check generation of opening element for typical C++ project.
|
||||
--
|
||||
|
||||
function suite.structureIsCorrect_onDefaultValues()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Makefile projects omit the condition and all contents.
|
||||
--
|
||||
|
||||
function suite.structureIsCorrect_onMakefile()
|
||||
kind "Makefile"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemDefinitionGroup>
|
||||
</ItemDefinitionGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.structureIsCorrect_onNone()
|
||||
kind "Makefile"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemDefinitionGroup>
|
||||
</ItemDefinitionGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Because the item definition group for makefile projects is not
|
||||
-- tied to a particular condition, it should only get written for
|
||||
-- the first configuration.
|
||||
--
|
||||
|
||||
function suite.skipped_onSubsequentConfigs()
|
||||
kind "Makefile"
|
||||
prepare("Release")
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
function suite.skipped_onSubsequentConfigs_onNone()
|
||||
kind "None"
|
||||
prepare("Release")
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
--
|
||||
-- Utility projects include buildlog
|
||||
--
|
||||
function suite.utilityIncludesPath()
|
||||
kind "Utility"
|
||||
buildlog "MyCustomLogFile.log"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<BuildLog>
|
||||
<Path>MyCustomLogFile.log</Path>
|
||||
</BuildLog>
|
||||
</ItemDefinitionGroup>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,41 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_language_settings.lua
|
||||
-- Check the import language settings block of a VS 2010 project.
|
||||
-- Copyright (c) 2014 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs2010_language_settings")
|
||||
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.importLanguageSettings(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Writes language settings.
|
||||
--
|
||||
|
||||
function suite.structureIsCorrect()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,41 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_language_targets.lua
|
||||
-- Check the import language targets block of a VS 2010 project.
|
||||
-- Copyright (c) 2014 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs2010_language_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.importLanguageTargets(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Writes language targets.
|
||||
--
|
||||
|
||||
function suite.structureIsCorrect()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
]]
|
||||
end
|
||||
740
Src/external_dependencies/openmpt-trunk/include/premake/modules/vstudio/tests/vc2010/test_link.lua
vendored
Normal file
740
Src/external_dependencies/openmpt-trunk/include/premake/modules/vstudio/tests/vc2010/test_link.lua
vendored
Normal file
@@ -0,0 +1,740 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_link.lua
|
||||
-- Validate linking and project references 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_link")
|
||||
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 "SharedLib"
|
||||
end
|
||||
|
||||
local function prepare(platform)
|
||||
local cfg = test.getconfig(prj, "Debug", platform)
|
||||
vc2010.linker(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the basic element structure with default settings.
|
||||
--
|
||||
|
||||
function suite.defaultSettings()
|
||||
kind "SharedLib"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
|
||||
</Link>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the basic element structure with a release build.
|
||||
--
|
||||
|
||||
function suite.defaultSettings_onOptimize()
|
||||
optimize "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
|
||||
</Link>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check subsystem values with each project kind.
|
||||
--
|
||||
|
||||
function suite.subsystem_onConsoleApp()
|
||||
kind "ConsoleApp"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.subsystem_onWindowedApp()
|
||||
kind "WindowedApp"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.subsystem_onSharedLib()
|
||||
kind "SharedLib"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
|
||||
</Link>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.subsystem_onStaticLib()
|
||||
kind "StaticLib"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Test the handling of the entrypoint API.
|
||||
--
|
||||
function suite.onEntryPoint()
|
||||
kind "ConsoleApp"
|
||||
entrypoint "foobar"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EntryPointSymbol>foobar</EntryPointSymbol>
|
||||
</Link>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Test the handling of the NoImplicitLink flag.
|
||||
--
|
||||
|
||||
function suite.linkDependencies_onNoImplicitLink()
|
||||
flags "NoImplicitLink"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>false</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Test the handling of the Symbols flag.
|
||||
--
|
||||
|
||||
function suite.generateDebugInfo_onSymbolsOn_on2010()
|
||||
p.action.set("vs2010")
|
||||
symbols "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.generateDebugInfo_onSymbolsFastLink_on2010()
|
||||
p.action.set("vs2010")
|
||||
symbols "FastLink"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.generateDebugInfo_onSymbolsFull_on2010()
|
||||
p.action.set("vs2010")
|
||||
symbols "Full"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.generateDebugInfo_onSymbolsOn_on2015()
|
||||
p.action.set("vs2015")
|
||||
symbols "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.generateDebugInfo_onSymbolsFastLink_on2015()
|
||||
p.action.set("vs2015")
|
||||
symbols "FastLink"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<FullProgramDatabaseFile>true</FullProgramDatabaseFile>
|
||||
<GenerateDebugInformation>DebugFastLink</GenerateDebugInformation>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.generateDebugInfo_onSymbolsFull_on2015()
|
||||
p.action.set("vs2015")
|
||||
symbols "Full"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.generateDebugInfo_onSymbolsFull_on2017()
|
||||
p.action.set("vs2017")
|
||||
symbols "Full"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.generateDebugInfo_onSymbolsFull_on2019()
|
||||
p.action.set("vs2019")
|
||||
symbols "Full"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
|
||||
]]
|
||||
end
|
||||
--
|
||||
-- Test the handling of the SymbolsPath flag.
|
||||
--
|
||||
|
||||
function suite.generateProgramDataBaseFile_onStaticLib()
|
||||
kind "StaticLib"
|
||||
|
||||
symbols "On"
|
||||
symbolspath "$(IntDir)$(TargetName).pdb"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.generateProgramDataBaseFile_onSharedLib()
|
||||
kind "SharedLib"
|
||||
|
||||
symbols "On"
|
||||
symbolspath "$(IntDir)$(TargetName).pdb"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
</Link>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.generateProgramDatabaseFile_onSymbolsOn_on2010()
|
||||
p.action.set("vs2010")
|
||||
symbols "On"
|
||||
symbolspath "$(IntDir)$(TargetName).pdb"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
</Link>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.generateProgramDatabaseFile_onSymbolsFastLink_on2010()
|
||||
p.action.set("vs2010")
|
||||
symbols "Off"
|
||||
symbolspath "$(IntDir)$(TargetName).pdb"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
|
||||
</Link>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.generateProgramDatabaseFile_onSymbolsFull_on2010()
|
||||
p.action.set("vs2010")
|
||||
symbols "Full"
|
||||
symbolspath "$(IntDir)$(TargetName).pdb"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
</Link>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.generateProgramDatabaseFile_onSymbolsOn_on2015()
|
||||
p.action.set("vs2015")
|
||||
symbols "On"
|
||||
symbolspath "$(IntDir)$(TargetName).pdb"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
</Link>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.generateProgramDatabaseFile_onSymbolsFastLink_on2015()
|
||||
p.action.set("vs2015")
|
||||
symbols "FastLink"
|
||||
symbolspath "$(IntDir)$(TargetName).pdb"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<FullProgramDatabaseFile>true</FullProgramDatabaseFile>
|
||||
<GenerateDebugInformation>DebugFastLink</GenerateDebugInformation>
|
||||
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
</Link>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.generateProgramDatabaseFile_onSymbolsFull_on2015()
|
||||
p.action.set("vs2015")
|
||||
symbols "Full"
|
||||
symbolspath "$(IntDir)$(TargetName).pdb"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
</Link>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.generateProgramDatabaseFile_onSymbolsFull_on2017()
|
||||
p.action.set("vs2017")
|
||||
symbols "Full"
|
||||
symbolspath "$(IntDir)$(TargetName).pdb"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
|
||||
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
</Link>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.generateProgramDatabaseFile_onSymbolsFull_on2019()
|
||||
p.action.set("vs2019")
|
||||
symbols "Full"
|
||||
symbolspath "$(IntDir)$(TargetName).pdb"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
|
||||
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
</Link>
|
||||
]]
|
||||
end
|
||||
--
|
||||
-- Any system libraries specified in links() should be listed as
|
||||
-- additional dependencies.
|
||||
--
|
||||
|
||||
function suite.additionalDependencies_onSystemLinks()
|
||||
links { "lua", "zlib" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalDependencies>lua.lib;zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.additionalDependencies_onSystemLinksStatic()
|
||||
kind "StaticLib"
|
||||
links { "lua", "zlib" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
<Lib>
|
||||
<AdditionalDependencies>lua.lib;zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Lib>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Any system libraries specified in links() with valid extensions should
|
||||
-- be listed with those extensions.
|
||||
--
|
||||
|
||||
function suite.additionalDependencies_onSystemLinksExtensions()
|
||||
links { "lua.obj", "zlib.lib" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalDependencies>lua.obj;zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.additionalDependencies_onSystemLinksExtensionsStatic()
|
||||
kind "StaticLib"
|
||||
links { "lua.obj", "zlib.lib" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
<Lib>
|
||||
<AdditionalDependencies>lua.obj;zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Lib>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Any system libraries specified in links() with multiple dots should
|
||||
-- only have .lib appended to the end when no valid extension is found
|
||||
--
|
||||
|
||||
function suite.additionalDependencies_onSystemLinksExtensionsMultipleDots()
|
||||
links { "lua.5.3.lib", "lua.5.4" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalDependencies>lua.5.3.lib;lua.5.4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.additionalDependencies_onSystemLinksExtensionsMultipleDotsStatic()
|
||||
kind "StaticLib"
|
||||
links { "lua.5.3.lib", "lua.5.4" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
<Lib>
|
||||
<AdditionalDependencies>lua.5.3.lib;lua.5.4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Lib>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Additional library directories should be specified, relative to the project.
|
||||
--
|
||||
|
||||
function suite.additionalLibraryDirectories_onLibDirs()
|
||||
libdirs { "../lib", "../lib64" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalLibraryDirectories>..\lib;..\lib64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Sibling projects do not need to be listed in additional dependencies, as Visual
|
||||
-- Studio will link them implicitly.
|
||||
--
|
||||
|
||||
function suite.excludeSiblings()
|
||||
links { "MyProject2" }
|
||||
test.createproject(wks)
|
||||
kind "SharedLib"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
|
||||
</Link>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If the NoImplicitLink flag is set, all dependencies should be listed explicitly.
|
||||
--
|
||||
|
||||
function suite.includeSiblings_onNoImplicitLink()
|
||||
flags { "NoImplicitLink" }
|
||||
links { "MyProject2" }
|
||||
test.createproject(wks)
|
||||
kind "SharedLib"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalDependencies>bin\Debug\MyProject2.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>false</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Static libraries do not link dependencies directly, to maintain
|
||||
-- compatibility with GCC and others.
|
||||
--
|
||||
|
||||
function suite.additionalDependencies_onSystemLinksAndStaticLib()
|
||||
kind "StaticLib"
|
||||
links { "lua", "zlib" }
|
||||
libdirs { "../lib", "../lib64" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of the import library settings.
|
||||
--
|
||||
|
||||
function suite.importLibrary_onImpLibDir()
|
||||
implibdir "../lib"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<ImportLibrary>..\lib\MyProject.lib</ImportLibrary>
|
||||
</Link>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Check handling of additional options.
|
||||
--
|
||||
|
||||
function suite.additionalOptions_onNonStaticLib()
|
||||
kind "SharedLib"
|
||||
linkoptions { "/kupo" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
|
||||
<AdditionalOptions>/kupo %(AdditionalOptions)</AdditionalOptions>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.additionalOptions_onStaticLib()
|
||||
kind "StaticLib"
|
||||
linkoptions { "/kupo" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
<Lib>
|
||||
<AdditionalOptions>/kupo %(AdditionalOptions)</AdditionalOptions>
|
||||
</Lib>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Enable reference optimizing if Optimize flag is specified.
|
||||
--
|
||||
|
||||
function suite.optimizeReferences_onOptimizeFlag()
|
||||
optimize "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Correctly handle module definition (.def) files.
|
||||
--
|
||||
|
||||
function suite.recognizesModuleDefinitionFile()
|
||||
files { "hello.cpp", "hello.def" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
|
||||
<ModuleDefinitionFile>hello.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Managed assembly references should not be listed in additional dependencies.
|
||||
--
|
||||
|
||||
function suite.ignoresAssemblyReferences()
|
||||
links { "kernel32", "System.dll", "System.Data.dll" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalDependencies>kernel32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check handling of warning flags.
|
||||
--
|
||||
|
||||
function suite.fatalWarnings_onDynamicLink()
|
||||
kind "ConsoleApp"
|
||||
flags { "FatalLinkWarnings" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.fatalWarnings_onStaticLink()
|
||||
kind "StaticLib"
|
||||
flags { "FatalLinkWarnings" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
<Lib>
|
||||
<TreatLibWarningAsErrors>true</TreatLibWarningAsErrors>
|
||||
</Lib>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Test generating .map files.
|
||||
--
|
||||
|
||||
function suite.generateMapFile_onMapsFlag()
|
||||
flags { "Maps" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
|
||||
<GenerateMapFile>true</GenerateMapFile>
|
||||
</Link>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Test ignoring default libraries with extensions specified.
|
||||
--
|
||||
|
||||
function suite.ignoreDefaultLibraries_WithExtensions()
|
||||
ignoredefaultlibraries { "lib1.lib", "lib2.obj" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
|
||||
<IgnoreSpecificDefaultLibraries>lib1.lib;lib2.obj</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Test ignoring default libraries without extensions specified.
|
||||
--
|
||||
|
||||
function suite.ignoreDefaultLibraries_WithoutExtensions()
|
||||
ignoredefaultlibraries { "lib1", "lib2.obj" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
|
||||
<IgnoreSpecificDefaultLibraries>lib1.lib;lib2.obj</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Test ignoring default libraries with extensions specified.
|
||||
--
|
||||
|
||||
function suite.assemblyDebug()
|
||||
assemblydebug "true"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
|
||||
<AssemblyDebug>true</AssemblyDebug>
|
||||
</Link>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,88 @@
|
||||
--
|
||||
-- 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
|
||||
|
||||
--
|
||||
-- Check that DPI Awareness emits correctly
|
||||
--
|
||||
|
||||
function suite.dpiAwareness_None()
|
||||
dpiawareness "None"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Manifest>
|
||||
<EnableDpiAwareness>false</EnableDpiAwareness>
|
||||
</Manifest>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.dpiAwareness_High()
|
||||
dpiawareness "High"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Manifest>
|
||||
<EnableDpiAwareness>true</EnableDpiAwareness>
|
||||
</Manifest>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.dpiAwareness_HighPerMonitor()
|
||||
dpiawareness "HighPerMonitor"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Manifest>
|
||||
<EnableDpiAwareness>PerMonitorHighDPIAware</EnableDpiAwareness>
|
||||
</Manifest>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,225 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_nmake_props.lua
|
||||
-- Check makefile project generation.
|
||||
-- Copyright (c) 2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs2010_nmake_props")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
wks, prj = test.createWorkspace()
|
||||
kind "Makefile"
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
vc2010.nmakeProperties(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the structure with the default project values.
|
||||
--
|
||||
|
||||
function suite.structureIsCorrect_onDefaultValues()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<NMakeOutput>$(OutDir)MyProject</NMakeOutput>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Element should be skipped for non-Makefile projects.
|
||||
--
|
||||
|
||||
function suite.skips_onNonMakefile()
|
||||
kind "ConsoleApp"
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Make sure the target file extension is included.
|
||||
--
|
||||
|
||||
function suite.usesTargetExtension()
|
||||
targetextension ".exe"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<NMakeOutput>$(OutDir)MyProject.exe</NMakeOutput>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Verify generation of the build commands.
|
||||
--
|
||||
|
||||
function suite.buildCommandLine_onSingleCommand()
|
||||
buildcommands { "command 1" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<NMakeOutput>$(OutDir)MyProject</NMakeOutput>
|
||||
<NMakeBuildCommandLine>command 1</NMakeBuildCommandLine>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.buildCommandLine_onMultipleCommands()
|
||||
buildcommands { "command 1", "command 2" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<NMakeOutput>$(OutDir)MyProject</NMakeOutput>
|
||||
<NMakeBuildCommandLine>command 1
|
||||
command 2</NMakeBuildCommandLine>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.rebuildCommandLine()
|
||||
rebuildcommands { "command 1" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<NMakeOutput>$(OutDir)MyProject</NMakeOutput>
|
||||
<NMakeReBuildCommandLine>command 1</NMakeReBuildCommandLine>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.cleanCommandLine()
|
||||
cleancommands { "command 1" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<NMakeOutput>$(OutDir)MyProject</NMakeOutput>
|
||||
<NMakeCleanCommandLine>command 1</NMakeCleanCommandLine>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onDefines()
|
||||
defines { "DEBUG", "_DEBUG" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<NMakeOutput>$(OutDir)MyProject</NMakeOutput>
|
||||
<NMakePreprocessorDefinitions>DEBUG;_DEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onEscapedDefines()
|
||||
p.escaper(p.vstudio.vs2010.esc)
|
||||
defines { "&", "<", ">" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<NMakeOutput>$(OutDir)MyProject</NMakeOutput>
|
||||
<NMakePreprocessorDefinitions>&;<;>;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
p.escaper(nil)
|
||||
end
|
||||
|
||||
function suite.onIncludeDirs()
|
||||
includedirs { "include/lua", "include/zlib" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<NMakeOutput>$(OutDir)MyProject</NMakeOutput>
|
||||
<NMakeIncludeSearchPath>include\lua;include\zlib</NMakeIncludeSearchPath>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onBinDirs()
|
||||
bindirs { "include/lua", "include/zlib" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ExecutablePath>$(ProjectDir)include\lua;$(ProjectDir)include\zlib;$(ExecutablePath)</ExecutablePath>
|
||||
<NMakeOutput>$(OutDir)MyProject</NMakeOutput>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onSysIncludeDirs()
|
||||
sysincludedirs { "include/lua", "include/zlib" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>include\lua;include\zlib;$(IncludePath)</IncludePath>
|
||||
<NMakeOutput>$(OutDir)MyProject</NMakeOutput>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onSysLibDirs()
|
||||
syslibdirs { "include/lua", "include/zlib" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LibraryPath>include\lua;include\zlib;$(LibraryPath)</LibraryPath>
|
||||
<NMakeOutput>$(OutDir)MyProject</NMakeOutput>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onCppDialect()
|
||||
cppdialect "C++14"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<NMakeOutput>$(OutDir)MyProject</NMakeOutput>
|
||||
<AdditionalOptions>/std:c++14 %(AdditionalOptions)</AdditionalOptions>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onBuildOptions()
|
||||
buildoptions { "testing" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<NMakeOutput>$(OutDir)MyProject</NMakeOutput>
|
||||
<AdditionalOptions>testing %(AdditionalOptions)</AdditionalOptions>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Should not emit include dirs or preprocessor definitions if the project
|
||||
-- kind is "None", since that project is by definition not buildable.
|
||||
---
|
||||
|
||||
function suite.noIncludeDirsOrPreprocessorDefs_onKindNone()
|
||||
kind "None"
|
||||
defines { "DEBUG", "_DEBUG" }
|
||||
includedirs { "include/lua", "include/zlib" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<NMakeOutput>$(OutDir)MyProject</NMakeOutput>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,71 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vs2010/test_nuget_package_references.lua
|
||||
-- Validate generation of NuGet packages references for Visual Studio 2017 and newer.
|
||||
-- Copyright (c) 2012-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs2010_nuget_package_references")
|
||||
local cs2005 = p.vstudio.cs2005
|
||||
local nuget2010 = p.vstudio.nuget2010
|
||||
local dotnetbase = p.vstudio.dotnetbase
|
||||
|
||||
--
|
||||
-- Setup and teardown
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2017")
|
||||
wks = test.createWorkspace()
|
||||
configurations {'Debug','Release'}
|
||||
language "C#"
|
||||
end
|
||||
|
||||
local function prepare(platform)
|
||||
prj = test.getproject(wks, 1)
|
||||
dotnetbase.packageReferences(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Should not output anything if no packages have been set.
|
||||
--
|
||||
|
||||
function suite.noOutputIfNoPackages()
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Writes the packages.config file properly.
|
||||
--
|
||||
|
||||
function suite.structureIsCorrect()
|
||||
nuget { "Newtonsoft.Json:10.0.2", "NUnit:3.6.1", "SSH.NET:2016.0.0" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="10.0.2"/>
|
||||
<PackageReference Include="NUnit" Version="3.6.1"/>
|
||||
<PackageReference Include="SSH.NET" Version="2016.0.0"/>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.configStructureIsCorrect()
|
||||
nuget { "NUnit:3.6.1", "SSH.NET:2016.0.0" }
|
||||
filter { "configurations:Debug" }
|
||||
nuget { "Newtonsoft.Json:10.0.2" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NUnit" Version="3.6.1"/>
|
||||
<PackageReference Include="SSH.NET" Version="2016.0.0"/>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="10.0.2" Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "/>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,57 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_nuget_packages_config.lua
|
||||
-- Validate generation of NuGet packages.config file for Visual Studio 2010 and newer.
|
||||
-- Copyright (c) 2017 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs2010_nuget_packages_config")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
local nuget2010 = p.vstudio.nuget2010
|
||||
local project = p.project
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
wks = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local prj = p.workspace.getproject(wks, 1)
|
||||
nuget2010.generatePackagesConfig(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Should not output anything if no packages have been set.
|
||||
--
|
||||
|
||||
function suite.noOutputIfNoPackages()
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Writes the packages.config file properly.
|
||||
--
|
||||
|
||||
function suite.structureIsCorrect()
|
||||
nuget { "boost:1.59.0-b1", "sdl2.v140:2.0.3", "sdl2.v140.redist:2.0.3" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="boost" version="1.59.0-b1" targetFramework="native" />
|
||||
<package id="sdl2.v140" version="2.0.3" targetFramework="native" />
|
||||
<package id="sdl2.v140.redist" version="2.0.3" targetFramework="native" />
|
||||
</packages>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,287 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_output_props.lua
|
||||
-- Validate generation of the output property groups.
|
||||
-- Copyright (c) 2011-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs2010_output_props")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
vc2010.outputProperties(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the structure with the default project values.
|
||||
--
|
||||
|
||||
function suite.structureIsCorrect_onDefaultValues()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>bin\Debug\</OutDir>
|
||||
<IntDir>obj\Debug\</IntDir>
|
||||
<TargetName>MyProject</TargetName>
|
||||
<TargetExt>.exe</TargetExt>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- This entire block gets skipped for Makefile projects.
|
||||
--
|
||||
|
||||
function suite.omitsBlock_onMakefile()
|
||||
kind "Makefile"
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
function suite.omitsBlock_onNone()
|
||||
kind "Makefile"
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
--
|
||||
-- Static libraries should omit the link incremental element entirely.
|
||||
--
|
||||
|
||||
function suite.omitLinkIncremental_onStaticLib()
|
||||
kind "StaticLib"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>bin\Debug\</OutDir>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Optimized builds should not link incrementally.
|
||||
--
|
||||
|
||||
function suite.noIncrementalLink_onOptimizedBuild()
|
||||
optimize "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- The target directory is applied, if specified.
|
||||
--
|
||||
|
||||
function suite.outDir_onTargetDir()
|
||||
targetdir "../bin"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>..\bin\</OutDir>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- The objeccts directory is applied, if specified.
|
||||
--
|
||||
|
||||
function suite.intDir_onTargetDir()
|
||||
objdir "../tmp"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>bin\Debug\</OutDir>
|
||||
<IntDir>..\tmp\Debug\</IntDir>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- The target name is applied, if specified.
|
||||
--
|
||||
|
||||
function suite.targetName_onTargetName()
|
||||
targetname "MyTarget"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>bin\Debug\</OutDir>
|
||||
<IntDir>obj\Debug\</IntDir>
|
||||
<TargetName>MyTarget</TargetName>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- If the NoImportLib flag is set, add the IgnoreImportLibrary element.
|
||||
--
|
||||
|
||||
function suite.ignoreImportLib_onNoImportLib()
|
||||
kind "SharedLib"
|
||||
flags "NoImportLib"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IgnoreImportLibrary>true</IgnoreImportLibrary>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.omitIgnoreImportLib_onNonSharedLib()
|
||||
kind "ConsoleApp"
|
||||
flags "NoImportLib"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>bin\Debug\</OutDir>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If the NoManifest flag is set, add the GenerateManifest element.
|
||||
--
|
||||
|
||||
function suite.generateManifest_onNoManifest()
|
||||
flags "NoManifest"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>bin\Debug\</OutDir>
|
||||
<IntDir>obj\Debug\</IntDir>
|
||||
<TargetName>MyProject</TargetName>
|
||||
<TargetExt>.exe</TargetExt>
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
---
|
||||
-- The <TargetExt> should be split if there is no extension.
|
||||
---
|
||||
|
||||
function suite.splitTargetExt_onNoTargetExtension()
|
||||
targetextension ""
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>bin\Debug\</OutDir>
|
||||
<IntDir>obj\Debug\</IntDir>
|
||||
<TargetName>MyProject</TargetName>
|
||||
<TargetExt>
|
||||
</TargetExt>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Check the handling of extra cleaning extensions.
|
||||
--
|
||||
|
||||
function suite.extensionsToDeleteOnClean()
|
||||
cleanextensions { ".temp1", ".temp2" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>bin\Debug\</OutDir>
|
||||
<IntDir>obj\Debug\</IntDir>
|
||||
<TargetName>MyProject</TargetName>
|
||||
<TargetExt>.exe</TargetExt>
|
||||
<ExtensionsToDeleteOnClean>*.temp1;*.temp2;$(ExtensionsToDeleteOnClean)</ExtensionsToDeleteOnClean>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the handling of the VC++ Directories.
|
||||
--
|
||||
|
||||
function suite.onSystemIncludeDirs()
|
||||
sysincludedirs { "$(DXSDK_DIR)/Include" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>bin\Debug\</OutDir>
|
||||
<IntDir>obj\Debug\</IntDir>
|
||||
<TargetName>MyProject</TargetName>
|
||||
<TargetExt>.exe</TargetExt>
|
||||
<IncludePath>$(DXSDK_DIR)\Include;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onSystemLibraryDirs()
|
||||
syslibdirs { "$(DXSDK_DIR)/lib/x86" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>bin\Debug\</OutDir>
|
||||
<IntDir>obj\Debug\</IntDir>
|
||||
<TargetName>MyProject</TargetName>
|
||||
<TargetExt>.exe</TargetExt>
|
||||
<LibraryPath>$(DXSDK_DIR)\lib\x86;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check the handling of the VC++ ExecutablePath.
|
||||
--
|
||||
|
||||
function suite.onBinDirsRelative()
|
||||
bindirs { "../Include" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>bin\Debug\</OutDir>
|
||||
<IntDir>obj\Debug\</IntDir>
|
||||
<TargetName>MyProject</TargetName>
|
||||
<TargetExt>.exe</TargetExt>
|
||||
<ExecutablePath>$(ProjectDir)..\Include;$(ExecutablePath)</ExecutablePath>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onBinDirsAbsolute()
|
||||
bindirs { "C:\\Include" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>bin\Debug\</OutDir>
|
||||
<IntDir>obj\Debug\</IntDir>
|
||||
<TargetName>MyProject</TargetName>
|
||||
<TargetExt>.exe</TargetExt>
|
||||
<ExecutablePath>C:\Include;$(ExecutablePath)</ExecutablePath>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,124 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_platform_toolset.lua
|
||||
-- Validate VC platform toolset generation.
|
||||
-- Copyright (c) 2013-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs2010_platform_toolset")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2012")
|
||||
wks, prj = test.createWorkspace()
|
||||
files "hello.cpp"
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
cfg = test.getconfig(prj, "Debug")
|
||||
vc2010.platformToolset(cfg)
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Check default values for each version.
|
||||
--
|
||||
|
||||
function suite.correctDefault_onVS2010()
|
||||
p.action.set("vs2010")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PlatformToolset>v100</PlatformToolset>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.correctDefault_onVS2012()
|
||||
p.action.set("vs2012")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.correctDefault_onVS2013()
|
||||
p.action.set("vs2013")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check for overrides from project scripts.
|
||||
--
|
||||
|
||||
function suite.canOverrideFromScript_withV()
|
||||
toolset "v90"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PlatformToolset>v90</PlatformToolset>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.canOverrideFromScript_withMsc()
|
||||
toolset "msc-100"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PlatformToolset>v100</PlatformToolset>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.canOverrideFromScript_withXP()
|
||||
toolset "v120_xp"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.canOverrideFromScript_withLLVM()
|
||||
toolset "msc-llvm-vs2014_xp"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PlatformToolset>LLVM-vs2014_xp</PlatformToolset>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check if platform toolset element is being emitted correctly.
|
||||
--
|
||||
|
||||
function suite.output_onConsoleAppAndNoCpp()
|
||||
kind "ConsoleApp"
|
||||
removefiles "hello.cpp"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.skipped_onNoMakefileAndNoCpp()
|
||||
kind "Makefile"
|
||||
removefiles "hello.cpp"
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
function suite.output_onNoMakefileAndCpp()
|
||||
kind "Makefile"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +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
|
||||
@@ -0,0 +1,116 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_project_refs.lua
|
||||
-- Validate project references in Visual Studio 2010 C/C++ projects.
|
||||
-- Copyright (c) 2011-2012 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs2010_project_refs")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
wks = test.createWorkspace()
|
||||
uuid "00112233-4455-6677-8888-99AABBCCDDEE"
|
||||
test.createproject(wks)
|
||||
end
|
||||
|
||||
local function prepare(platform)
|
||||
prj = test.getproject(wks, 2)
|
||||
vc2010.projectReferences(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If there are no sibling projects listed in links(), then the
|
||||
-- entire project references item group should be skipped.
|
||||
--
|
||||
|
||||
function suite.noProjectReferencesGroup_onNoSiblingReferences()
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
--
|
||||
-- If a sibling project is listed in links(), an item group should
|
||||
-- be written with a reference to that sibling project.
|
||||
--
|
||||
|
||||
function suite.projectReferenceAdded_onSiblingProjectLink()
|
||||
links { "MyProject" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="MyProject.vcxproj">
|
||||
<Project>{00112233-4455-6677-8888-99AABBCCDDEE}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Project references should always be specified relative to the
|
||||
-- project doing the referencing.
|
||||
--
|
||||
|
||||
function suite.referencesAreRelative_onDifferentProjectLocation()
|
||||
links { "MyProject" }
|
||||
location "build/MyProject2"
|
||||
project("MyProject")
|
||||
location "build/MyProject"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MyProject\MyProject.vcxproj">
|
||||
<Project>{00112233-4455-6677-8888-99AABBCCDDEE}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Managed C++ projects write out references a little differently.
|
||||
--
|
||||
|
||||
function suite.referencesAreRelative_onDifferentProjectLocationWithCLR()
|
||||
links { "MyProject" }
|
||||
clr "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="MyProject.vcxproj">
|
||||
<Project>{00112233-4455-6677-8888-99AABBCCDDEE}</Project>
|
||||
<Private>true</Private>
|
||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Shared items projects are referenced differently
|
||||
--
|
||||
|
||||
function suite.sharedItemsProjects()
|
||||
links { "MyProject" }
|
||||
project("MyProject")
|
||||
kind "SharedItems"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ImportGroup Label="Shared">
|
||||
<Import Project="MyProject.vcxitems" Label="Shared" />
|
||||
</ImportGroup>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,41 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_prop_sheet.lua
|
||||
-- Validate generation of the property sheet import groups.
|
||||
-- Copyright (c) 2011-2012 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs2010_prop_sheet")
|
||||
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.propertySheets(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the structure with the default project values.
|
||||
--
|
||||
|
||||
function suite.structureIsCorrect_onDefaultValues()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,105 @@
|
||||
--
|
||||
-- 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
|
||||
|
||||
--
|
||||
-- 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
|
||||
@@ -0,0 +1,70 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/vstudio_vs2010_rule_props.lua
|
||||
-- Validate generation of custom rules
|
||||
-- Author Tom van Dijck
|
||||
-- Copyright (c) 2016 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs2010_rule_props")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
local m = p.vstudio.vs2010.rules.props
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
rule 'example'
|
||||
display 'Example compiler'
|
||||
fileExtension '.example'
|
||||
|
||||
propertydefinition {
|
||||
name = "output_path",
|
||||
kind = "string",
|
||||
display = "Output Path",
|
||||
description = "",
|
||||
}
|
||||
|
||||
buildmessage 'Compiling %{file.basename} with example-compiler...'
|
||||
buildcommands {
|
||||
'package-example-compiler.exe %{output_path} "%{file.relpath}"'
|
||||
}
|
||||
buildoutputs {
|
||||
'%{output_path}%{file.basename}.example.cc',
|
||||
'%{output_path}%{file.basename}.example.h'
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- commandLineTemplates
|
||||
--
|
||||
|
||||
function suite.commandLineTemplates()
|
||||
local r = test.getRule("example")
|
||||
m.commandLineTemplates(r)
|
||||
|
||||
test.capture [[
|
||||
<CommandLineTemplate>package-example-compiler.exe [output_path] "%(Identity)"</CommandLineTemplate>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- executionDescription
|
||||
--
|
||||
|
||||
function suite.executionDescription()
|
||||
local r = test.getRule("example")
|
||||
m.executionDescription(r)
|
||||
|
||||
test.capture [[
|
||||
<ExecutionDescription>Compiling %(Filename) with example-compiler...</ExecutionDescription>
|
||||
]]
|
||||
end
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/vstudio_vs2010_rule_targets.lua
|
||||
-- Validate generation of custom rules
|
||||
-- Author Tom van Dijck
|
||||
-- Copyright (c) 2016 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs2010_rule_targets")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
local m = p.vstudio.vs2010.rules.targets
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
rule 'example'
|
||||
display 'Example compiler'
|
||||
fileExtension '.example'
|
||||
|
||||
propertydefinition {
|
||||
name = "output_path",
|
||||
kind = "string",
|
||||
display = "Output Path",
|
||||
description = "",
|
||||
}
|
||||
|
||||
buildmessage 'Compiling %{file.basename} with example-compiler...'
|
||||
buildcommands {
|
||||
'package-example-compiler.exe %{output_path} "%{file.relpath}"'
|
||||
}
|
||||
buildoutputs {
|
||||
'%{output_path}%{file.basename}.example.cc',
|
||||
'%{output_path}%{file.basename}.example.h'
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- availableItemName
|
||||
--
|
||||
|
||||
function suite.availableItemName()
|
||||
local r = test.getRule("example")
|
||||
m.availableItemName(r)
|
||||
|
||||
test.capture [[
|
||||
<AvailableItemName Include="example">
|
||||
<Targets>_example</Targets>
|
||||
</AvailableItemName>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- computedProperties
|
||||
--
|
||||
|
||||
function suite.computedProperties()
|
||||
local r = test.getRule("example")
|
||||
m.computedProperties(r)
|
||||
|
||||
test.capture [[
|
||||
<ItemDefinitionGroup>
|
||||
<example>
|
||||
<Outputs>%(output_path)%(Filename).example.cc;%(output_path)%(Filename).example.h</Outputs>
|
||||
</example>
|
||||
</ItemDefinitionGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- usingTask
|
||||
--
|
||||
|
||||
function suite.usingTask()
|
||||
local r = test.getRule("example")
|
||||
m.usingTask(r)
|
||||
|
||||
test.capture [[
|
||||
<UsingTask
|
||||
TaskName="example"
|
||||
TaskFactory="XamlTaskFactory"
|
||||
AssemblyName="Microsoft.Build.Tasks.v4.0">
|
||||
<Task>$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml</Task>
|
||||
</UsingTask>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,135 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_rule_vars.lua
|
||||
-- Validate generation of custom rule variables at the project level.
|
||||
-- Author Jason Perkins
|
||||
-- Copyright (c) 2014-2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs2010_rule_vars")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
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
|
||||
|
||||
local function prepare()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
vc2010.ruleVars(cfg)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If the configuration has a rule, but does not set any variables,
|
||||
-- nothing should be written.
|
||||
--
|
||||
|
||||
function suite.noOutput_onNoVars()
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Test setting the various property kinds.
|
||||
--
|
||||
|
||||
function suite.onBooleanVar()
|
||||
createVar { name="MyVar", kind="boolean" }
|
||||
myRuleVars { MyVar = false }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<MyRule>
|
||||
<MyVar>false</MyVar>
|
||||
</MyRule>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.onEnumVar()
|
||||
createVar {
|
||||
name = "MyVar",
|
||||
values = {
|
||||
[0] = "Win32",
|
||||
[1] = "Win64",
|
||||
},
|
||||
switch = {
|
||||
[0] = "-m32",
|
||||
[1] = "-m64",
|
||||
},
|
||||
value = 0,
|
||||
}
|
||||
myRuleVars { MyVar = "Win32" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<MyRule>
|
||||
<MyVar>0</MyVar>
|
||||
</MyRule>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.onListVar()
|
||||
createVar { name="MyVar", kind="list" }
|
||||
myRuleVars { MyVar = { "a", "b", "c" } }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<MyRule>
|
||||
<MyVar>a;b;c</MyVar>
|
||||
</MyRule>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.onCustomListSeparator()
|
||||
createVar { name="MyVar", kind="list", separator="," }
|
||||
myRuleVars { MyVar = { "a", "b", "c" } }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<MyRule>
|
||||
<MyVar>a;b;c</MyVar>
|
||||
</MyRule>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.onPathVar()
|
||||
createVar { name="MyVar", kind="path" }
|
||||
myRuleVars { MyVar = "../path/to/file" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<MyRule>
|
||||
<MyVar>..\path\to\file</MyVar>
|
||||
</MyRule>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.onStringVar()
|
||||
createVar { name="MyVar", kind="string" }
|
||||
myRuleVars { MyVar = "hello" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<MyRule>
|
||||
<MyVar>hello</MyVar>
|
||||
</MyRule>
|
||||
]]
|
||||
end
|
||||
|
||||
@@ -0,0 +1,238 @@
|
||||
--
|
||||
-- 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
|
||||
|
||||
function suite.properties_onStringWithCategory()
|
||||
createVar { name="MyVar", kind="string", category="Custom Category" }
|
||||
local r = test.getRule("MyRule")
|
||||
m.properties(r)
|
||||
test.capture [[
|
||||
<StringProperty
|
||||
Name="MyVar"
|
||||
HelpContext="0"
|
||||
DisplayName="MyVar"
|
||||
Category="Custom Category"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.categories_onStringWithCategory()
|
||||
createVar { name="MyVar", kind="string", category="Custom Category" }
|
||||
local r = test.getRule("MyRule")
|
||||
m.categories(r)
|
||||
test.capture [[
|
||||
<Rule.Categories>
|
||||
<Category
|
||||
Name="General">
|
||||
<Category.DisplayName>
|
||||
<sys:String>General</sys:String>
|
||||
</Category.DisplayName>
|
||||
</Category>
|
||||
<Category
|
||||
Name="Custom Category">
|
||||
<Category.DisplayName>
|
||||
<sys:String>Custom Category</sys:String>
|
||||
</Category.DisplayName>
|
||||
</Category>
|
||||
<Category
|
||||
Name="Command Line"
|
||||
Subtype="CommandLine">
|
||||
<Category.DisplayName>
|
||||
<sys:String>Command Line</sys:String>
|
||||
</Category.DisplayName>
|
||||
</Category>
|
||||
</Rule.Categories>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.properties_onListWithSeparator()
|
||||
createVar { name="MyVar", kind="list", separator="," }
|
||||
local r = test.getRule("MyRule")
|
||||
m.properties(r)
|
||||
test.capture [[
|
||||
<StringListProperty
|
||||
Name="MyVar"
|
||||
HelpContext="0"
|
||||
DisplayName="MyVar"
|
||||
Separator=","
|
||||
/>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,89 @@
|
||||
---
|
||||
-- tests/actions/vstudio/vc2010/test_target_machine.lua
|
||||
-- Validate generation of the <TargetMachine> element
|
||||
-- Copyright (c) 2015 Jason Perkins and the Premake project
|
||||
---
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs2010_target_machine")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare(platform)
|
||||
local cfg = test.getconfig(prj, "Debug", platform)
|
||||
vc2010.targetMachine(cfg)
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Emit if a static lib project contains a resource file and an
|
||||
-- architecture is specified.
|
||||
--
|
||||
|
||||
function suite.emitsOnStaticLibWithX86()
|
||||
kind "StaticLib"
|
||||
architecture "x86"
|
||||
files { "hello.rc" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.emitsOnStaticLibWithX86_64()
|
||||
kind "StaticLib"
|
||||
architecture "x86_64"
|
||||
files { "hello.rc" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Other combinations should NOT emit anything
|
||||
--
|
||||
|
||||
function suite.isIgnoredOnStaticLibNoArch()
|
||||
kind "StaticLib"
|
||||
files { "hello.rc" }
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
function suite.isIgnoredOnStaticLibNoResource()
|
||||
kind "StaticLib"
|
||||
architecture "x86"
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
function suite.isIgnoredOnConsoleApp()
|
||||
kind "ConsoleApp"
|
||||
architecture "x86"
|
||||
files { "hello.rc" }
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
function suite.isIgnoredOnSharedLib()
|
||||
kind "SharedLib"
|
||||
architecture "x86"
|
||||
files { "hello.rc" }
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
@@ -0,0 +1,91 @@
|
||||
--
|
||||
-- test_tokens.lua
|
||||
-- Generate a NuGet packages.config file.
|
||||
-- Copyright (c) Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs2010_tokens")
|
||||
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.files(prj)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function suite.customBuild_onBuildRuleMultipleBuildOutputs()
|
||||
location "projects"
|
||||
files { "hello.cg" }
|
||||
|
||||
filter "files:**.cg"
|
||||
buildcommands { "cgc %{file.relpath}" }
|
||||
buildoutputs { "%{file.basename}.a", "%{file.basename}.b" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="..\hello.cg">
|
||||
<FileType>Document</FileType>
|
||||
<Command>cgc %(Identity)</Command>
|
||||
<Outputs>../hello.a;../hello.b</Outputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.customBuild_onBuildRuleWithMessage()
|
||||
location "projects"
|
||||
files { "hello.cg" }
|
||||
filter "files:**.cg"
|
||||
buildmessage "Compiling shader %{file.relpath}"
|
||||
buildcommands { "cgc %{file.relpath}" }
|
||||
buildoutputs { "%{file.basename}.obj" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="..\hello.cg">
|
||||
<FileType>Document</FileType>
|
||||
<Command>cgc %(Identity)</Command>
|
||||
<Outputs>../hello.obj</Outputs>
|
||||
<Message>Compiling shader %(Identity)</Message>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.customBuild_onBuildRuleWithAdditionalInputs()
|
||||
location "projects"
|
||||
files { "hello.cg" }
|
||||
filter "files:**.cg"
|
||||
buildcommands { "cgc %{file.relpath}" }
|
||||
buildoutputs { "%{file.basename}.obj" }
|
||||
buildinputs { "common.cg.inc", "common.cg.inc2" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="..\hello.cg">
|
||||
<FileType>Document</FileType>
|
||||
<Command>cgc %(Identity)</Command>
|
||||
<Outputs>../hello.obj</Outputs>
|
||||
<AdditionalInputs>../common.cg.inc;../common.cg.inc2</AdditionalInputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_user_file.lua
|
||||
-- Verify handling of empty and non-empty .user files for VC'201x.
|
||||
-- Copyright (c) 2015 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs2010_user_file")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
wks = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local prj = test.getproject(wks, 1)
|
||||
vc2010.generateUser(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If no debugger settings have been specified, then the .user
|
||||
-- file should not be written at all.
|
||||
--
|
||||
|
||||
function suite.noOutput_onNoSettings()
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If a debugger setting has been specified, output.
|
||||
--
|
||||
|
||||
function suite.doesOutput_onDebugSettings()
|
||||
debugcommand "bin/emulator.exe"
|
||||
prepare()
|
||||
test.hasoutput()
|
||||
end
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
---
|
||||
-- tests/actions/vstudio/vc2010/test_vectorextensions.lua
|
||||
-- Validate handling of vectorextensions() in VS 2010 C/C++ projects.
|
||||
--
|
||||
-- Created 26 Mar 2015 by Jason Perkins
|
||||
-- Copyright (c) 2015 Jason Perkins and the Premake project
|
||||
---
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vs2010_vc_vectorextensions")
|
||||
local m = p.vstudio.vc2010
|
||||
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2010")
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
m.enableEnhancedInstructionSet(cfg)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function suite.instructionSet_onNotSet()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
|
||||
function suite.instructionSet_onIA32_onVS2010()
|
||||
vectorextensions "IA32"
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
function suite.instructionSet_onIA32()
|
||||
p.action.set("vs2012")
|
||||
vectorextensions "IA32"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.instructionSet_onSSE()
|
||||
vectorextensions "SSE"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.instructionSet_onSSE2()
|
||||
vectorextensions "SSE2"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.instructionSet_onAVX()
|
||||
p.action.set("vs2013")
|
||||
vectorextensions "AVX"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.instructionSet_onAVX_onVS2010()
|
||||
vectorextensions "AVX"
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
|
||||
function suite.instructionSet_onAVX2()
|
||||
p.action.set("vs2013")
|
||||
vectorextensions "AVX2"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.instructionSet_onAVX2_onVS2012()
|
||||
p.action.set("vs2012")
|
||||
vectorextensions "AVX2"
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
end
|
||||
@@ -0,0 +1,109 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2013/test_vcxitems.lua
|
||||
-- Validate generation of the vcxitems project.
|
||||
-- Copyright (c) Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs2013_vcxitems")
|
||||
local vc2013 = p.vstudio.vc2013
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2013")
|
||||
wks = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
kind "SharedItems"
|
||||
prj = test.getproject(wks, 1)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the structure with the default project values.
|
||||
--
|
||||
|
||||
function suite.structureIsCorrect_onDefaultValues()
|
||||
prepare()
|
||||
vc2013.generate(prj)
|
||||
test.capture [[
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Globals">
|
||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||
<HasSharedItems>true</HasSharedItems>
|
||||
<ItemsProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ItemsProjectGuid>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ProjectCapability Include="SourceItemsFromImports" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check the structure with files.
|
||||
--
|
||||
|
||||
function suite.structureIsCorrect_onFiles()
|
||||
files { "test.h", "test.cpp" }
|
||||
prepare()
|
||||
vc2013.generate(prj)
|
||||
test.capture [[
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Globals">
|
||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||
<HasSharedItems>true</HasSharedItems>
|
||||
<ItemsProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ItemsProjectGuid>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ProjectCapability Include="SourceItemsFromImports" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)test.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)test.cpp" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- If the project name differs from the project filename, output a
|
||||
-- <ItemsProjectName> element to indicate that.
|
||||
--
|
||||
|
||||
function suite.projectName_OnFilename()
|
||||
filename "MyProject_2013"
|
||||
prepare()
|
||||
vc2013.globals(prj)
|
||||
test.capture [[
|
||||
<PropertyGroup Label="Globals">
|
||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||
<HasSharedItems>true</HasSharedItems>
|
||||
<ItemsProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ItemsProjectGuid>
|
||||
<ItemsProjectName>MyProject</ItemsProjectName>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,80 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_compile_settings.lua
|
||||
-- Validate compiler settings in Visual Studio 2019 C/C++ projects.
|
||||
-- Copyright (c) 2011-2020 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs2019_compile_settings")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
local project = p.project
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2019")
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare(platform)
|
||||
local cfg = test.getconfig(prj, "Debug", platform)
|
||||
vc2010.clCompile(cfg)
|
||||
end
|
||||
|
||||
--
|
||||
-- Check ClCompile for SupportJustMyCode
|
||||
--
|
||||
function suite.SupportJustMyCodeOn()
|
||||
justmycode "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SupportJustMyCode>true</SupportJustMyCode>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.SupportJustMyCodeOff()
|
||||
justmycode "Off"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SupportJustMyCode>false</SupportJustMyCode>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check ClCompile for OpenMPSupport
|
||||
--
|
||||
function suite.openmpOn()
|
||||
openmp "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<OpenMPSupport>true</OpenMPSupport>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.openmpOff()
|
||||
openmp "Off"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,43 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_compile_settings.lua
|
||||
-- Validate compiler settings in Visual Studio 2019 C/C++ projects.
|
||||
-- Copyright (c) 2011-2020 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs2019_link")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
local project = p.project
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2019")
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare(platform)
|
||||
local cfg = test.getconfig(prj, "Debug", platform)
|
||||
vc2010.configurationProperties(cfg)
|
||||
end
|
||||
|
||||
--
|
||||
-- Check link command for a static library using a clang toolset
|
||||
--
|
||||
|
||||
function suite.toolsetClangAdditionalDependencies()
|
||||
function suite.additionalDependencies_onSystemLinks()
|
||||
links { "lua", "zlib" }
|
||||
toolset "clang"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalDependencies>lua.lib;zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
]]
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,59 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_compile_settings.lua
|
||||
-- Validate compiler settings in Visual Studio 2019 C/C++ projects.
|
||||
-- Copyright (c) 2011-2020 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs2019_toolset_settings")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
local project = p.project
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2019")
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare(platform)
|
||||
local cfg = test.getconfig(prj, "Debug", platform)
|
||||
vc2010.configurationProperties(cfg)
|
||||
end
|
||||
|
||||
---
|
||||
-- Check the default project settings
|
||||
---
|
||||
|
||||
function suite.defaultSettings()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
---
|
||||
-- Check the project settings with the clang toolset
|
||||
---
|
||||
|
||||
function suite.toolsetClang()
|
||||
toolset "clang"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>ClangCL</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
@@ -0,0 +1,59 @@
|
||||
--
|
||||
-- tests/actions/vstudio/vc2010/test_compile_settings.lua
|
||||
-- Validate compiler settings in Visual Studio 2022 C/C++ projects.
|
||||
-- Copyright (c) 2011-2021 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local suite = test.declare("vstudio_vs2022_toolset_settings")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
local project = p.project
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2022")
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare(platform)
|
||||
local cfg = test.getconfig(prj, "Debug", platform)
|
||||
vc2010.configurationProperties(cfg)
|
||||
end
|
||||
|
||||
---
|
||||
-- Check the default project settings
|
||||
---
|
||||
|
||||
function suite.defaultSettings()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
---
|
||||
-- Check the project settings with the clang toolset
|
||||
---
|
||||
|
||||
function suite.toolsetClang()
|
||||
toolset "clang"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>ClangCL</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
Reference in New Issue
Block a user