Skip to content

Latest commit

 

History

History
127 lines (70 loc) · 3.91 KB

BUILD_WINDOWS.md

File metadata and controls

127 lines (70 loc) · 3.91 KB

How to build SoftEther VPN for Windows

There are several methods for using CMake but the easiest by far is through Visual Studio by importing the CMake project directly into it. So that is what will be described below.

Requirements

Installation

  • Visual Studio

    Download from the official site and run the installer.

    Make sure to check Desktop development with C++ under Workloads and Clang C++ Tools for Windows in Optional components.

  • Git

    Nothing special. Just follow the installer.

  • vcpkg

    Let's say you will install it to C:\vcpkg.

    Open your preferred terminal and go to C:\. Then run these commands.

    C:\> git clone https://github.com/microsoft/vcpkg
    C:\> cd vcpkg
    C:\vcpkg> bootstrap-vcpkg.bat
    C:\vcpkg> vcpkg integrate install
    

Update

  • vcpkg

    You are recommended to update vcpkg from time to time, so that the latest libraries are used in the build.

    Go to the installation path, pull the latest repo and the binary:

    C:\vcpkg> git pull
    C:\vcpkg> bootstrap-vcpkg.bat
    

Building

  1. Launch Visual Studio

    Choose either Clone a repository to clone from GitHub or Open a local folder if you already have a copy.

  2. Open Terminal (View -> Terminal). Install the needed submodules to build the project, avoiding CMake telling you to do so with:

    git submodule update --init --recursive

    Note: This step is not necessary if you have chosen Clone a repository as Visual Studio automatically takes care of it.

  3. Switch to folder view in the solution explorer

  4. Select a configuration from the dropdown menu below the search box. The default configurations are:

    • x64-native

      Build x64 executables with 64-bit compiler (most common)

    • x64-on-x86

      Cross compile x64 executables with 32-bit compiler

    • x86-native

      Build x86 executables with 32-bit compiler

    • x86-on-x64

      Cross compile x86 executables with 64-bit compiler

    On 64-bit Windows, all four configurations can be used. 32-bit platforms can only use 32-bit compiler.

  5. Visual Studio will try generating CMake cache. If not, click Project -> Configure Cache or Generate Cache.

    If CMake is busy, you will find Generate Cache greyed out. Wait until it finishes or click Cancel CMake Cache Generation to stop it.

    The initial configuration will take a longer time since it needs to download and install dependencies.

  6. When CMake generation finished is displayed, simply go to toolbar and click Build -> Build All.

  7. Once building has finished, hopefully with no errors, look in the newly created /build directory in the project's folder.

    Run vpnsetup.exe to install desired components.

  8. Congrats, you now have a complete CMake development environment for SoftEtherVPN on Windows, enjoy and happy contributing!

Notes

  1. Build number

    You can change the build number in CMakeSettings.json. Use any integer no less than 5180.

    Delete and regenerate CMake cache after the change.

  2. 32-bit Windows

    You don't need 32-bit Windows to build 32-bit executables. However, if 32-bit Windows is what you only have, things become a little complicated.

    Visual Studio 2019 is the last version that works on 32-bit Windows. It does the job but its bundled CMake and Ninja are 64-bit versions.

    After the installation of VS 2019, you need to download 32-bit CMake and Ninja and replace those that come with VS in:

    C:\Program Files\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake
    

    Currently CMake has an official x86 installer but Ninja does not. You may need to download from a 3rd party or build from source.