Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Perkins <starkos@industriousone.com>2012-03-19 02:20:40 +0400
committerJason Perkins <starkos@industriousone.com>2012-03-19 02:20:40 +0400
commita438fe50885ea00b54b8e711b6c65ebecb741dc6 (patch)
tree559698fdd9b730e27b35f4376c5a5289a5591720
parent7f48c15709eb92a8f3bcfcc8adbe7165f42cfee0 (diff)
Patch 3505903: Fix VC2010 project reference paths (Pavel Czerný)
-rw-r--r--CHANGES.txt1
-rw-r--r--src/actions/vstudio/vs2010_vcxproj.lua2
-rw-r--r--tests/actions/vstudio/vc2010/test_project_refs.lua78
-rw-r--r--tests/premake4.lua1
4 files changed, 81 insertions, 1 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index a3fb801..734cd4f 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -54,6 +54,7 @@
* Bug 3413866: Incorrect VS200x .csproj relative source paths
* Patch 3111264: Allow path.join() to accept any number of args
* Patch 3353975: Support usage of premake as a library (Konstantin Tokarev)
+* Patch 3505903: Fix VC2010 project reference paths (Pavel Czerný)
-------
diff --git a/src/actions/vstudio/vs2010_vcxproj.lua b/src/actions/vstudio/vs2010_vcxproj.lua
index cfd0613..872e3cd 100644
--- a/src/actions/vstudio/vs2010_vcxproj.lua
+++ b/src/actions/vstudio/vs2010_vcxproj.lua
@@ -617,7 +617,7 @@
if #deps > 0 then
_p(1,'<ItemGroup>')
for _, dep in ipairs(deps) do
- local deppath = path.getrelative(prj.solution.location, vstudio.projectfile(dep))
+ local deppath = path.getrelative(prj.location, vstudio.projectfile(dep))
_p(2,'<ProjectReference Include=\"%s\">', path.translate(deppath, "\\"))
_p(3,'<Project>{%s}</Project>', dep.uuid)
_p(2,'</ProjectReference>')
diff --git a/tests/actions/vstudio/vc2010/test_project_refs.lua b/tests/actions/vstudio/vc2010/test_project_refs.lua
new file mode 100644
index 0000000..c513b9d
--- /dev/null
+++ b/tests/actions/vstudio/vc2010/test_project_refs.lua
@@ -0,0 +1,78 @@
+--
+-- 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
+--
+
+ T.vstudio_vs2010_project_refs = { }
+ local suite = T.vstudio_vs2010_project_refs
+ local vc2010 = premake.vstudio.vc2010
+
+
+--
+-- Setup
+--
+
+ local sln, prj
+
+ function suite.setup()
+ _ACTION = "vs2010"
+ sln = test.createsolution()
+ uuid "00112233-4455-6677-8888-99AABBCCDDEE"
+ test.createproject(sln)
+ end
+
+ local function prepare(platform)
+ premake.bake.buildconfigs()
+ prj = premake.solution.getproject(sln, 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
+
diff --git a/tests/premake4.lua b/tests/premake4.lua
index f5a7a30..ea3a122 100644
--- a/tests/premake4.lua
+++ b/tests/premake4.lua
@@ -110,6 +110,7 @@
dofile("actions/vstudio/vc2010/test_links.lua")
dofile("actions/vstudio/vc2010/test_mfc.lua")
dofile("actions/vstudio/vc2010/test_pch.lua")
+ dofile("actions/vstudio/vc2010/test_project_refs.lua")
-- Makefile tests
dofile("actions/make/test_make_escaping.lua")