Blame
| 202446 | Samuli Seppänen | 2025-03-18 12:59:25 | 1 | # MSVC builds |
| 2 | ||||
| 3 | For up-do-date instructions for your version of openvpn also check the file `README.cmake.md` in the openvpn source code. |
|||
| 4 | ||||
| 5 | The following tools are expected to be present on the system, you |
|||
| 6 | can install them with a package manager of your choice (e.g. |
|||
| 7 | chocolatey, winget) or manually: |
|||
| 8 | ||||
| 9 | * CMake (>= 3.21) |
|||
| 10 | * Git |
|||
| 11 | * Python (3.x), plus the Python module `docutils` |
|||
| 12 | * Visual Studion 17 (2022), C/C++ Enviroment |
|||
| 13 | ||||
| 14 | For example, to prepare the required tools with chocolatey, you |
|||
| 15 | can use the following commands (Powershell): |
|||
| 16 | ||||
| 17 | ``` |
|||
| 18 | # Installing Chocolatey |
|||
| 19 | Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) |
|||
| 20 | & choco.exe install -y git --params "/GitAndUnixToolsOnPath" |
|||
| 21 | & choco.exe install -y python |
|||
| 22 | & python.exe -m ensurepip |
|||
| 23 | & python.exe -m pip install --upgrade pip |
|||
| 24 | & python.exe -m pip install docutils |
|||
| 25 | & choco.exe install -y cmake --installargs 'ADD_CMAKE_TO_PATH=System' |
|||
| 26 | & choco.exe install -y "visualstudio2022buildtools" |
|||
| 27 | & choco.exe install -y "visualstudio2022-workload-vctools" --params "--add Microsoft.VisualStudio.Component.UWP.VC.ARM64 --add Microsoft.VisualStudio.Component.VC.Tools.ARM64 --add Microsoft.VisualStudio.Component.VC.ATL.Spectre --add Microsoft.VisualStudio.Component.VC.ATLMFC.Spectre --add Microsoft.VisualStudio.Component.VC.ATL.ARM64.Spectre --add Microsoft.VisualStudio.Component.VC.MFC.ARM64.Spectre --add Microsoft.VisualStudio.Component.VC.Runtimes.ARM64.Spectre --add Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre --quiet" |
|||
| 28 | & choco.exe install -y windows-sdk-10-version-2004-windbg |
|||
| 29 | ``` |
|||
| 30 | ||||
| 31 | One or more restarts of Powershell might be required to pick up new additions |
|||
| 32 | to `PATH` between steps. A Windows restart is probably required after |
|||
| 33 | installing Visual Studio before being able to use it. |
|||
| 34 | You can find the exact commands we use to set up the community build machines |
|||
| 35 | at https://github.com/OpenVPN/openvpn-buildbot/blob/master/jenkins/windows-server/msibuild.pkr.hcl |
|||
| 36 | ||||
| 37 | To do a default build, assuming you are in a MSVC 17 2022 environment: |
|||
| 38 | ||||
| 39 | ``` |
|||
| 40 | mkdir C:\OpenVPN |
|||
| 41 | cd C:\OpenVPN |
|||
| 42 | git clone https://github.com/microsoft/vcpkg.git |
|||
| 43 | git clone https://github.com/OpenVPN/openvpn.git |
|||
| 44 | set VCPKG_ROOT=C:\OpenVPN\vcpkg |
|||
| 45 | cd openvpn |
|||
| 46 | cmake --preset win-amd64-release |
|||
| 47 | cmake --build --preset win-amd64-release |
|||
| 48 | ctest --preset win-amd64-release |
|||
| 49 | ``` |
|||
| 50 | ||||
| 51 | When using the presets, the build directory is |
|||
| 52 | `out/build/<preset-name>/`, you can find the output files there. |
|||
| 53 | No install support is provided directly in OpenVPN build, take a look |
|||
| 54 | at https://github.com/OpenVPN/openvpn-build.git instead. |
