git/compat/vcbuild/vcpkg_copy_dlls.bat

40 lines
1.2 KiB
Batchfile
Raw Normal View History

msvc: support building Git using MS Visual C++ With this patch, Git can be built using the Microsoft toolchain, via: make MSVC=1 [DEBUG=1] Third party libraries are built from source using the open source "vcpkg" tool set. See https://github.com/Microsoft/vcpkg On a first build, the vcpkg tools and the third party libraries are automatically downloaded and built. DLLs for the third party libraries are copied to the top-level (and t/helper) directory to facilitate debugging. See compat/vcbuild/README. A series of .bat files are invoked by the Makefile to find the location of the installed version of Visual Studio and the associated compiler tools (essentially replicating the environment setup performed by a "Developer Command Prompt"). This should find the most recent VS2015 or VS2017 installation. Output from these scripts are used by the Makefile to define compiler and linker pathnames and -I and -L arguments. The build produces .pdb files for both debug and release builds. Note: This commit was squashed from an organic series of commits developed between 2016 and 2018 in Git for Windows' `master` branch. This combined commit eliminates the obsolete commits related to fetching NuGet packages for third party libraries. It is difficult to use NuGet packages for C/C++ sources because they may be built by earlier versions of the MSVC compiler and have CRT version and linking issues. Additionally, the C/C++ NuGet packages that we were using tended to not be updated concurrently with the sources. And in the case of cURL and OpenSSL, this could expose us to security issues. Helped-by: Yue Lin Ho <b8732003@student.nsysu.edu.tw> Helped-by: Philip Oakley <philipoakley@iee.org> Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-06-25 14:49:39 +00:00
@ECHO OFF
REM ================================================================
REM This script is an optional step. It copies the *.dll and *.pdb
REM files (created by vcpkg_install.bat) into the top-level directory
REM of the repo so that you can type "./git.exe" and find them without
REM having to fixup your PATH.
REM
REM NOTE: Because the names of some DLL files change between DEBUG and
REM NOTE: RELEASE builds when built using "vcpkg.exe", you will need
REM NOTE: to copy up the corresponding version.
REM ================================================================
SETLOCAL EnableDelayedExpansion
@FOR /F "delims=" %%D IN ("%~dp0") DO @SET cwd=%%~fD
cd %cwd%
SET arch=x64-windows
SET inst=%cwd%vcpkg\installed\%arch%
IF [%1]==[release] (
echo Copying RELEASE mode DLLs to repo root...
) ELSE IF [%1]==[debug] (
SET inst=%inst%\debug
echo Copying DEBUG mode DLLs to repo root...
) ELSE (
echo ERROR: Invalid argument.
echo Usage: %~0 release
echo Usage: %~0 debug
EXIT /B 1
)
xcopy /e/s/v/y %inst%\bin\*.dll ..\..\
xcopy /e/s/v/y %inst%\bin\*.pdb ..\..\
xcopy /e/s/v/y %inst%\bin\*.dll ..\..\t\helper\
xcopy /e/s/v/y %inst%\bin\*.pdb ..\..\t\helper\
EXIT /B 0