comparison dep/pugixml/scripts/nuget_build.ps1 @ 55:d10b6c6b432e

add xml lib, we will need to use it eventually
author Paper <mrpapersonic@gmail.com>
date Tue, 26 Sep 2023 12:37:08 -0400
parents
children
comparison
equal deleted inserted replaced
54:466ac9870df9 55:d10b6c6b432e
1 function Run-Command([string]$cmd)
2 {
3 Invoke-Expression $cmd
4 if ($LastExitCode) { exit $LastExitCode }
5 }
6
7 function Force-Copy([string]$from, [string]$to)
8 {
9 Write-Host $from "->" $to
10 New-Item -Force $to | Out-Null
11 Copy-Item -Force $from $to
12 if (! $?) { exit 1 }
13 }
14
15 function Build-Version([string]$vs, [string]$toolset, [string]$linkage)
16 {
17 $prjsuffix = if ($linkage -eq "static") { "_static" } else { "" }
18 $cfgsuffix = if ($linkage -eq "static") { "Static" } else { "" }
19
20 foreach ($configuration in "Debug","Release")
21 {
22 Run-Command "msbuild pugixml_$vs$prjsuffix.vcxproj /t:Rebuild /p:Configuration=$configuration /p:Platform=x86 /v:minimal /nologo"
23 Run-Command "msbuild pugixml_$vs$prjsuffix.vcxproj /t:Rebuild /p:Configuration=$configuration /p:Platform=x64 /v:minimal /nologo"
24
25 Force-Copy "$vs/Win32_$configuration$cfgsuffix/pugixml.lib" "nuget/build/native/lib/Win32/$toolset/$linkage/$configuration/pugixml.lib"
26 Force-Copy "$vs/x64_$configuration$cfgsuffix/pugixml.lib" "nuget/build/native/lib/x64/$toolset/$linkage/$configuration/pugixml.lib"
27 }
28 }
29
30 Push-Location
31 $scriptdir = Split-Path $MyInvocation.MyCommand.Path
32 cd $scriptdir
33
34 Force-Copy "../src/pugiconfig.hpp" "nuget/build/native/include/pugiconfig.hpp"
35 Force-Copy "../src/pugixml.hpp" "nuget/build/native/include/pugixml.hpp"
36 Force-Copy "../src/pugixml.cpp" "nuget/build/native/include/pugixml.cpp"
37
38 if ($args[0] -eq 2022){
39 Build-Version "vs2022" "v143" "dynamic"
40 Build-Version "vs2022" "v143" "static"
41
42 } elseif ($args[0] -eq 2019){
43 Build-Version "vs2019" "v142" "dynamic"
44 Build-Version "vs2019" "v142" "static"
45
46 } elseif ($args[0] -eq 2017){
47 Build-Version "vs2017" "v141" "dynamic"
48 Build-Version "vs2017" "v141" "static"
49
50 Build-Version "vs2015" "v140" "dynamic"
51 Build-Version "vs2015" "v140" "static"
52
53 Build-Version "vs2013" "v120" "dynamic"
54 Build-Version "vs2013" "v120" "static"
55
56 } elseif($args[0] -eq 2015){
57 Build-Version "vs2015" "v140" "dynamic"
58 Build-Version "vs2015" "v140" "static"
59
60 Build-Version "vs2013" "v120" "dynamic"
61 Build-Version "vs2013" "v120" "static"
62
63 } elseif($args[0] -eq 2013){
64 Build-Version "vs2013" "v120" "dynamic"
65 Build-Version "vs2013" "v120" "static"
66 }
67
68 Run-Command "nuget pack nuget"
69
70 Pop-Location