Changes between Version 123 and Version 124 of BuildingOnWindows


Ignore:
Timestamp:
08/13/24 15:38:36 (5 weeks ago)
Author:
flichtenheld
Comment:

Update page with CMake

Legend:

Unmodified
Added
Removed
Modified
  • BuildingOnWindows

    v123 v124  
    1 = Prerequisites =
     1= MSVC builds
    22
    3  * Visual Studio 2022 or Build Tools for Visual Studio
    4  * git
     3For up-do-date instructions for your version of openvpn also check the file `README.cmake.md` in the openvpn source code.
    54
    6 = Build steps =
     5The following tools are expected to be present on the system, you
     6can install them with a package manager of your choice (e.g.
     7chocolatey, winget) or manually:
    78
    8  * Clone openvpn repo
     9* CMake (>= 3.21)
     10* Git
     11* Python (3.x), plus the Python module `docutils`
     12* Visual Studion 17 (2022), C/C++ Enviroment
     13
     14For example, to prepare the required tools with chocolatey, you
     15can use the following commands (Powershell):
     16
    917{{{
    10 C:\Temp>git clone https://github.com/OpenVPN/openvpn.git
     18# Installing Chocolatey
     19Set-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
    1129}}}
    1230
    13  * Setup vcpkg
     31One or more restarts of Powershell might be required to pick up new additions
     32to `PATH` between steps. A Windows restart is probably required after
     33installing Visual Studio before being able to use it.
     34You can find the exact commands we use to set up the community build machines
     35at https://github.com/OpenVPN/openvpn-buildbot/blob/master/jenkins/windows-server/msibuild.pkr.hcl
     36
     37To do a default build, assuming you are in a MSVC 17 2022 environment:
     38
    1439{{{
    15 C:\Temp>git clone https://github.com/microsoft/vcpkg.git
    16 ...
    17 C:\Temp>cd vcpkg
    18 C:\Temp\vcpkg>bootstrap-vcpkg.bat
    19 ...
    20 C:\Temp\vcpkg>vcpkg integrate install
     40mkdir C:\OpenVPN
     41cd C:\OpenVPN
     42git clone https://github.com/microsoft/vcpkg.git
     43git clone https://github.com/OpenVPN/openvpn.git
     44set VCPKG_ROOT=C:\OpenVPN\vcpkg
     45cd openvpn
     46cmake --preset win-amd64-release
     47cmake --build --preset win-amd64-release
     48ctest --preset win-amd64-release
    2149}}}
    2250
    23  * Build openvpn
    24 
    25 Now you could just open solution file {{{ openvpn.sln}}} in Visual Studio and build from there, or build from VS Developer Command Prompt:
    26 
    27 {{{
    28 c:\Temp\openvpn>msbuild /p:Configuration=Release /p:Platform=x64
    29 }}}
    30 
    31 Supported platforms are x64, ARM64 and Win32.
     51When using the presets, the build directory is
     52`out/build/<preset-name>/`, you can find the output files there.
     53No install support is provided directly in OpenVPN build, take a look
     54at https://github.com/OpenVPN/openvpn-build.git instead.