# Building the OpenVPN-GUI on Windows This is the recommended way of building openvpn-gui on Windows, which is also used when doing OpenVPN Windows releases. ## Prerequisites - Visual Studio 2019 (build tools should be enough, also 2022 will likely work) - CMake - vcpkg (add the environment variable ``VCPKG_ROOT`` which points to vcpkg installation) ## Build steps Run inside MSVC command prompt: ``` c:\Temp\openvpn-gui>cmake -S . --preset x64-release-ossl3 c:\Temp\openvpn-gui>cmake --build --preset x64-release-ossl3 ``` To see all presets, run: ``` C:\Users\lev\Projects\openvpn-gui>cmake -S c:\Users\lev\Projects\openvpn-gui --list-presets Available configure presets: "x64-debug-ossl3" "x64-debug-ossl1.1.1" "arm64-debug-ossl3" "arm64-debug-ossl1.1.1" "x86-debug-ossl3" "x86-debug-ossl1.1.1" "x64-release-ossl3" "x64-release-ossl1.1.1" "arm64-release-ossl3" "arm64-release-ossl1.1.1" "x86-release-ossl3" "x86-release-ossl1.1.1" ``` You could also open CMake project from MSVC IDE and build from there. # Building OpenVPN-GUI on Linux This information is adapted from [Selva's](http://thread.gmane.org/gmane.network.openvpn.devel/10516/focus=10531) and [David's](http://thread.gmane.org/gmane.network.openvpn.devel/10516/focus=10531) emails to openvpn-devel mailing list. ---- Cross compiling on linux is possible. If the change-password feature is enabled (this is the default), openssl library built for the target (windows) is required. This may be cross-compiled from source or if you are building on Fedora, MinGW has a decent set of cross-compiled libraries available out of the box. The following assumes that the openssl library and include files are installed in $HOME/windows/. These instructions have been tested on Debian Jessie with automake, mingw-w64 and dependencies installed. **Steps -- building for 64 bit windows** Starting from a clone of the gui repo from github, do ```$ autoreconf -i -v``` Run configure as ```$ ./configure --prefix=/ --host=x86_64-w64-mingw32 --build=x86_64-pc-linux-gnu --program-prefix=* OPENSSL_CRYPTO_CFLAGS="-I $HOME/windows/include/" OPENSSL_CRYPTO_LIBS="-L $HOME/windows/lib/ -lcrypto"``` Replace, $HOME/windows by the location of openssl include and libs. If disabling change-password is ok, run configure as ```$ ./configure --prefix=/ --host=x86_64-w64-mingw32 --build=x86_64-pc-linux-gnu --program-prefix=* CFLAGS=-DDISABLE_CHANGE_PASSWORD OPENSSL_CRYPTO_LIBS="-L./" OPENSSL_CRYPTO_CFLAGS="-I./"``` Then run make: ```$ make``` Optionally use -j n with make. That will build openvpn-gui.exe. The exec can be installed manually by copying to the folder where other OpenVPN binaries are installed (```C:\Program Files\OpenVPN\bin``` by default).
