-
Notifications
You must be signed in to change notification settings - Fork 0
Building libgit2 on Windows
All developers are required to submit patches that work not only on Mac and Linux but also on Windows. In case you do not have a Windows machine available please at least use a VirtualBox VM. All you need to do is install Virtual Box and use the following script to install Windows automatically. The Ballmer Demands It™.
- libgit2 officially supports two compilers on Windows, Microsoft Visual Studio and MinGW GCC.
- Download and install the latest CMake
- Download and install the latest Python
- Grab the source for libgit2 via GitHub (Here's how you do that), alternatively you download it directly.
Note: older versions of CMake may not support the latest Python. If you encounter a problem, please try upgrading. Thanks!
- Open the VS2010 Command Prompt (not a regular cmd prompt or the Windows SDK one!)
- cd into the libgit2 directory
mkdir build && cd build
-
cmake ..
orcmake-gui ..
cmake --build .
ctest -V
cmake --build . --target install
If you'd like to create a solution file, then just change the fourth step to be
cmake .. -G"Visual Studio X"
where 'X' is your version of Visual Studio (i.e. '2010', '2008'). Running
cmake
by itself will tell you which targets it supports. You can also select
it in the CMake GUI.
- Open regular command line. Start, type
cmd.exe
- cd into the libgit2 directory
mkdir build && cd build
-
cmake .. -G"MinGW Makefiles"
orcmake-gui ..
and make sure you select MinGW Compiler -
cmake --build .
orcmake --build . -- -j
for parallel build ctest -V
cmake --build . --target install
You can change the build settings on step 4 using cmake-gui
or from
commandline by defining CMake attributes. For example to change the install
destination use:
cmake . -DCMAKE_INSTALL_PREFIX=C:\libgit2