Merge branch 'tg/range-diff-output-update'
[git] / compat / vcbuild / README
1 The Steps to Build Git with VS2015 or VS2017 from the command line.
2
3 1. Install the "vcpkg" open source package manager and build essential
4    third-party libraries.  The steps for this have been captured in a
5    set of convenience scripts.  These can be run from a stock Command
6    Prompt or from an SDK bash window:
7
8    $ cd <repo_root>
9    $ ./compat/vcbuild/vcpkg_install.bat
10
11    The vcpkg tools and all of the third-party sources will be installed
12    in this folder:
13       <repo_root>/compat/vcbuild/vcpkg/
14
15    A file will be created with a set of Makefile macros pointing to a
16    unified "include", "lib", and "bin" directory (release and debug) for
17    all of the required packages.  This file will be included by the main
18    Makefile:
19       <repo_root>/compat/vcbuild/MSVC-DEFS-GEN
20
21 2. OPTIONALLY copy the third-party *.dll and *.pdb files into the repo
22    root to make it easier to run and debug git.exe without having to
23    manipulate your PATH.  This is especially true for debug sessions in
24    Visual Studio.
25
26    Use ONE of the following forms which should match how you want to
27    compile git.exe.
28
29    $ ./compat/vcbuild/vcpkg_copy_packages.bat debug
30    $ ./compat/vcbuild/vcpkg_copy_packages.bat release
31
32 3. Build git using MSVC from an SDK bash window using one of the
33    following commands:
34
35    $ make MSVC=1
36    $ make MSVC=1 DEBUG=1
37
38 ================================================================
39
40 The Steps of Build Git with VS2008
41
42 1. You need the build environment, which contains the Git dependencies
43    to be able to compile, link and run Git with MSVC.
44
45    You can either use the binary repository:
46
47        WWW: http://repo.or.cz/w/msvcgit.git
48        Git: git clone git://repo.or.cz/msvcgit.git
49        Zip: http://repo.or.cz/w/msvcgit.git?a=snapshot;h=master;sf=zip
50
51    and call the setup_32bit_env.cmd batch script before compiling Git,
52    (see repo/package README for details), or the source repository:
53
54        WWW: http://repo.or.cz/w/gitbuild.git
55        Git: git clone git://repo.or.cz/gitbuild.git
56        Zip: (None, as it's a project with submodules)
57
58    and build the support libs as instructed in that repo/package.
59
60 2. Ensure you have the msysgit environment in your path, so you have
61    GNU Make, bash and perl available.
62
63        WWW: http://repo.or.cz/w/msysgit.git
64        Git: git clone git://repo.or.cz/msysgit.git
65        Zip: http://repo.or.cz/w/msysgit.git?a=snapshot;h=master;sf=zip
66
67    This environment is also needed when you use the resulting
68    executables, since Git might need to run scripts which are part of
69    the git operations.
70
71 3. Inside Git's directory run the command:
72        make command-list.h
73    to generate the command-list.h file needed to compile git.
74
75 4. Then either build Git with the GNU Make Makefile in the Git projects
76    root
77        make MSVC=1
78    or generate Visual Studio solution/projects (.sln/.vcproj) with the
79    command
80        perl contrib/buildsystems/generate -g Vcproj
81    and open and build the solution with the IDE
82        devenv git.sln /useenv
83    or build with the IDE build engine directly from the command line
84        devenv git.sln /useenv /build "Release|Win32"
85    The /useenv option is required, so Visual Studio picks up the
86    environment variables for the support libraries required to build
87    Git, which you set up in step 1.
88
89 Done!