mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-22 17:39:53 +03:00
Add CMakeSettings.json to facilitate VS configuration
Update build instructions for Windows
This commit is contained in:
parent
900947bd08
commit
ca226cdc9d
141
CMakeSettings.json
Normal file
141
CMakeSettings.json
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
{
|
||||||
|
"environments": [ { "BuildNumber": "5180" } ],
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "x64-native",
|
||||||
|
"description": "Target x64 with 64-bit compiler",
|
||||||
|
"generator": "Ninja",
|
||||||
|
"configurationType": "RelWithDebInfo",
|
||||||
|
"inheritEnvironments": [ "clang_cl_x64_x64" ],
|
||||||
|
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||||
|
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||||
|
"cmakeCommandArgs": "",
|
||||||
|
"buildCommandArgs": "",
|
||||||
|
"ctestCommandArgs": "",
|
||||||
|
"variables": [
|
||||||
|
{
|
||||||
|
"name": "BUILD_NUMBER",
|
||||||
|
"value": "${env.BuildNumber}",
|
||||||
|
"type": "STRING"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CMAKE_C_COMPILER",
|
||||||
|
"value": "${env.VCINSTALLDIR}Tools/Llvm/x64/bin/clang-cl.exe",
|
||||||
|
"type": "FILEPATH"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CMAKE_CXX_COMPILER",
|
||||||
|
"value": "${env.VCINSTALLDIR}Tools/Llvm/x64/bin/clang-cl.exe",
|
||||||
|
"type": "FILEPATH"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "VCPKG_TARGET_TRIPLET",
|
||||||
|
"value": "x64-windows-static-md",
|
||||||
|
"type": "STRING"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "x86-on-x64",
|
||||||
|
"description": "Target x86 with 64-bit compiler",
|
||||||
|
"generator": "Ninja",
|
||||||
|
"configurationType": "RelWithDebInfo",
|
||||||
|
"inheritEnvironments": [ "clang_cl_x86_x64" ],
|
||||||
|
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||||
|
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||||
|
"cmakeCommandArgs": "",
|
||||||
|
"buildCommandArgs": "",
|
||||||
|
"ctestCommandArgs": "",
|
||||||
|
"variables": [
|
||||||
|
{
|
||||||
|
"name": "BUILD_NUMBER",
|
||||||
|
"value": "${env.BuildNumber}",
|
||||||
|
"type": "STRING"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CMAKE_C_COMPILER",
|
||||||
|
"value": "${env.VCINSTALLDIR}Tools/Llvm/x64/bin/clang-cl.exe",
|
||||||
|
"type": "FILEPATH"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CMAKE_CXX_COMPILER",
|
||||||
|
"value": "${env.VCINSTALLDIR}Tools/Llvm/x64/bin/clang-cl.exe",
|
||||||
|
"type": "FILEPATH"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "VCPKG_TARGET_TRIPLET",
|
||||||
|
"value": "x86-windows-static-md",
|
||||||
|
"type": "STRING"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "x64-on-x86",
|
||||||
|
"description": "Target x64 with 32-bit compiler",
|
||||||
|
"generator": "Ninja",
|
||||||
|
"configurationType": "RelWithDebInfo",
|
||||||
|
"inheritEnvironments": [ "clang_cl_x64" ],
|
||||||
|
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||||
|
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||||
|
"cmakeCommandArgs": "",
|
||||||
|
"buildCommandArgs": "",
|
||||||
|
"ctestCommandArgs": "",
|
||||||
|
"variables": [
|
||||||
|
{
|
||||||
|
"name": "BUILD_NUMBER",
|
||||||
|
"value": "${env.BuildNumber}",
|
||||||
|
"type": "STRING"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CMAKE_C_COMPILER",
|
||||||
|
"value": "${env.VCINSTALLDIR}Tools/Llvm/bin/clang-cl.exe",
|
||||||
|
"type": "FILEPATH"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CMAKE_CXX_COMPILER",
|
||||||
|
"value": "${env.VCINSTALLDIR}Tools/Llvm/bin/clang-cl.exe",
|
||||||
|
"type": "FILEPATH"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "VCPKG_TARGET_TRIPLET",
|
||||||
|
"value": "x64-windows-static-md",
|
||||||
|
"type": "STRING"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "x86-native",
|
||||||
|
"description": "Target x86 with 32-bit compiler",
|
||||||
|
"generator": "Ninja",
|
||||||
|
"configurationType": "RelWithDebInfo",
|
||||||
|
"inheritEnvironments": [ "clang_cl_x86" ],
|
||||||
|
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||||
|
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||||
|
"cmakeCommandArgs": "",
|
||||||
|
"buildCommandArgs": "",
|
||||||
|
"ctestCommandArgs": "",
|
||||||
|
"variables": [
|
||||||
|
{
|
||||||
|
"name": "BUILD_NUMBER",
|
||||||
|
"value": "${env.BuildNumber}",
|
||||||
|
"type": "STRING"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CMAKE_C_COMPILER",
|
||||||
|
"value": "${env.VCINSTALLDIR}Tools/Llvm/bin/clang-cl.exe",
|
||||||
|
"type": "FILEPATH"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CMAKE_CXX_COMPILER",
|
||||||
|
"value": "${env.VCINSTALLDIR}Tools/Llvm/bin/clang-cl.exe",
|
||||||
|
"type": "FILEPATH"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "VCPKG_TARGET_TRIPLET",
|
||||||
|
"value": "x86-windows-static-md",
|
||||||
|
"type": "STRING"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -1,31 +1,90 @@
|
|||||||
How to build SoftEther VPN for Windows
|
How to build SoftEther VPN for Windows
|
||||||
======================================
|
======================================
|
||||||
|
|
||||||
Full Build Instructions
|
There are several methods for using CMake but the easiest by far is through Visual Studio by importing the CMake project directly
|
||||||
-----------------------
|
|
||||||
|
|
||||||
There are several methods for using CMake but the easiest by far is through Visual Studio 2019 by importing the CMake project directly
|
|
||||||
into it. So that is what will be described below.
|
into it. So that is what will be described below.
|
||||||
|
|
||||||
Requirements:
|
## Requirements
|
||||||
|
|
||||||
1. Download Visual Studio 2019 (Community Edition is fine).
|
- Visual Studio 2019 or 2022 (Community Edition is fine)
|
||||||
2. During install, make sure to check "Desktop development with C++" under "Workloads".
|
|
||||||
3. Click on individual components and scroll until you see "Visual C++ tools for CMake" under the compilers section. Make sure this is checked.
|
|
||||||
4. Proceed with and finish Visual Studio 2019 installation.
|
|
||||||
5. Install the needed submodules to build the project, avoiding CMake telling you to do so with: `git submodule update --init --recursive`
|
|
||||||
|
|
||||||
Building:
|
https://visualstudio.microsoft.com/downloads
|
||||||
|
|
||||||
Once both installs have finished, launch Visual Studio. Once its started go to the File menu click `Open --> CMake`. Then navigate to where you
|
- Git for Windows (or other git tool)
|
||||||
cloned the project and open the `CMakeLists.txt` file in the projects root directory.
|
|
||||||
|
|
||||||
Visual Studio will proceed to start the CMake configuration process and once its finished, you can simply go to toolbar and click `CMake -> Build All`.
|
https://gitforwindows.org/
|
||||||
|
|
||||||
Once it has finished, hopefully with no errors, look in the newly created `/build` directory in the project's folder. Inside are the development versions
|
- vcpkg
|
||||||
of all the SoftEtherVPN components.
|
|
||||||
|
|
||||||
Congrats, you now have a complete CMake development environment for SoftEtherVPN on Windows, enjoy and happy contributing!
|
https://github.com/microsoft/vcpkg
|
||||||
|
|
||||||
Download Links:
|
## Installation
|
||||||
- Visual Studio 2019 from Microsoft: https://visualstudio.microsoft.com/downloads
|
|
||||||
|
- 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
|
||||||
|
```
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|
||||||
|
1. 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.
|
||||||
|
|
||||||
|
1. 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.
|
||||||
|
|
||||||
|
1. 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.
|
||||||
|
|
||||||
|
1. When *CMake generation finished* is displayed, simply go to toolbar and click **Build -> Build All**.
|
||||||
|
|
||||||
|
1. 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.
|
||||||
|
|
||||||
|
1. Congrats, you now have a complete CMake development environment for SoftEtherVPN on Windows, enjoy and happy contributing!
|
||||||
|
Loading…
Reference in New Issue
Block a user