From 88d43a7ebc01a2fac86e7c0d9a53ef56a684ad86 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Mon, 19 Jun 2017 23:25:49 -0700 Subject: scripts: Refactor nuget_build.ps1 Unify build paths in all MSBuild VS projects and extract common build logic into functions. Note that this change changes both VS2010 and VS2013 projects to have more predictable output paths and fixed output file name (pugixml). --- scripts/nuget_build.ps1 | 80 ++++++++++------------------------- scripts/pugixml_vs2010.vcxproj | 28 ++++++------ scripts/pugixml_vs2010_static.vcxproj | 40 +++++++++--------- scripts/pugixml_vs2013.vcxproj | 30 ++++++------- scripts/pugixml_vs2013_static.vcxproj | 42 +++++++++--------- 5 files changed, 92 insertions(+), 128 deletions(-) diff --git a/scripts/nuget_build.ps1 b/scripts/nuget_build.ps1 index 20f2d89..9028426 100644 --- a/scripts/nuget_build.ps1 +++ b/scripts/nuget_build.ps1 @@ -6,78 +6,42 @@ function Run-Command([string]$cmd) function Force-Copy([string]$from, [string]$to) { - Write-Host $from "=>" $to + Write-Host $from "->" $to New-Item -Force $to | Out-Null Copy-Item -Force $from $to if (! $?) { exit 1 } } -Push-Location -$scriptdir = Split-Path $MyInvocation.MyCommand.Path -cd $scriptdir - -Run-Command "msbuild pugixml_vs2013.vcxproj /t:Rebuild /p:Configuration=Debug /p:Platform=x86 /v:minimal /nologo" -Run-Command "msbuild pugixml_vs2013.vcxproj /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal /nologo" -Run-Command "msbuild pugixml_vs2013.vcxproj /t:Rebuild /p:Configuration=Debug /p:Platform=x64 /v:minimal /nologo" -Run-Command "msbuild pugixml_vs2013.vcxproj /t:Rebuild /p:Configuration=Release /p:Platform=x64 /v:minimal /nologo" - -Run-Command "msbuild pugixml_vs2013_static.vcxproj /t:Rebuild /p:Configuration=Debug /p:Platform=x86 /v:minimal /nologo" -Run-Command "msbuild pugixml_vs2013_static.vcxproj /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal /nologo" -Run-Command "msbuild pugixml_vs2013_static.vcxproj /t:Rebuild /p:Configuration=Debug /p:Platform=x64 /v:minimal /nologo" -Run-Command "msbuild pugixml_vs2013_static.vcxproj /t:Rebuild /p:Configuration=Release /p:Platform=x64 /v:minimal /nologo" - -Run-Command "msbuild pugixml_vs2015.vcxproj /t:Rebuild /p:Configuration=Debug /p:Platform=x86 /v:minimal /nologo" -Run-Command "msbuild pugixml_vs2015.vcxproj /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal /nologo" -Run-Command "msbuild pugixml_vs2015.vcxproj /t:Rebuild /p:Configuration=Debug /p:Platform=x64 /v:minimal /nologo" -Run-Command "msbuild pugixml_vs2015.vcxproj /t:Rebuild /p:Configuration=Release /p:Platform=x64 /v:minimal /nologo" +function Build-Version([string]$vs, [string]$toolset, [string]$linkage) +{ + $prjsuffix = if ($linkage -eq "static") { "_static" } else { "" } + $cfgsuffix = if ($linkage -eq "static") { "Static" } else { "" } -Run-Command "msbuild pugixml_vs2015_static.vcxproj /t:Rebuild /p:Configuration=Debug /p:Platform=x86 /v:minimal /nologo" -Run-Command "msbuild pugixml_vs2015_static.vcxproj /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal /nologo" -Run-Command "msbuild pugixml_vs2015_static.vcxproj /t:Rebuild /p:Configuration=Debug /p:Platform=x64 /v:minimal /nologo" -Run-Command "msbuild pugixml_vs2015_static.vcxproj /t:Rebuild /p:Configuration=Release /p:Platform=x64 /v:minimal /nologo" + foreach ($configuration in "Debug","Release") + { + Run-Command "msbuild pugixml_$vs$prjsuffix.vcxproj /t:Rebuild /p:Configuration=$configuration /p:Platform=x86 /v:minimal /nologo" + Run-Command "msbuild pugixml_$vs$prjsuffix.vcxproj /t:Rebuild /p:Configuration=$configuration /p:Platform=x64 /v:minimal /nologo" -Run-Command "msbuild pugixml_vs2017.vcxproj /t:Rebuild /p:Configuration=Debug /p:Platform=x86 /v:minimal /nologo" -Run-Command "msbuild pugixml_vs2017.vcxproj /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal /nologo" -Run-Command "msbuild pugixml_vs2017.vcxproj /t:Rebuild /p:Configuration=Debug /p:Platform=x64 /v:minimal /nologo" -Run-Command "msbuild pugixml_vs2017.vcxproj /t:Rebuild /p:Configuration=Release /p:Platform=x64 /v:minimal /nologo" + Force-Copy "$vs/Win32_$configuration$cfgsuffix/pugixml.lib" "nuget/build/native/lib/Win32/$toolset/$linkage/$configuration/pugixml.lib" + Force-Copy "$vs/x64_$configuration$cfgsuffix/pugixml.lib" "nuget/build/native/lib/x64/$toolset/$linkage/$configuration/pugixml.lib" + } +} -Run-Command "msbuild pugixml_vs2017_static.vcxproj /t:Rebuild /p:Configuration=Debug /p:Platform=x86 /v:minimal /nologo" -Run-Command "msbuild pugixml_vs2017_static.vcxproj /t:Rebuild /p:Configuration=Release /p:Platform=x86 /v:minimal /nologo" -Run-Command "msbuild pugixml_vs2017_static.vcxproj /t:Rebuild /p:Configuration=Debug /p:Platform=x64 /v:minimal /nologo" -Run-Command "msbuild pugixml_vs2017_static.vcxproj /t:Rebuild /p:Configuration=Release /p:Platform=x64 /v:minimal /nologo" +Push-Location +$scriptdir = Split-Path $MyInvocation.MyCommand.Path +cd $scriptdir Force-Copy "../src/pugiconfig.hpp" "nuget/build/native/include/pugiconfig.hpp" Force-Copy "../src/pugixml.hpp" "nuget/build/native/include/pugixml.hpp" -Force-Copy "vs2013/x32/pugixml.lib" "nuget/build/native/lib/Win32/v120/dynamic/Release/pugixml.lib" -Force-Copy "vs2013/x32/pugixmld.lib" "nuget/build/native/lib/Win32/v120/dynamic/Debug/pugixml.lib" -Force-Copy "vs2013/x64/pugixml.lib" "nuget/build/native/lib/x64/v120/dynamic/Release/pugixml.lib" -Force-Copy "vs2013/x64/pugixmld.lib" "nuget/build/native/lib/x64/v120/dynamic/Debug/pugixml.lib" - -Force-Copy "vs2013/x32/pugixmls.lib" "nuget/build/native/lib/Win32/v120/static/Release/pugixml.lib" -Force-Copy "vs2013/x32/pugixmlsd.lib" "nuget/build/native/lib/Win32/v120/static/Debug/pugixml.lib" -Force-Copy "vs2013/x64/pugixmls.lib" "nuget/build/native/lib/x64/v120/static/Release/pugixml.lib" -Force-Copy "vs2013/x64/pugixmlsd.lib" "nuget/build/native/lib/x64/v120/static/Debug/pugixml.lib" - -Force-Copy "vs2015/Win32_Release/pugixml.lib" "nuget/build/native/lib/Win32/v140/dynamic/Release/pugixml.lib" -Force-Copy "vs2015/Win32_Debug/pugixml.lib" "nuget/build/native/lib/Win32/v140/dynamic/Debug/pugixml.lib" -Force-Copy "vs2015/x64_Release/pugixml.lib" "nuget/build/native/lib/x64/v140/dynamic/Release/pugixml.lib" -Force-Copy "vs2015/x64_Debug/pugixml.lib" "nuget/build/native/lib/x64/v140/dynamic/Debug/pugixml.lib" - -Force-Copy "vs2015/Win32_ReleaseStatic/pugixml.lib" "nuget/build/native/lib/Win32/v140/static/Release/pugixml.lib" -Force-Copy "vs2015/Win32_DebugStatic/pugixml.lib" "nuget/build/native/lib/Win32/v140/static/Debug/pugixml.lib" -Force-Copy "vs2015/x64_ReleaseStatic/pugixml.lib" "nuget/build/native/lib/x64/v140/static/Release/pugixml.lib" -Force-Copy "vs2015/x64_DebugStatic/pugixml.lib" "nuget/build/native/lib/x64/v140/static/Debug/pugixml.lib" +Build-Version "vs2013" "v120" "dynamic" +Build-Version "vs2013" "v120" "static" -Force-Copy "vs2017/Win32_Release/pugixml.lib" "nuget/build/native/lib/Win32/v141/dynamic/Release/pugixml.lib" -Force-Copy "vs2017/Win32_Debug/pugixml.lib" "nuget/build/native/lib/Win32/v141/dynamic/Debug/pugixml.lib" -Force-Copy "vs2017/x64_Release/pugixml.lib" "nuget/build/native/lib/x64/v141/dynamic/Release/pugixml.lib" -Force-Copy "vs2017/x64_Debug/pugixml.lib" "nuget/build/native/lib/x64/v141/dynamic/Debug/pugixml.lib" +Build-Version "vs2015" "v140" "dynamic" +Build-Version "vs2015" "v140" "static" -Force-Copy "vs2017/Win32_ReleaseStatic/pugixml.lib" "nuget/build/native/lib/Win32/v141/static/Release/pugixml.lib" -Force-Copy "vs2017/Win32_DebugStatic/pugixml.lib" "nuget/build/native/lib/Win32/v141/static/Debug/pugixml.lib" -Force-Copy "vs2017/x64_ReleaseStatic/pugixml.lib" "nuget/build/native/lib/x64/v141/static/Release/pugixml.lib" -Force-Copy "vs2017/x64_DebugStatic/pugixml.lib" "nuget/build/native/lib/x64/v141/static/Debug/pugixml.lib" +Build-Version "vs2015" "v141" "dynamic" +Build-Version "vs2015" "v141" "static" Run-Command "nuget pack nuget" diff --git a/scripts/pugixml_vs2010.vcxproj b/scripts/pugixml_vs2010.vcxproj index c29b4c5..d29c463 100644 --- a/scripts/pugixml_vs2010.vcxproj +++ b/scripts/pugixml_vs2010.vcxproj @@ -64,17 +64,17 @@ <_ProjectFileVersion>10.0.30319.1 - vs2010\x32\ - vs2010\x32\Debug\ - pugixmld - vs2010\x64\ - vs2010\x64\Debug\ - pugixmld - vs2010\x32\ - vs2010\x32\Release\ + vs2010\Win32_Debug\ + vs2010\Win32_Debug\ + pugixml + vs2010\x64_Debug\ + vs2010\x64_Debug\ + pugixml + vs2010\Win32_Release\ + vs2010\Win32_Release\ pugixml - vs2010\x64\ - vs2010\x64\Release\ + vs2010\x64_Release\ + vs2010\x64_Release\ pugixml @@ -93,12 +93,12 @@ _DEBUG;%(PreprocessorDefinitions) - $(OutDir)pugixmld.lib + $(OutDir)pugixml.lib Windows true - $(OutDir)pugixmld.pdb + $(OutDir)pugixml.pdb @@ -117,12 +117,12 @@ _DEBUG;%(PreprocessorDefinitions) - $(OutDir)pugixmld.lib + $(OutDir)pugixml.lib Windows true - $(OutDir)pugixmld.pdb + $(OutDir)pugixml.pdb diff --git a/scripts/pugixml_vs2010_static.vcxproj b/scripts/pugixml_vs2010_static.vcxproj index c1e133c..e770d17 100644 --- a/scripts/pugixml_vs2010_static.vcxproj +++ b/scripts/pugixml_vs2010_static.vcxproj @@ -64,18 +64,18 @@ <_ProjectFileVersion>10.0.30319.1 - vs2010\x32\ - vs2010\x32\DebugStatic\ - pugixmlsd - vs2010\x64\ - vs2010\x64\DebugStatic\ - pugixmlsd - vs2010\x32\ - vs2010\x32\ReleaseStatic\ - pugixmls - vs2010\x64\ - vs2010\x64\ReleaseStatic\ - pugixmls + vs2010\Win32_DebugStatic\ + vs2010\Win32_DebugStatic\ + pugixml + vs2010\x64_DebugStatic\ + vs2010\x64_DebugStatic\ + pugixml + vs2010\Win32_ReleaseStatic\ + vs2010\Win32_ReleaseStatic\ + pugixml + vs2010\x64_ReleaseStatic\ + vs2010\x64_ReleaseStatic\ + pugixml @@ -93,12 +93,12 @@ _DEBUG;%(PreprocessorDefinitions) - $(OutDir)pugixmlsd.lib + $(OutDir)pugixml.lib Windows true - $(OutDir)pugixmlsd.pdb + $(OutDir)pugixml.pdb @@ -117,12 +117,12 @@ _DEBUG;%(PreprocessorDefinitions) - $(OutDir)pugixmlsd.lib + $(OutDir)pugixml.lib Windows true - $(OutDir)pugixmlsd.pdb + $(OutDir)pugixml.pdb @@ -141,14 +141,14 @@ NDEBUG;%(PreprocessorDefinitions) - $(OutDir)pugixmls.lib + $(OutDir)pugixml.lib Windows true true true - $(OutDir)pugixmls.pdb + $(OutDir)pugixml.pdb @@ -167,14 +167,14 @@ NDEBUG;%(PreprocessorDefinitions) - $(OutDir)pugixmls.lib + $(OutDir)pugixml.lib Windows true true true - $(OutDir)pugixmls.pdb + $(OutDir)pugixml.pdb diff --git a/scripts/pugixml_vs2013.vcxproj b/scripts/pugixml_vs2013.vcxproj index c719394..eae27c9 100644 --- a/scripts/pugixml_vs2013.vcxproj +++ b/scripts/pugixml_vs2013.vcxproj @@ -68,17 +68,17 @@ <_ProjectFileVersion>10.0.30319.1 - vs2013\x32\ - vs2013\x32\Debug\ - pugixmld - vs2013\x64\ - vs2013\x64\Debug\ - pugixmld - vs2013\x32\ - vs2013\x32\Release\ + vs2013\Win32_Debug\ + vs2013\Win32_Debug\ + pugixml + vs2013\x64_Debug\ + vs2013\x64_Debug\ + pugixml + vs2013\Win32_Release\ + vs2013\Win32_Release\ pugixml - vs2013\x64\ - vs2013\x64\Release\ + vs2013\x64_Release\ + vs2013\x64_Release\ pugixml @@ -98,12 +98,12 @@ _DEBUG;%(PreprocessorDefinitions) - $(OutDir)pugixmld.lib + $(OutDir)pugixml.lib Windows true - $(OutDir)pugixmld.pdb + $(OutDir)pugixml.pdb @@ -123,12 +123,12 @@ _DEBUG;%(PreprocessorDefinitions) - $(OutDir)pugixmld.lib + $(OutDir)pugixml.lib Windows true - $(OutDir)pugixmld.pdb + $(OutDir)pugixml.pdb @@ -196,4 +196,4 @@ - \ No newline at end of file + diff --git a/scripts/pugixml_vs2013_static.vcxproj b/scripts/pugixml_vs2013_static.vcxproj index acca608..0ad4fe2 100644 --- a/scripts/pugixml_vs2013_static.vcxproj +++ b/scripts/pugixml_vs2013_static.vcxproj @@ -68,18 +68,18 @@ <_ProjectFileVersion>10.0.30319.1 - vs2013\x32\ - vs2013\x32\DebugStatic\ - pugixmlsd - vs2013\x64\ - vs2013\x64\DebugStatic\ - pugixmlsd - vs2013\x32\ - vs2013\x32\ReleaseStatic\ - pugixmls - vs2013\x64\ - vs2013\x64\ReleaseStatic\ - pugixmls + vs2013\Win32_DebugStatic\ + vs2013\Win32_DebugStatic\ + pugixml + vs2013\x64_DebugStatic\ + vs2013\x64_DebugStatic\ + pugixml + vs2013\Win32_ReleaseStatic\ + vs2013\Win32_ReleaseStatic\ + pugixml + vs2013\x64_ReleaseStatic\ + vs2013\x64_ReleaseStatic\ + pugixml @@ -98,12 +98,12 @@ _DEBUG;%(PreprocessorDefinitions) - $(OutDir)pugixmlsd.lib + $(OutDir)pugixml.lib Windows true - $(OutDir)pugixmlsd.pdb + $(OutDir)pugixml.pdb @@ -123,12 +123,12 @@ _DEBUG;%(PreprocessorDefinitions) - $(OutDir)pugixmlsd.lib + $(OutDir)pugixml.lib Windows true - $(OutDir)pugixmlsd.pdb + $(OutDir)pugixml.pdb @@ -148,14 +148,14 @@ NDEBUG;%(PreprocessorDefinitions) - $(OutDir)pugixmls.lib + $(OutDir)pugixml.lib Windows true true true - $(OutDir)pugixmls.pdb + $(OutDir)pugixml.pdb @@ -175,14 +175,14 @@ NDEBUG;%(PreprocessorDefinitions) - $(OutDir)pugixmls.lib + $(OutDir)pugixml.lib Windows true true true - $(OutDir)pugixmls.pdb + $(OutDir)pugixml.pdb @@ -196,4 +196,4 @@ - \ No newline at end of file + -- cgit v1.2.3