Added project references to VC 2008 to fix intermittent build failures
This commit is contained in:
parent
e45a6efbd4
commit
b9c09f6dd3
@ -47,6 +47,7 @@
|
||||
_p(1,'</Configurations>')
|
||||
|
||||
_p(1,'<References>')
|
||||
vc200x.projectReferences(prj)
|
||||
_p(1,'</References>')
|
||||
|
||||
_p(1,'<Files>')
|
||||
@ -595,6 +596,26 @@
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Write out the list of project references.
|
||||
--
|
||||
|
||||
function vc200x.projectReferences(prj)
|
||||
local deps = project.getdependencies(prj)
|
||||
if #deps > 0 then
|
||||
local prjpath = project.getlocation(prj)
|
||||
|
||||
for _, dep in ipairs(deps) do
|
||||
local relpath = path.getrelative(prjpath, vstudio.projectfile_ng(dep))
|
||||
_p(2,'<ProjectReference')
|
||||
_p(3,'ReferencedProjectIdentifier="{%s}"', dep.uuid)
|
||||
_p(3,'RelativePathToProject="%s"', path.translate(relpath))
|
||||
_p(2,'/>')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Return the list of tools required to build a specific configuration.
|
||||
-- Each tool gets represented by an XML element in the project file.
|
||||
@ -922,7 +943,7 @@
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Output the correct project version attribute for the current action.
|
||||
--
|
||||
|
76
tests/actions/vstudio/vc200x/test_project_refs.lua
Normal file
76
tests/actions/vstudio/vc200x/test_project_refs.lua
Normal file
@ -0,0 +1,76 @@
|
||||
--
|
||||
-- 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
|
||||
--
|
||||
|
||||
T.vstudio_vs200x_project_refs = { }
|
||||
local suite = T.vstudio_vs200x_project_refs
|
||||
local vc200x = premake.vstudio.vc200x
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local sln, prj
|
||||
|
||||
function suite.setup()
|
||||
_ACTION = "vs2008"
|
||||
sln = test.createsolution()
|
||||
uuid "00112233-4455-6677-8888-99AABBCCDDEE"
|
||||
test.createproject(sln)
|
||||
end
|
||||
|
||||
local function prepare(platform)
|
||||
prj = premake.solution.getproject_ng(sln, 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
|
||||
-- project doing the referencing.
|
||||
--
|
||||
|
||||
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="..\MyProject\MyProject.vcproj"
|
||||
/>
|
||||
]]
|
||||
end
|
||||
|
@ -132,6 +132,7 @@
|
||||
dofile("actions/vstudio/vc200x/test_mfc.lua")
|
||||
dofile("actions/vstudio/vc200x/test_platforms.lua")
|
||||
dofile("actions/vstudio/vc200x/test_project.lua")
|
||||
dofile("actions/vstudio/vc200x/test_project_refs.lua")
|
||||
dofile("actions/vstudio/vc200x/test_resource_compiler.lua")
|
||||
|
||||
-- Visual Studio 2010 C/C++ projects
|
||||
|
Loading…
Reference in New Issue
Block a user