compat / vcbuild / READMEon commit Merge branch 'bc/hash-independent-tests-part-4' (fcdd9cc)
   1The Steps to Build Git with VS2015 or VS2017 from the command line.
   2
   31. 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
  212. 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
  323. 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
  40Alternatively, run `make vcxproj` and then load the generated `git.sln` in
  41Visual Studio. The initial build will install the vcpkg system and build the
  42dependencies automatically. This will take a while.
  43
  44Instead of generating the `git.sln` file yourself (which requires a full Git
  45for Windows SDK), you may want to consider fetching the `vs/master` branch of
  46https://github.com/git-for-windows/git instead (which is updated automatically
  47via CI running `make vcxproj`). The `vs/master` branch does not require a Git
  48for Windows to build, but you can run the test scripts in a regular Git Bash.
  49
  50Note that `make vcxproj` will automatically add and commit the generated `.sln`
  51and `.vcxproj` files to the repo. This is necessary to allow building a
  52fully-testable Git in Visual Studio, where a regular Git Bash can be used to
  53run the test scripts (as opposed to a full Git for Windows SDK): a number of
  54build targets, such as Git commands implemented as Unix shell scripts (where
  55`@@SHELL_PATH@@` and other placeholders are interpolated) require a full-blown
  56Git for Windows SDK (which is about 10x the size of a regular Git for Windows
  57installation).
  58
  59If your plan is to open a Pull Request with Git for Windows, it is a good idea
  60to drop this commit before submitting.
  61
  62================================================================
  63The Steps of Build Git with VS2008
  64
  651. You need the build environment, which contains the Git dependencies
  66   to be able to compile, link and run Git with MSVC.
  67
  68   You can either use the binary repository:
  69
  70       WWW: http://repo.or.cz/w/msvcgit.git
  71       Git: git clone git://repo.or.cz/msvcgit.git
  72       Zip: http://repo.or.cz/w/msvcgit.git?a=snapshot;h=master;sf=zip
  73
  74   and call the setup_32bit_env.cmd batch script before compiling Git,
  75   (see repo/package README for details), or the source repository:
  76
  77       WWW: http://repo.or.cz/w/gitbuild.git
  78       Git: git clone git://repo.or.cz/gitbuild.git
  79       Zip: (None, as it's a project with submodules)
  80
  81   and build the support libs as instructed in that repo/package.
  82
  832. Ensure you have the msysgit environment in your path, so you have
  84   GNU Make, bash and perl available.
  85
  86       WWW: http://repo.or.cz/w/msysgit.git
  87       Git: git clone git://repo.or.cz/msysgit.git
  88       Zip: http://repo.or.cz/w/msysgit.git?a=snapshot;h=master;sf=zip
  89
  90   This environment is also needed when you use the resulting
  91   executables, since Git might need to run scripts which are part of
  92   the git operations.
  93
  943. Inside Git's directory run the command:
  95       make command-list.h
  96   to generate the command-list.h file needed to compile git.
  97
  984. Then either build Git with the GNU Make Makefile in the Git projects
  99   root
 100       make MSVC=1
 101   or generate Visual Studio solution/projects (.sln/.vcproj) with the
 102   command
 103       perl contrib/buildsystems/generate -g Vcproj
 104   and open and build the solution with the IDE
 105       devenv git.sln /useenv
 106   or build with the IDE build engine directly from the command line
 107       devenv git.sln /useenv /build "Release|Win32"
 108   The /useenv option is required, so Visual Studio picks up the
 109   environment variables for the support libraries required to build
 110   Git, which you set up in step 1.
 111
 112Done!