2 REM ================================================================
3 REM This script installs the "vcpkg" source package manager and uses
4 REM it to build the third-party libraries that git requires when it
5 REM is built using MSVC.
8 REM [a] Create <root>/compat/vcbuild/vcpkg/
9 REM [b] Download "vcpkg".
10 REM [c] Compile using the currently installed version of VS.
11 REM [d] Create <root>/compat/vcbuild/vcpkg/vcpkg.exe
13 REM [2] Install third-party libraries.
14 REM [a] Download each (which may also install CMAKE).
15 REM [b] Compile in RELEASE mode and install in:
16 REM vcpkg/installed/<arch>/{bin,lib}
17 REM [c] Compile in DEBUG mode and install in:
18 REM vcpkg/installed/<arch>/debug/{bin,lib}
19 REM [d] Install headers in:
20 REM vcpkg/installed/<arch>/include
22 REM [3] Create a set of MAKE definitions for the top-level
23 REM Makefile to allow "make MSVC=1" to find the above
24 REM third-party libraries.
25 REM [a] Write vcpkg/VCPGK-DEFS
27 REM https://blogs.msdn.microsoft.com/vcblog/2016/09/19/vcpkg-a-tool-to-acquire-and-build-c-open-source-libraries-on-windows/
28 REM https://github.com/Microsoft/vcpkg
29 REM https://vcpkg.readthedocs.io/en/latest/
30 REM ================================================================
32 SETLOCAL EnableDelayedExpansion
34 @FOR /F "delims=" %%D IN ("%~dp0") DO @SET cwd=%%~fD
37 dir vcpkg\vcpkg.exe >nul 2>nul && GOTO :install_libraries
39 echo Fetching vcpkg in %cwd%vcpkg
40 git.exe clone https://github.com/Microsoft/vcpkg vcpkg
41 IF ERRORLEVEL 1 ( EXIT /B 1 )
45 powershell -exec bypass scripts\bootstrap.ps1
46 IF ERRORLEVEL 1 ( EXIT /B 1 )
48 echo Successfully installed %cwd%vcpkg\vcpkg.exe
53 echo Installing third-party libraries...
54 FOR %%i IN (zlib expat libiconv openssl libssh2 curl) DO (
56 IF NOT EXIST "packages\%%i_%arch%" CALL :sub__install_one %%i
57 IF ERRORLEVEL 1 ( EXIT /B 1 )
62 SET inst=%cwd%vcpkg\installed\%arch%
64 echo vcpkg_inc=-I"%inst%\include">VCPKG-DEFS
65 echo vcpkg_rel_lib=-L"%inst%\lib">>VCPKG-DEFS
66 echo vcpkg_rel_bin="%inst%\bin">>VCPKG-DEFS
67 echo vcpkg_dbg_lib=-L"%inst%\debug\lib">>VCPKG-DEFS
68 echo vcpkg_dbg_bin="%inst%\debug\bin">>VCPKG-DEFS
74 echo Installing package %1...
76 .\vcpkg.exe install %1:%arch%
77 IF ERRORLEVEL 1 ( EXIT /B 1 )