-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSetup-NMake-vcpkg.bat
124 lines (92 loc) · 3.42 KB
/
Setup-NMake-vcpkg.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
@echo off & setlocal enableextensions enabledelayedexpansion
::
:: Setup prerequisites and build LibNymphCast library (MSVC).
::
:: Created 23 January 2022.
:: Copyright (c) 2021 Nyanko.ws
::
:: Usage: Setup-NMake-vcpkg [NYMPHRPC_ROOT=path/to/lib] [POCO_ROOT=path/to/lib] [target]
::
:: Install vcpkg tool:
:: > git clone https://github.com/microsoft/vcpkg /path/to/vcpkg-folder
:: > .\vcpkg-folder\bootstrap-vcpkg.bat -disableMetrics
:: > set VCPKG_ROOT=/path/to/vcpkg-folder
::
:: Note: For most flexibility, "quote on use" is generally used and quotes in variable assignment avoided.
:: For example:
:: - `set var=val ue` // Note: no spaces around `=`
:: - `echo "%var%"`
echo.
set INSTALL_PREFIX=D:\Libraries\LibNymphCast
:: Note: static building does not yet work.
set NC_STATIC=0
:: set NC_STATIC=1
set NC_CONFIG=Release
:: set NC_CONFIG=Debug
set NC_TGT_BITS=64
set NC_TGT_ARCH=x%NC_TGT_BITS%
set NC_LNKCRT=-MD
set VCPKG_TRIPLET=x64-windows
if [%NC_STATIC%] == [1] (
set NC_LNKCRT=-MT
set VCPKG_TRIPLET=x64-windows-static
echo [Setup LibNymphCast: static build does not yet work. Continuing.]
)
:: Check for 64-bit Native Tools Command Prompt
if not [%VSCMD_ARG_TGT_ARCH%] == [%NC_TGT_ARCH%] (
echo [Setup LibNymphCast: Make sure to run these commands in a '64-bit Native Tools Command Prompt'; expecting 'x64', got '%VSCMD_ARG_TGT_ARCH%'. Bailing out.]
endlocal & goto :EOF
)
:: Check for vcpkg:
set vcpkg=%VCPKG_ROOT%\vcpkg.exe
if ["%VCPKG_ROOT%"] == [""] (
echo [Setup LibNymphCast: Make sure environment variable 'VCPKG_ROOT' points to your vcpkg installation; it's empty or does not exist. Bailing out.]
endlocal & goto :EOF
)
:: NymphRPC and LibNymphCast libraries:
if ["%NYMPHRPC_ROOT%"] == [""] (
set NYMPHRPC_ROOT=D:\Libraries\NymphRPC
)
:: Make sure NymphRPC and LibNymphCast will be build with the same Poco version:
if exist "%VCPKG_ROOT%\installed\%VCPKG_TRIPLET%\include\Poco" (
echo Setup LibNymphCast: Poco is already installed at "%VCPKG_ROOT%\installed\%VCPKG_TRIPLET%\include\Poco".
) else (
echo [Installing vcpkg Poco; please be patient, this may take about 10 minutes...]
echo "%vcpkg%" install --triplet %VCPKG_TRIPLET% poco
)
echo Setup LibNymphCast: Using POCO_ROOT=%VCPKG_ROOT%\installed\%VCPKG_TRIPLET%
set POCO_ROOT=%VCPKG_ROOT%\installed\%VCPKG_TRIPLET%
:: NymphRPC - Download and build NymphRPC dependency:
if exist "%NYMPHRPC_ROOT%\include\nymph\nymph.h" (
echo Setup LibNymphCast: NymphRPC has been installed at "%NYMPHRPC_ROOT%".
) else (
echo Setup LibNymphCast: NymphRPC not found at "%NYMPHRPC_ROOT%".
git clone --depth 1 https://github.com/MayaPosch/NymphRPC.git
cd NymphRPC & call Setup-NMake-vcpkg.bat clean all install & cd ..
rmdir /s /q NymphRPC
)
:: Make LibNymphCast.lib and LibNymphCastmt.lib:
:: set CMD_ARGS=%*
:: if [%CMD_ARGS%] == [] (
:: set CMD_ARGS=clean all install
:: )
:: echo CMD_ARGS: '%CMD_ARGS%'
nmake -nologo -f NMakefile ^
NC_STATIC=%NC_STATIC% ^
NC_LNKCRT=-MD ^
NC_CONFIG=%NC_CONFIG% ^
POCO_ROOT="%POCO_ROOT%" ^
NYMPHRPC_ROOT="%NYMPHRPC_ROOT%" ^
INSTALL_PREFIX="%INSTALL_PREFIX%" ^
clean all install %*
nmake -nologo -f NMakefile ^
NC_STATIC=%NC_STATIC% ^
NC_LNKCRT=-MT ^
NC_CONFIG=%NC_CONFIG% ^
POCO_ROOT="%POCO_ROOT%" ^
NYMPHRPC_ROOT="%NYMPHRPC_ROOT%" ^
INSTALL_PREFIX="%INSTALL_PREFIX%" ^
clean all install %*
echo.
endlocal
:: End of file