Blame
| 0899cd | Samuli Seppänen | 2025-02-28 14:15:18 | 1 | # Building the OpenVPN-GUI on Windows |
| 2 | ||||
| 3 | This is the recommended way of building openvpn-gui on Windows, which is also used when doing OpenVPN Windows releases. |
|||
| 4 | ||||
| 5 | ## Prerequisites |
|||
| 6 | ||||
| 7 | - Visual Studio 2019 (build tools should be enough, also 2022 will likely work) |
|||
| 8 | - CMake |
|||
| 9 | - vcpkg (add the environment variable ``VCPKG_ROOT`` which points to vcpkg installation) |
|||
| 10 | ||||
| 11 | ## Build steps |
|||
| 12 | ||||
| 13 | Run inside MSVC command prompt: |
|||
| 14 | ||||
| 15 | ||||
| 16 | ``` |
|||
| 17 | c:\Temp\openvpn-gui>cmake -S . --preset x64-release-ossl3 |
|||
| 18 | c:\Temp\openvpn-gui>cmake --build --preset x64-release-ossl3 |
|||
| 19 | ``` |
|||
| 20 | ||||
| 21 | ||||
| 22 | To see all presets, run: |
|||
| 23 | ||||
| 24 | ||||
| 25 | ``` |
|||
| 26 | C:\Users\lev\Projects\openvpn-gui>cmake -S c:\Users\lev\Projects\openvpn-gui --list-presets |
|||
| 27 | Available configure presets: |
|||
| 28 | "x64-debug-ossl3" |
|||
| 29 | "x64-debug-ossl1.1.1" |
|||
| 30 | "arm64-debug-ossl3" |
|||
| 31 | "arm64-debug-ossl1.1.1" |
|||
| 32 | "x86-debug-ossl3" |
|||
| 33 | "x86-debug-ossl1.1.1" |
|||
| 34 | "x64-release-ossl3" |
|||
| 35 | "x64-release-ossl1.1.1" |
|||
| 36 | "arm64-release-ossl3" |
|||
| 37 | "arm64-release-ossl1.1.1" |
|||
| 38 | "x86-release-ossl3" |
|||
| 39 | "x86-release-ossl1.1.1" |
|||
| 40 | ``` |
|||
| 41 | ||||
| 42 | You could also open CMake project from MSVC IDE and build from there. |
|||
| 43 | ||||
| 44 | # Building OpenVPN-GUI on Linux |
|||
| 45 | ||||
| 46 | 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. |
|||
| 47 | ||||
| 48 | ---- |
|||
| 49 | ||||
| 50 | 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/. |
|||
| 51 | ||||
| 52 | These instructions have been tested on Debian Jessie with automake, mingw-w64 and dependencies installed. |
|||
| 53 | ||||
| 54 | **Steps -- building for 64 bit windows** |
|||
| 55 | ||||
| 56 | Starting from a clone of the gui repo from github, do |
|||
| 57 | ||||
| 58 | ```$ autoreconf -i -v``` |
|||
| 59 | ||||
| 60 | Run configure as |
|||
| 61 | ||||
| 62 | ```$ ./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"``` |
|||
| 63 | ||||
| 64 | Replace, $HOME/windows by the location of openssl include and libs. If disabling change-password is ok, run configure as |
|||
| 65 | ||||
| 66 | ```$ ./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./"``` |
|||
| 67 | ||||
| 68 | Then run make: |
|||
| 69 | ||||
| 70 | ```$ make``` |
|||
| 71 | ||||
| 72 | Optionally use -j n with make. |
|||
| 73 | ||||
| 74 | 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). |
