@@ -20,50 +20,113 @@ $NUM_CORES = [Environment]::ProcessorCount
2020
2121# Main logic
2222if ($args.Count -lt 2 ) {
23- Write-Host " Usage: .\download_install_dependencies.ps1 [boost|capnp] [--prefix=DIR]"
23+ Write-Host " Usage: .\download_install_dependencies.ps1 [boost|capnp] [compile|install] [ --prefix=DIR]"
2424 exit 1
2525}
2626
2727$dependency = $args [0 ]
28+ $action = $args [1 ]
2829
2930# Download, compile, or install Boost
3031if ($dependency -eq " boost" ) {
31- $BOOST_FOLDER_NAME = " boost_" + $BOOST_VERSION -replace ' \.' , ' _'
32- $BOOST_PACKAGE_NAME = " $BOOST_FOLDER_NAME .tar.gz"
33- $url = " https://archives.boost.org/release/$BOOST_VERSION /source/$BOOST_PACKAGE_NAME "
34-
35- # Download and extract Boost
36- # Necessary exe because of local dev env
37- curl.exe - O $url -- retry 100 -- retry- max- time 3600
38- tar - xzf $BOOST_PACKAGE_NAME
39- Rename-Item - Path $BOOST_FOLDER_NAME - NewName " boost"
32+ if ($action -eq " compile" ) {
33+ $BOOST_FOLDER_NAME = " boost_" + $BOOST_VERSION -replace ' \.' , ' _'
34+ $BOOST_PACKAGE_NAME = " $BOOST_FOLDER_NAME .tar.gz"
35+ $url = " https://archives.boost.org/release/$BOOST_VERSION /source/$BOOST_PACKAGE_NAME "
4036
41- Copy-Item - Recurse - Path " boost\boost" - Destination " $PREFIX \include\boost"
42- Write-Host " Installed Boost into $PREFIX \include\boost"
37+ # Download and extract Boost
38+ # Necessary exe because of local dev env
39+ curl.exe - O $url -- retry 100 -- retry- max- time 3600
40+ tar - xzf $BOOST_PACKAGE_NAME
41+ Rename-Item - Path $BOOST_FOLDER_NAME - NewName " boost"
42+ }
43+ elseif ($action -eq " install" ) {
44+ Copy-Item - Recurse - Path " boost\boost" - Destination " $PREFIX \include\boost"
45+ Write-Host " Installed Boost into $PREFIX \include\boost"
46+ }
47+ else {
48+ Write-Host " Argument needs to be either compile or install"
49+ exit 1
50+ }
4351}
4452
4553# Download, compile, or install Cap'n Proto
4654elseif ($dependency -eq " capnp" ) {
47- $CAPNP_FOLDER_NAME = " capnproto-c++-$CAPNP_VERSION "
48- $CAPNP_PACKAGE_NAME = " $CAPNP_FOLDER_NAME .tar.gz"
49- $url = " https://capnproto.org/$CAPNP_PACKAGE_NAME "
50-
51- # Download and extract Cap'n Proto
52- curl.exe - O $url -- retry 100 -- retry- max- time 3600
53- tar - xzf $CAPNP_PACKAGE_NAME
54- Rename-Item - Path $CAPNP_FOLDER_NAME - NewName " capnp"
55+ if ($action -eq " compile" ) {
56+ $CAPNP_FOLDER_NAME = " capnproto-c++-$CAPNP_VERSION "
57+ $CAPNP_PACKAGE_NAME = " $CAPNP_FOLDER_NAME .tar.gz"
58+ $url = " https://capnproto.org/$CAPNP_PACKAGE_NAME "
5559
56- # Configure and build with Visual Studio using CMake
57- Set-Location - Path " capnp "
58- cmake - G " Visual Studio 17 2022 " - B build
59- cmake -- build build -- config Release
60+ # Download and extract Cap'n Proto
61+ curl.exe - O $url -- retry 100 -- retry - max - time 3600
62+ tar - xzf $CAPNP_PACKAGE_NAME
63+ Rename-Item - Path $CAPNP_FOLDER_NAME - NewName " capnp "
6064
61- Set-Location - Path " capnp"
62- cmake -- install build -- config Release -- prefix $PREFIX
63- Write-Host " Installed capnp into $PREFIX "
64- }
65+ # Configure and build with Visual Studio using CMake
66+ Set-Location - Path " capnp"
67+ cmake - G " Visual Studio 17 2022" - B build
68+ cmake -- build build -- config Release
69+ }
70+ elseif ($action -eq " install" ) {
71+ $CAPNP_FOLDER_NAME = " capnproto-c++-$CAPNP_VERSION "
72+ Rename-Item - Path $CAPNP_FOLDER_NAME - NewName " capnp"
73+ Set-Location - Path " capnp"
74+ cmake -- install build -- config Release -- prefix $PREFIX
75+ Write-Host " Installed capnp into $PREFIX "
76+ }
77+ else {
78+ Write-Host " Argument needs to be either compile or install"
79+ exit 1
80+ }
6581
6682else {
6783 Write-Host " Usage: .\download_install_dependencies.ps1 [boost|capnp] [--prefix=DIR]"
6884 exit 1
6985}
86+
87+
88+
89+ - }
90+ - elseif ($action -eq " install" ) {
91+ - Copy-Item - Recurse - Path " boost\boost" - Destination " $PREFIX \include\boost"
92+ - Write-Host " Installed Boost into $PREFIX \include\boost"
93+ - }
94+ - else {
95+ - Write-Host " Argument needs to be either compile or install"
96+ - exit 1
97+ - }
98+ - }
99+ -
100+ - # Download, compile, or install Cap' n Proto
101+ -elseif ($dependency -eq "capnp") {
102+ - if ($action -eq "compile") {
103+ - $CAPNP_FOLDER_NAME = "capnproto-c++-$CAPNP_VERSION"
104+ - $CAPNP_PACKAGE_NAME = "$CAPNP_FOLDER_NAME.tar.gz"
105+ - $url = "https://capnproto.org/$CAPNP_PACKAGE_NAME"
106+ -
107+ - # Download and extract Cap' n Proto
108+ - curl.exe - O $url -- retry 100 -- retry- max- time 3600
109+ - tar - xzf $CAPNP_PACKAGE_NAME
110+ - Rename-Item - Path $CAPNP_FOLDER_NAME - NewName " capnp"
111+ -
112+ - # Configure and build with Visual Studio using CMake
113+ - Set-Location - Path " capnp"
114+ - cmake - G " Visual Studio 17 2022" - B build
115+ - cmake -- build build -- config Release
116+ - }
117+ - elseif ($action -eq " install" ) {
118+ - Set-Location - Path " capnp"
119+ - cmake -- install build -- config Release -- prefix $PREFIX
120+ - Write-Host " Installed capnp into $PREFIX "
121+ - }
122+ - else {
123+ - Write-Host " Argument needs to be either compile or install"
124+ - exit 1
125+ - }
126+ - }
127+ -
128+ - else {
129+ - Write-Host " Usage: .\download_install_dependencies.ps1 [boost|capnp] [compile|install] [--prefix=DIR]"
130+ - exit 1
131+ - }
132+ -
0 commit comments