forked from MayaPosch/NymphRPC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSetup-NMake-vcpkg.bat
102 lines (77 loc) · 2.75 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
@echo off & setlocal enableextensions enabledelayedexpansion
::
:: Setup prerequisites and build NymphRPC library (MSVC).
::
:: Created 23 January 2022.
:: Copyright (c) 2021 Nyanko.ws
::
:: Usage: Setup-NMake-vcpkg [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\NymphRPC
:: 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 NymphRPC: 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 NymphRPC: Make sure to run these commands in a '%NC_TGT_BITS%-bit Native Tools Command Prompt'; expecting 'NC_TGT_ARCH', got '%VSCMD_ARG_TGT_ARCH%'. Bailing out.]
endlocal & goto :EOF
)
:: Check for vcpkg:
set vcpkg=%VCPKG_ROOT%\vcpkg.exe
if ["%VCPKG_ROOT%"] == [""] (
echo [Setup NymphRPC: Make sure environment variable 'VCPKG_ROOT' points to your vcpkg installation; it's empty or does not exist. Bailing out.]
endlocal & goto :EOF
)
:: Make sure NymphRPC and LibNymphCast will be build with the same Poco version:
if exist "%VCPKG_ROOT%\installed\%VCPKG_TRIPLET%\include\Poco" (
echo Setup NymphRPC: 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...]
"%vcpkg%" install --triplet %VCPKG_TRIPLET% poco
)
echo Setup NymphRPC: Using POCO_ROOT="%VCPKG_ROOT%\installed\%VCPKG_TRIPLET%"
set POCO_ROOT=%VCPKG_ROOT%\installed\%VCPKG_TRIPLET%
:: Make NymphRPC.lib and NymphRPCmt.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%" ^
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%" ^
INSTALL_PREFIX="%INSTALL_PREFIX%" ^
clean all install %*
echo.
endlocal
:: End of file