summaryrefslogtreecommitdiff
path: root/scripts/nuget_build.ps1
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2017-06-20 21:32:11 -0700
committerGitHub <noreply@github.com>2017-06-20 21:32:11 -0700
commit94ef7b3a033825c4bc3d3578b55f2349182745f0 (patch)
tree38885fd4db1420f83c9e155ece2e479092adce5c /scripts/nuget_build.ps1
parent208e2cf0432a0f2865a225a9dc51917191c6cd04 (diff)
parent88d43a7ebc01a2fac86e7c0d9a53ef56a684ad86 (diff)
Merge pull request #151 from zeux/nuget
Rework NuGet package building
Diffstat (limited to 'scripts/nuget_build.ps1')
-rw-r--r--scripts/nuget_build.ps153
1 files changed, 38 insertions, 15 deletions
diff --git a/scripts/nuget_build.ps1 b/scripts/nuget_build.ps1
index a8e3017..9028426 100644
--- a/scripts/nuget_build.ps1
+++ b/scripts/nuget_build.ps1
@@ -1,25 +1,48 @@
-function Run-Command
+function Run-Command([string]$cmd)
{
- Invoke-Expression $args[0]
+ Invoke-Expression $cmd
if ($LastExitCode) { exit $LastExitCode }
}
+function Force-Copy([string]$from, [string]$to)
+{
+ Write-Host $from "->" $to
+ New-Item -Force $to | Out-Null
+ Copy-Item -Force $from $to
+ if (! $?) { exit 1 }
+}
+
+function Build-Version([string]$vs, [string]$toolset, [string]$linkage)
+{
+ $prjsuffix = if ($linkage -eq "static") { "_static" } else { "" }
+ $cfgsuffix = if ($linkage -eq "static") { "Static" } else { "" }
+
+ 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"
+
+ 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"
+ }
+}
+
Push-Location
$scriptdir = Split-Path $MyInvocation.MyCommand.Path
cd $scriptdir
-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"
-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"
-Write-NuGetPackage nuget.autopkg
+Force-Copy "../src/pugiconfig.hpp" "nuget/build/native/include/pugiconfig.hpp"
+Force-Copy "../src/pugixml.hpp" "nuget/build/native/include/pugixml.hpp"
+
+Build-Version "vs2013" "v120" "dynamic"
+Build-Version "vs2013" "v120" "static"
+
+Build-Version "vs2015" "v140" "dynamic"
+Build-Version "vs2015" "v140" "static"
+
+Build-Version "vs2015" "v141" "dynamic"
+Build-Version "vs2015" "v141" "static"
+
+Run-Command "nuget pack nuget"
Pop-Location