Building SourceGear Veracity under Windows


Introduction

Assumed - you are running Windows Vista or Windows 7, and have Visual Studio 2010 (or the equivalent SDK and NMake) installed.


Getting/Unpacking the Source

Retrieve the latest Veracity tarball from sourcegear


Unpack it under the directory of your choice - for brevity, we'll pretend you unpacked it under %USERPROFILE%\v, and so your source tree begins at %USERPROFILE%\v\veracity


Prerequisites

Things to install: * CMake * cygwin


After installing those, you'll build "vv-thirdparty", which contains our third-party dependencies.


Finally, you'll be able to build Veracity.


Install CMake

Grab cmake 2.8.3 or later from cmake.org.


Install CMake, making sure to add cmake to the PATH variable when prompted.


Install Cygwin

Cygwin is used to run a script that builds Veracity's third-party dependencies. That is the only thing it is used for, so it is possible to build and run Veracity without installing cygwin, but you will need to build the third-party dependencies by hand instead of using the script to do it for you. It's a long process, but you can just read throught the script and and do what it would do.


Visit cygwin.com, grab and run the setup utility from there. In addition to the stock Cygwin tools, you'll also need:


Building vv-thirdparty

To build vv-thirdparty, go to the the Windows Start menu and select "Microsoft Visual Studio 2010" -> "Visual Studio Tools" -> "Visual Studio Command Prompt (2010)" (Or, to build them as 64-bit, choose "Visual Studio x64 Win64 Command Prompt (2010)"). At the command prompt, run:


cd %USERPROFILE%\v\veracity\thirdparty
set PATH=%PATH%;C:\cygwin\bin
sh build_win.sh

This will create the vv-thirdparty folder at %USERPROFILE%\v\vv-thirdparty.


IMPORTANT! Add the %USERPROFILE%\v\vv-thirdparty\x86\bin directory to your PATH environment variable (or '%USERPROFILE%\v\vv-thirdparty\amd64\bin' for a 64-bit build).


Creating the Build Directory

cmake will create a Visual Studio solution or NMake Makefiles for you. You just need to give it a place to work. For example, let's create a neighbor of our source directory.


mkdir %USERPROFILE%\v\debug

Then, to create a Visual Studio 2010 solution:


cd %USERPROFILE%\v\debug
cmake -G "Visual Studio 10" ..\veracity

Or, to create a solution for a 64-bit build:


cd %USERPROFILE%\v\debug
cmake -G "Visual Studio 10 Win64" -DVVTHIRDPARTY=%USERPROFILE%\v\vv-thirdparty\amd64 ..\veracity

Creating a Visual Studio solution does not require you to be in a special command prompt. To create NMake makefiles, on the other hand, you must open a Command Prompt that has the correct Visual Studio environment variables set (the same command prompt you used to build vv-thirdparty). Then:


cd %USERPROFILE%\v\debug
cmake -G "NMake Makefiles" ..\veracity

Or, if you built vv-thirdparty as 64-bit and are using the Win64 command prompt (in which case you need to give CMake the VVTHIRDPARTY location):


cd %USERPROFILE%\v\debug
cmake -G "NMake Makefiles" -DVVTHIRDPARTY=%USERPROFILE%\v\vv-thirdparty\amd64 ..\veracity

Building Veracity

You now have a build tree, replete with Makefiles or Project files.


For Visual Studio users, simply open the solution, %USERPROFILE%\v\debug\veracity.sln, and build.


For NMake users,


cd %USERPROFILE%\v\debug
nmake

Run the Test Suite

Only builds that have passed the test suite on all of SourceGear's in-house build machines are ever published. To run the test suite for yourself:


cd %USERPROFILE%\v\debug
ctest
  

Install Veracity

To "install" veracity on your computer, update your PATH again, this time to include the Veracity command line tools, vv and vscript.


For Visual Studio Project users, add these to your PATH: %USERPROFILE%\v\debug\src\cmd\Debug %USERPROFILE%\v\debug\src\script\Debug


For NMake users, add these: %USERPROFILE%\v\debug\src\cmd %USERPROFILE%\v\debug\src\script


In order to run a veracity server you will also need to have a config setting called "server/files" pointed at a certain location. Run:


vv config set server/files "%USERPROFILE%\v\veracity\src\server_files"

Configure the Tortoise Client

Important: For Tortoise, Debug and Release builds make a very big difference. Only Release builds will be loaded by Windows Explorer. Debug builds will only be loaded by Windows Explorer if there is a debugger attached to the explorer process. This is done to prevent a long-lived process from loading the dll, which would prevent the dll from being overwritten on a build.

If you want to try the Veracity Tortoise Client, which allows you to perform Veracity operations directly from Windows Explorer, you'll need to run one of the following commands from an administrator (elevated) command prompt:


If you used Visual Studio for the build, run this command:


regsvr32.exe %USERPROFILE%\v\debug\src\tortoise\VeracityShellExtension\Release\VeracityTortoise.dll

If your build was an NMake build:


regsvr32.exe %USERPROFILE%\v\debug\src\tortoise\VeracityShellExtension\VeracityTortoise.dll

Note for 64-bit users: Windows Explorer on 64-bit systems is a 64-bit process. You must build Veracity as 64-bit in order to integrate with it.