From 157d96e39dcc43125d8a37f6c3bd343d7fc0c0e1 Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Thu, 2 Oct 2014 16:21:25 -0400 Subject: [PATCH 1/2] Modernize VC 201x project references generator --- src/actions/vstudio/vs2010_vcxproj.lua | 29 +++++++++++++------ .../vstudio/vc2010/test_project_refs.lua | 20 ++++++------- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/src/actions/vstudio/vs2010_vcxproj.lua b/src/actions/vstudio/vs2010_vcxproj.lua index f38725cc..ab0d6e7b 100644 --- a/src/actions/vstudio/vs2010_vcxproj.lua +++ b/src/actions/vstudio/vs2010_vcxproj.lua @@ -821,17 +821,23 @@ -- Generate the list of project dependencies. -- + m.elements.projectReferences = function(prj, ref) + return { + m.projectReferenceProject, + } + end + function m.projectReferences(prj) - local deps = project.getdependencies(prj) - if #deps > 0 then - _p(1,'') - for _, dep in ipairs(deps) do - local relpath = project.getrelative(prj, vstudio.projectfile(dep)) - _x(2,'', path.translate(relpath)) - _p(3,'{%s}', dep.uuid) - _p(2,'') + local refs = project.getdependencies(prj) + if #refs > 0 then + p.push('') + for _, ref in ipairs(refs) do + local relpath = project.getrelative(prj, vstudio.projectfile(ref)) + p.push('', path.translate(relpath)) + p.callArray(m.elements.projectReferences, prj, ref) + p.pop('') end - _p(1,'') + p.pop('') end end @@ -1385,6 +1391,11 @@ end + function m.projectReferenceProject(prj, ref) + p.w('{%s}', ref.uuid) + end + + function m.propertyGroup(cfg, label) local cond if cfg then diff --git a/tests/actions/vstudio/vc2010/test_project_refs.lua b/tests/actions/vstudio/vc2010/test_project_refs.lua index dddf87f4..93e9ba8b 100644 --- a/tests/actions/vstudio/vc2010/test_project_refs.lua +++ b/tests/actions/vstudio/vc2010/test_project_refs.lua @@ -47,11 +47,11 @@ links { "MyProject" } prepare() test.capture [[ - - - {00112233-4455-6677-8888-99AABBCCDDEE} - - + + + {00112233-4455-6677-8888-99AABBCCDDEE} + + ]] end @@ -67,11 +67,11 @@ location "build/MyProject" prepare() test.capture [[ - - - {00112233-4455-6677-8888-99AABBCCDDEE} - - + + + {00112233-4455-6677-8888-99AABBCCDDEE} + + ]] end From 428b9cad2fad0cba96ce4b1aaf044b44c2c7b59d Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Thu, 2 Oct 2014 16:40:28 -0400 Subject: [PATCH 2/2] Fix managed C++ linking of unmanaged library dependencies --- src/actions/vstudio/vs2010_vcxproj.lua | 52 +++++++++++++++---- .../vstudio/vc2010/test_project_refs.lua | 22 ++++++++ 2 files changed, 65 insertions(+), 9 deletions(-) diff --git a/src/actions/vstudio/vs2010_vcxproj.lua b/src/actions/vstudio/vs2010_vcxproj.lua index ab0d6e7b..f4465216 100644 --- a/src/actions/vstudio/vs2010_vcxproj.lua +++ b/src/actions/vstudio/vs2010_vcxproj.lua @@ -822,9 +822,20 @@ -- m.elements.projectReferences = function(prj, ref) - return { - m.projectReferenceProject, - } + if prj.flags.Managed then + return { + m.referenceProject, + m.referencePrivate, + m.referenceOutputAssembly, + m.referenceCopyLocalSatelliteAssemblies, + m.referenceLinkLibraryDependencies, + m.referenceUseLibraryDependences, + } + else + return { + m.referenceProject, + } + end end function m.projectReferences(prj) @@ -1391,11 +1402,6 @@ end - function m.projectReferenceProject(prj, ref) - p.w('{%s}', ref.uuid) - end - - function m.propertyGroup(cfg, label) local cond if cfg then @@ -1418,7 +1424,6 @@ end - function m.propertySheetGroup(prj) for cfg in project.eachconfig(prj) do m.propertySheets(cfg) @@ -1426,6 +1431,35 @@ end + function m.referenceCopyLocalSatelliteAssemblies(prj, ref) + p.w('false') + end + + + function m.referenceLinkLibraryDependencies(prj, ref) + p.w('true') + end + + + function m.referenceOutputAssembly(prj, ref) + p.w('true') + end + + + function m.referencePrivate(prj, ref) + p.w('true') + end + + + function m.referenceProject(prj, ref) + p.w('{%s}', ref.uuid) + end + + + function m.referenceUseLibraryDependences(prj, ref) + p.w('false') + end + function m.resourceAdditionalIncludeDirectories(cfg) m.additionalIncludeDirectories(cfg, table.join(cfg.includedirs, cfg.resincludedirs)) diff --git a/tests/actions/vstudio/vc2010/test_project_refs.lua b/tests/actions/vstudio/vc2010/test_project_refs.lua index 93e9ba8b..39e195e7 100644 --- a/tests/actions/vstudio/vc2010/test_project_refs.lua +++ b/tests/actions/vstudio/vc2010/test_project_refs.lua @@ -75,3 +75,25 @@ ]] end + +-- +-- Managed C++ projects write out references a little differently. +-- + + function suite.referencesAreRelative_onDifferentProjectLocation() + links { "MyProject" } + flags { "Managed" } + prepare() + test.capture [[ + + + {00112233-4455-6677-8888-99AABBCCDDEE} + true + true + false + true + false + + + ]] + end