2012-02-01 00:54:33 +00:00
|
|
|
--
|
|
|
|
-- 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
|
|
|
|
--
|
|
|
|
|
2017-04-25 05:44:13 +00:00
|
|
|
local p = premake
|
2016-05-12 23:56:04 +00:00
|
|
|
local suite = test.declare("vstudio_vs2010_project_refs")
|
2017-04-25 05:44:13 +00:00
|
|
|
local vc2010 = p.vstudio.vc2010
|
2012-02-01 00:54:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Setup
|
|
|
|
--
|
|
|
|
|
2015-08-28 20:16:14 +00:00
|
|
|
local wks, prj
|
2012-02-01 00:54:33 +00:00
|
|
|
|
|
|
|
function suite.setup()
|
2017-04-25 05:44:13 +00:00
|
|
|
p.action.set("vs2010")
|
2015-08-28 20:16:14 +00:00
|
|
|
wks = test.createWorkspace()
|
2012-02-01 00:54:33 +00:00
|
|
|
uuid "00112233-4455-6677-8888-99AABBCCDDEE"
|
2015-08-28 20:16:14 +00:00
|
|
|
test.createproject(wks)
|
2012-02-01 00:54:33 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
local function prepare(platform)
|
2015-08-30 15:38:35 +00:00
|
|
|
prj = test.getproject(wks, 2)
|
2013-02-11 18:25:33 +00:00
|
|
|
vc2010.projectReferences(prj)
|
2012-02-01 00:54:33 +00:00
|
|
|
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 [[
|
2014-10-02 20:21:25 +00:00
|
|
|
<ItemGroup>
|
|
|
|
<ProjectReference Include="MyProject.vcxproj">
|
|
|
|
<Project>{00112233-4455-6677-8888-99AABBCCDDEE}</Project>
|
|
|
|
</ProjectReference>
|
|
|
|
</ItemGroup>
|
2012-02-01 00:54:33 +00:00
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
2012-02-02 00:05:13 +00:00
|
|
|
--
|
2013-02-11 18:25:33 +00:00
|
|
|
-- Project references should always be specified relative to the
|
2012-02-02 00:05:13 +00:00
|
|
|
-- project doing the referencing.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.referencesAreRelative_onDifferentProjectLocation()
|
|
|
|
links { "MyProject" }
|
|
|
|
location "build/MyProject2"
|
|
|
|
project("MyProject")
|
|
|
|
location "build/MyProject"
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
2014-10-02 20:21:25 +00:00
|
|
|
<ItemGroup>
|
|
|
|
<ProjectReference Include="..\MyProject\MyProject.vcxproj">
|
|
|
|
<Project>{00112233-4455-6677-8888-99AABBCCDDEE}</Project>
|
|
|
|
</ProjectReference>
|
|
|
|
</ItemGroup>
|
2012-02-02 00:05:13 +00:00
|
|
|
]]
|
|
|
|
end
|
2013-02-11 18:25:33 +00:00
|
|
|
|
2014-10-02 20:40:28 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Managed C++ projects write out references a little differently.
|
|
|
|
--
|
|
|
|
|
2018-04-30 13:40:49 +00:00
|
|
|
function suite.referencesAreRelative_onDifferentProjectLocationWithCLR()
|
2014-10-02 20:40:28 +00:00
|
|
|
links { "MyProject" }
|
2014-11-12 00:20:29 +00:00
|
|
|
clr "On"
|
2014-10-02 20:40:28 +00:00
|
|
|
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
|
2019-08-08 14:16:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- 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
|