wiki:CompileWithVisualC

Compiling Box Backup with Microsoft Visual C++

Every commit to the master branch is compiled and tested on AppVeyor. This starts from a fairly blank slate, so we install most of the required software ourselves as part of the build process.

You can see the current AppVeyor build script here. You should follow this script to setup your own build environment.

Start by installing Chocolatey package manager. Then open an Administrator command prompt.

Examine the AppVeyor build script, search for cinst commands (Chocolatey packages to install), including commented-out ones, and install them like this:

cinst -y --limit-output 7zip.commandline nsis.portable cmake.portable strawberryperl git vim visualstudio2012wdx

This will install:

  • The 7zip archiver (command-line mode, i.e. 7z.exe, required to run the tests)
  • The NSIS installer builder (required to build executable installer packages)
  • CMake (a portable build system generator, which creates our Visual Studio project files)
  • Strawberry Perl (required for some small parts of the build system, and by the tests)
  • Git (required to check out the source code)
  • Vim (a text editor, optional)
  • Visual Studio 2012 (compiler and IDE)

Open a Visual Studio Command Prompt. Checkout the Box Backup source code, for example:

git clone --depth 0 https://github.com/boxbackup/boxbackup.git

Create an out-of-tree build directory, enter it, and start building Box Backup and its source-code dependencies (takes about 15 minutes):

mkdir cmake
cd cmake
cmake ..\boxbackup\infrastructure\cmake\windows -G "Visual Studio 11 2012 Win64"
cmake --build . --config release

Now run all the tests:

cd build\boxbackup
ctest -C release -V

And if these are successful, go ahead and build your binary packages:

cmake --build . --config release --target package

Installation

Create the destination directory, C:\Program Files\Box Backup\bbackupd.

Write a configuration file, keys and certificate on a Unix machine, and copy them into the Box Backup directory, together with the following files from the base directory:

  • boxbackup\Release\bbackupd.exe
  • boxbackup\Release\bbackupquery.exe
  • boxbackup\Release\bbackupctl.exe
  • boxbackup\Release\bbstoreaccounts.exe

Ensure that the user running Box Backup can read from the Box Backup directory, and write to the bbackupd directory inside it.

Run Box Backup by running bbackupd.exe from the command-line, or double-clicking on it, and check that it connects to the server. If the application exits immediately, it's probably due to a problem with the configuration file - check the Windows Event Viewer for details.

See also the service installation and upgrade instructions on the CompilationOnWindows page.

Last modified 16 months ago Last modified on Nov 21, 2017, 11:37:05 PM