Version 3 (modified by stipa, 4 years ago) (diff)



MSVC buildsystem is a part of openvpn-build subproject in GitHub. It allows building OpenVPN and all it's dependencies on a Windows box with minimal dependencies.

Setting up the build computer

MSVC build was written with least dependencies in mind. You'll need only Perl and Visual Studio 2017 (Community or Professional). Once dependencies have been installed, launch Git Bash and follow these instructions to checkout openvpn-build repository, which contains the MSVC buildsystem.

To customize the build options, refer to build-env.bat, it contains the defaults for building, most settings can be customized by setting environment variable before executing the build script. You can also configure the build to use a Git repository or tarball of your liking, for example:

set GITHUB_USER=johndoe&& set OPENVPN_VERSION=vs2017&& build.bat

Building using MSVC buildsystem

Descend to the openvpn-build/msvc directory and build:

> cd openvpn-build/msvc
> build.bat

This fetches all the dependencies, builds them and builds OpenVPN.

To build only dependencies:

> set MODE=DEPS&& build.bat

To build only openvpn (assuming dependencies are already built):

> set MODE=OPENVPN&& build.bat

Using Visual Studio IDE

After command-line build you can use Visual Studio IDE - just open

> openvpn-build\msvc\build.tmp\openvpn-<branch>\openvpn.sln

Note that by default build.bat builds dependencies for x64 architecture, so don't forget to set "Solution Platforms" to "x64".

When running openvpn from IDE, you either need to copy dependencies (libeay32.dll etc) from

> openvpn-build\msvc\image\bin


> openvpn-build\msvc\build.tmp\openvpn-vs2017\x64-Output\Debug

or change "Working Directory" to openvpn-build\msvc\image\bin.