Changes between Version 2 and Version 3 of BuildingUsingMsvcBuildsystem
- Timestamp:
- 10/01/18 08:01:50 (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
BuildingUsingMsvcBuildsystem
v2 v3 5 5 MSVC buildsystem is a part of [https://github.com/OpenVPN/openvpn-build openvpn-build subproject] in [https://github.com/ GitHub]. It allows building OpenVPN and all it's dependencies on a Windows box with minimal dependencies. 6 6 7 '''NOTE:''' This buildsystem is not officially supported, and you're strongly encouraged to use the [wiki:BuildingUsingGenericBuildsystem cross-compile buildsystem] instead. If you really need to build OpenVPN using MSVC and encounter any issues, please send email to the [http://sourceforge.net/mail/?group_id=48978 openvpn-devel mailinglist].8 9 7 = Setting up the build computer = 10 8 11 MSVC build was written with least dependencies in mind. You'll need only [http://www.activestate.com/activeperl Perl] and Visual Studio 201 0 (Express). Once dependencies have been installed, launch Git Bash and follow [wiki:BuildingUsingGenericBuildsystem#Checkingoutopenvpn-buildrepository these instructions] to checkout [https://github.com/OpenVPN/openvpn-build openvpn-build] repository, which contains the MSVC buildsystem.9 MSVC build was written with least dependencies in mind. You'll need only [http://www.activestate.com/activeperl Perl] and Visual Studio 2017 (Community or Professional). Once dependencies have been installed, launch Git Bash and follow [wiki:BuildingUsingGenericBuildsystem#Checkingoutopenvpn-buildrepository these instructions] to checkout [https://github.com/OpenVPN/openvpn-build openvpn-build] repository, which contains the MSVC buildsystem. 12 10 13 11 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: 14 12 15 13 {{{ 16 set OPENVPN_GIT=git://openvpn.git.sourceforge.net/gitroot/openvpn/openvpn.git 17 set OPENVPN_SOURCE=git 18 set OPENVPN_BRANCH=master 14 set GITHUB_USER=johndoe&& set OPENVPN_VERSION=vs2017&& build.bat 19 15 }}} 20 16 … … 22 18 = Building using MSVC buildsystem = 23 19 24 == Building everything ==25 26 20 Descend to the ''openvpn-build/msvc'' directory and build: 27 21 28 22 {{{ 29 23 > cd openvpn-build/msvc 30 > build 24 > build.bat 31 25 }}} 32 33 26 34 27 This fetches all the dependencies, builds them and builds OpenVPN. 35 28 36 == Building dependencies only == 37 38 To build only dependencies (helpful for developers): 29 To build only dependencies: 39 30 40 31 {{{ 41 > set DO_ONLY_DEPS=true 42 > set TARGET=c:\Temp\build-deps 43 > build 32 > set MODE=DEPS&& build.bat 44 33 }}} 45 34 46 == Build OpenVPN manually == 47 48 Provided you built the dependencies you can use the MSVC build system within OpenVPN tree, edit ''build-env-local.bat'' which is loaded by ''build.bat''. The variables defined in ''build-env-local.bat'' override the defaults given in ''build-env.bat''. For example, you can manually define the location of dependencies: 35 To build only openvpn (assuming dependencies are already built): 49 36 50 37 {{{ 51 set OPENVPN_DEPROOT=c:\Temp\build-deps 38 > set MODE=OPENVPN&& build.bat 52 39 }}} 53 40 54 Then open IDE using: 41 = Using Visual Studio IDE = 42 43 After command-line build you can use Visual Studio IDE - just open 55 44 56 45 {{{ 57 > msvc-dev46 > openvpn-build\msvc\build.tmp\openvpn-<branch>\openvpn.sln 58 47 }}} 59 48 60 Or build using: 49 Note that by default build.bat builds dependencies for x64 architecture, so don't 50 forget to set "Solution Platforms" to "x64". 61 51 52 When running openvpn from IDE, you either need to copy dependencies (libeay32.dll etc) from 62 53 {{{ 63 > msvc-build54 > openvpn-build\msvc\image\bin 64 55 }}} 56 to 57 {{{ 58 > openvpn-build\msvc\build.tmp\openvpn-vs2017\x64-Output\Debug 59 }}} 60 or change "Working Directory" to openvpn-build\msvc\image\bin.