Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/compat/vcbuild/README # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / compat / vcbuild / README` 112 lines ยท 4643 bytes Raw Blame History 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 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 /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 /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_dlls.bat debug 30 $ ./compat/vcbuild/vcpkg_copy_dlls.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 Alternatively, run `make vcxproj` and then load the generated `git.sln` in 41 Visual Studio. The initial build will install the vcpkg system and build the 42 dependencies automatically. This will take a while. 43 44 Instead of generating the `git.sln` file yourself (which requires a full Git 45 for Windows SDK), you may want to consider fetching the `vs/master` branch of 46 https://github.com/git-for-windows/git instead (which is updated automatically 47 via CI running `make vcxproj`). The `vs/master` branch does not require a Git 48 for Windows to build, but you can run the test scripts in a regular Git Bash. 49 50 Note that `make vcxproj` will automatically add and commit the generated `.sln` 51 and `.vcxproj` files to the repo. This is necessary to allow building a 52 fully-testable Git in Visual Studio, where a regular Git Bash can be used to 53 run the test scripts (as opposed to a full Git for Windows SDK): a number of 54 build targets, such as Git commands implemented as Unix shell scripts (where 55 `@@SHELL_PATH@@` and other placeholders are interpolated) require a full-blown 56 Git for Windows SDK (which is about 10x the size of a regular Git for Windows 57 installation). 58 59 If your plan is to open a Pull Request with Git for Windows, it is a good idea 60 to drop this commit before submitting. 61 62 ================================================================ 63 The Steps of Build Git with VS2008 64 65 1. 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 83 2. 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 94 3. Inside Git's directory run the command: 95 make generated-hdrs 96 to generate the header file needed to compile git. 97 98 4. 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 112 Done!