Commit 202446
2025-03-18 12:59:25 Samuli Seppänen: -/-| /dev/null .. Pages/BuildingOnWindows.md | |
| @@ 0,0 1,54 @@ | |
| + | # MSVC builds |
| + | |
| + | For up-do-date instructions for your version of openvpn also check the file `README.cmake.md` in the openvpn source code. |
| + | |
| + | The following tools are expected to be present on the system, you |
| + | can install them with a package manager of your choice (e.g. |
| + | chocolatey, winget) or manually: |
| + | |
| + | * CMake (>= 3.21) |
| + | * Git |
| + | * Python (3.x), plus the Python module `docutils` |
| + | * Visual Studion 17 (2022), C/C++ Enviroment |
| + | |
| + | For example, to prepare the required tools with chocolatey, you |
| + | can use the following commands (Powershell): |
| + | |
| + | ``` |
| + | # Installing Chocolatey |
| + | 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')) |
| + | & choco.exe install -y git --params "/GitAndUnixToolsOnPath" |
| + | & choco.exe install -y python |
| + | & python.exe -m ensurepip |
| + | & python.exe -m pip install --upgrade pip |
| + | & python.exe -m pip install docutils |
| + | & choco.exe install -y cmake --installargs 'ADD_CMAKE_TO_PATH=System' |
| + | & choco.exe install -y "visualstudio2022buildtools" |
| + | & 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" |
| + | & choco.exe install -y windows-sdk-10-version-2004-windbg |
| + | ``` |
| + | |
| + | One or more restarts of Powershell might be required to pick up new additions |
| + | to `PATH` between steps. A Windows restart is probably required after |
| + | installing Visual Studio before being able to use it. |
| + | You can find the exact commands we use to set up the community build machines |
| + | at https://github.com/OpenVPN/openvpn-buildbot/blob/master/jenkins/windows-server/msibuild.pkr.hcl |
| + | |
| + | To do a default build, assuming you are in a MSVC 17 2022 environment: |
| + | |
| + | ``` |
| + | mkdir C:\OpenVPN |
| + | cd C:\OpenVPN |
| + | git clone https://github.com/microsoft/vcpkg.git |
| + | git clone https://github.com/OpenVPN/openvpn.git |
| + | set VCPKG_ROOT=C:\OpenVPN\vcpkg |
| + | cd openvpn |
| + | cmake --preset win-amd64-release |
| + | cmake --build --preset win-amd64-release |
| + | ctest --preset win-amd64-release |
| + | ``` |
| + | |
| + | When using the presets, the build directory is |
| + | `out/build/<preset-name>/`, you can find the output files there. |
| + | No install support is provided directly in OpenVPN build, take a look |
| + | at https://github.com/OpenVPN/openvpn-build.git instead. |
