From 75692a7920540f170ea025057b2db04948655d93 Mon Sep 17 00:00:00 2001 From: Thomas Desveaux Date: Tue, 3 Apr 2018 20:03:18 +0200 Subject: [PATCH 1/5] VStudio: Implement symbolspath for static libs --- modules/vstudio/vs2010_vcxproj.lua | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/vstudio/vs2010_vcxproj.lua b/modules/vstudio/vs2010_vcxproj.lua index 252fed79..dbb35c86 100644 --- a/modules/vstudio/vs2010_vcxproj.lua +++ b/modules/vstudio/vs2010_vcxproj.lua @@ -313,7 +313,7 @@ -- m.elements.clCompile = function(cfg) - return { + local calls = { m.precompiledHeader, m.warningLevel, m.treatWarningAsError, @@ -348,6 +348,12 @@ m.callingConvention, m.languageStandard, } + + if cfg.kind == p.STATICLIB then + table.insert(calls, m.programDatabaseFile) + end + + return calls end function m.clCompile(cfg) @@ -2175,14 +2181,15 @@ end end - function m.programDatabaseFile(cfg) if cfg.symbolspath and cfg.symbols ~= p.OFF and cfg.debugformat ~= "c7" then - m.element("ProgramDatabaseFile", nil, p.project.getrelative(cfg.project, cfg.symbolspath)) + + local key = iif(cfg.kind == p.STATICLIB, "ProgramDataBaseFileName", "ProgramDatabaseFile") + + m.element(key, nil, p.project.getrelative(cfg.project, cfg.symbolspath)) end end - function m.projectGuid(prj) m.element("ProjectGuid", nil, "{%s}", prj.uuid) end From 2bb0800b0449bb6f2e18fcefaa78007bec1204f6 Mon Sep 17 00:00:00 2001 From: Thomas Desveaux Date: Tue, 3 Apr 2018 20:18:50 +0200 Subject: [PATCH 2/5] VStudio: Add tests for symbolspath --- .../tests/vc2010/test_compile_settings.lua | 39 +++++++++++++++++++ modules/vstudio/tests/vc2010/test_link.lua | 30 ++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/modules/vstudio/tests/vc2010/test_compile_settings.lua b/modules/vstudio/tests/vc2010/test_compile_settings.lua index 580b033c..bbffd42c 100644 --- a/modules/vstudio/tests/vc2010/test_compile_settings.lua +++ b/modules/vstudio/tests/vc2010/test_compile_settings.lua @@ -1199,3 +1199,42 @@ ]] end + +-- +-- Check StaticLib SymbolsPath +-- + + function suite.generateProgramDataBaseFileName_onStaticLib() + kind "StaticLib" + + symbols "On" + symbolspath "$(IntDir)$(TargetName).pdb" + + prepare() + test.capture [[ + + NotUsing + Level3 + EditAndContinue + Disabled + $(IntDir)$(TargetName).pdb + + ]] + end + + function suite.generateNotProgramDataBaseFileName_onSharedLib() + kind "SharedLib" + + symbols "On" + symbolspath "$(IntDir)$(TargetName).pdb" + + prepare() + test.capture [[ + + NotUsing + Level3 + EditAndContinue + Disabled + + ]] + end diff --git a/modules/vstudio/tests/vc2010/test_link.lua b/modules/vstudio/tests/vc2010/test_link.lua index 81eda0c0..2604f429 100644 --- a/modules/vstudio/tests/vc2010/test_link.lua +++ b/modules/vstudio/tests/vc2010/test_link.lua @@ -226,6 +226,36 @@ -- Test the handling of the SymbolsPath flag. -- + function suite.generateProgramDataBaseFileName_onStaticLib() + kind "StaticLib" + + symbols "On" + symbolspath "$(IntDir)$(TargetName).pdb" + prepare() + test.capture [[ + + Windows + true + + ]] + end + + function suite.generateProgramDataBaseFileName_onSharedLib() + kind "SharedLib" + + symbols "On" + symbolspath "$(IntDir)$(TargetName).pdb" + prepare() + test.capture [[ + + Windows + true + bin\Debug\MyProject.lib + $(IntDir)$(TargetName).pdb + + ]] + end + function suite.generateDebugInfo_onSymbolsOn_on2010() p.action.set("vs2010") symbols "On" From bd2aff7ef2a1d1c54a634f326bf0094da93f9845 Mon Sep 17 00:00:00 2001 From: Thomas Desveaux Date: Tue, 3 Apr 2018 20:21:48 +0200 Subject: [PATCH 3/5] VStudio: symbolspath tests generateDebugInfo -> generateProgramDataBaseFile --- modules/vstudio/tests/vc2010/test_link.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/vstudio/tests/vc2010/test_link.lua b/modules/vstudio/tests/vc2010/test_link.lua index 2604f429..0fd0f87b 100644 --- a/modules/vstudio/tests/vc2010/test_link.lua +++ b/modules/vstudio/tests/vc2010/test_link.lua @@ -226,7 +226,7 @@ -- Test the handling of the SymbolsPath flag. -- - function suite.generateProgramDataBaseFileName_onStaticLib() + function suite.generateProgramDataBaseFile_onStaticLib() kind "StaticLib" symbols "On" @@ -240,7 +240,7 @@ ]] end - function suite.generateProgramDataBaseFileName_onSharedLib() + function suite.generateProgramDataBaseFile_onSharedLib() kind "SharedLib" symbols "On" @@ -256,7 +256,7 @@ ]] end - function suite.generateDebugInfo_onSymbolsOn_on2010() + function suite.generateProgramDatabaseFile_onSymbolsOn_on2010() p.action.set("vs2010") symbols "On" symbolspath "$(IntDir)$(TargetName).pdb" @@ -271,7 +271,7 @@ ]] end - function suite.generateDebugInfo_onSymbolsFastLink_on2010() + function suite.generateProgramDatabaseFile_onSymbolsFastLink_on2010() p.action.set("vs2010") symbols "Off" symbolspath "$(IntDir)$(TargetName).pdb" @@ -285,7 +285,7 @@ ]] end - function suite.generateDebugInfo_onSymbolsFull_on2010() + function suite.generateProgramDatabaseFile_onSymbolsFull_on2010() p.action.set("vs2010") symbols "Full" symbolspath "$(IntDir)$(TargetName).pdb" @@ -300,7 +300,7 @@ ]] end - function suite.generateDebugInfo_onSymbolsOn_on2015() + function suite.generateProgramDatabaseFile_onSymbolsOn_on2015() p.action.set("vs2015") symbols "On" symbolspath "$(IntDir)$(TargetName).pdb" @@ -315,7 +315,7 @@ ]] end - function suite.generateDebugInfo_onSymbolsFastLink_on2015() + function suite.generateProgramDatabaseFile_onSymbolsFastLink_on2015() p.action.set("vs2015") symbols "FastLink" symbolspath "$(IntDir)$(TargetName).pdb" @@ -331,7 +331,7 @@ ]] end - function suite.generateDebugInfo_onSymbolsFull_on2015() + function suite.generateProgramDatabaseFile_onSymbolsFull_on2015() p.action.set("vs2015") symbols "Full" symbolspath "$(IntDir)$(TargetName).pdb" @@ -346,7 +346,7 @@ ]] end - function suite.generateDebugInfo_onSymbolsFull_on2017() + function suite.generateProgramDatabaseFile_onSymbolsFull_on2017() p.action.set("vs2017") symbols "Full" symbolspath "$(IntDir)$(TargetName).pdb" From 40e0539aa071016715561902a9c73280eb52384f Mon Sep 17 00:00:00 2001 From: Thomas Desveaux Date: Thu, 5 Apr 2018 18:28:38 +0200 Subject: [PATCH 4/5] VStudio: Extract ProgramDataBaseFileName from vstudio.programDatabaseFile --- modules/vstudio/vs2010_vcxproj.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/vstudio/vs2010_vcxproj.lua b/modules/vstudio/vs2010_vcxproj.lua index dbb35c86..65368329 100644 --- a/modules/vstudio/vs2010_vcxproj.lua +++ b/modules/vstudio/vs2010_vcxproj.lua @@ -350,7 +350,7 @@ } if cfg.kind == p.STATICLIB then - table.insert(calls, m.programDatabaseFile) + table.insert(calls, m.programDatabaseFileName) end return calls @@ -2183,10 +2183,13 @@ function m.programDatabaseFile(cfg) if cfg.symbolspath and cfg.symbols ~= p.OFF and cfg.debugformat ~= "c7" then + m.element("ProgramDatabaseFile", nil, p.project.getrelative(cfg.project, cfg.symbolspath)) + end + end - local key = iif(cfg.kind == p.STATICLIB, "ProgramDataBaseFileName", "ProgramDatabaseFile") - - m.element(key, nil, p.project.getrelative(cfg.project, cfg.symbolspath)) + function m.programDatabaseFileName(cfg) + if cfg.symbolspath and cfg.symbols ~= p.OFF and cfg.debugformat ~= "c7" then + m.element("ProgramDataBaseFileName", nil, p.project.getrelative(cfg.project, cfg.symbolspath)) end end From 825c1b989a396904d8eb77ae786d7c26b9e56b3d Mon Sep 17 00:00:00 2001 From: Thomas Desveaux Date: Fri, 6 Apr 2018 19:04:19 +0200 Subject: [PATCH 5/5] VStudio: Factorise conditions and value for ProgramDataBaseFile[Name] --- modules/vstudio/vs2010_vcxproj.lua | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/modules/vstudio/vs2010_vcxproj.lua b/modules/vstudio/vs2010_vcxproj.lua index 65368329..ce0f79e4 100644 --- a/modules/vstudio/vs2010_vcxproj.lua +++ b/modules/vstudio/vs2010_vcxproj.lua @@ -2181,15 +2181,27 @@ end end - function m.programDatabaseFile(cfg) + local function getSymbolsPathRelative(cfg) if cfg.symbolspath and cfg.symbols ~= p.OFF and cfg.debugformat ~= "c7" then - m.element("ProgramDatabaseFile", nil, p.project.getrelative(cfg.project, cfg.symbolspath)) + return p.project.getrelative(cfg.project, cfg.symbolspath) + else + return nil + end + end + + function m.programDatabaseFile(cfg) + local value = getSymbolsPathRelative(cfg) + + if value then + m.element("ProgramDatabaseFile", nil, value) end end function m.programDatabaseFileName(cfg) - if cfg.symbolspath and cfg.symbols ~= p.OFF and cfg.debugformat ~= "c7" then - m.element("ProgramDataBaseFileName", nil, p.project.getrelative(cfg.project, cfg.symbolspath)) + local value = getSymbolsPathRelative(cfg) + + if value then + m.element("ProgramDataBaseFileName", nil, value) end end