openvpn/CMakePresets.json
Frank Lichtenheld 96ca5a5a2a CMake: backport CMake buildsystem from master to release/2.6
This is based on the initial CMake patch by
Arne Schwabe, but extends that to provide
a complete replacement for existing MinGW
build (autotools based) and MSVC build
(openvpn.sln).

The following features are added while switching
these builds to CMake:
 - vcpkg support for MinGW build, allowing for
   trivial cross-compilation on Linux
 - Add unittests to MSVC build
 - Rework MSVC config header generation, removing
   need for separate headers between autotools
   and MSVC

The following advantages are reasons for switching
to CMake over the existing MSVC build:
 - Easier to maintain CMake files without IDE
   than the sln and vcxproj files
 - Able to maintain MSVC and MinGW build side-by-side

The plan is to completely remove the existing MSVC
build system but leave the existing autotools builds
in place as-is, including MinGW support.

CMake is not the intended build system for Unix-like
platforms and there are no current plans to switch
to it.

This commits squashes a lot of commits from master
together, since most of them are just fixes or
enhancements for the original CMake commit. The
decisions was not to bloat the release/2.6 commit
history with these detours.

It contains the following commits:
- add basic CMake based build
  (commit 0134184012 by
   Arne Schwabe)
- CMake: Add complete MinGW and MSVC build
  (commit e8881ec6dd)
- CMake: Add /Brepro to MSVC link options
  (commit 5e94e8de4b)
- Do not blindly assume python3 is also the interpreter that runs rst2html
  (commit 5dbec1c019 by
   Arne Schwabe)
- Only add -Wno-stringop-truncation on supported compilers
  (commit eb3cd5ea36 by
   Arne Schwabe)
- CMake: Throw a clear error when config.h in top-level source directory
  (commit 0652ae84f4)
- openvpnmsica: link C runtime statically
  (commit 3be4986ea3 by
   Lev Stipakov)
- CMake: Support doc builds on Windows machines that do not have .py file association
  (commit 22213a8834)
- README.cmake.md: Add new documentation for CMake buildsystem
  (commit 53055fd23e)
- Check if the -wrap argument is actually supported by the platform's ld
  (commit 4ef76f0ee4 by
   Arne Schwabe)
- GHA: update to run-vcpkg@v11
  (commit 66e33ee81d)
- GHA: refactor mingw UTs and add missing tls_crypt
  (commit 26c663f128)
- CMake: various small non-functional improvements
  (commit 95cc5faa16)
- CMake: fix broken daemonization and syslog functionality
  (commit 8ae6c48d5d)
- CMake: fix HAVE_DAEMON detection on Linux
  (commit e363b393f2)

Change-Id: I6de18261d5dc7f8561612184059656c73f33a5f2
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Co-authored-by: Arne Schwabe <arne@rfc2549.org>
Co-authored-by: Lev Stipakov <lev@openvpn.net>
Message-Id: <20230926095030.29779-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg27107.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2023-09-26 17:39:51 +02:00

228 lines
6.6 KiB
JSON

{
"version": 3,
"configurePresets": [
{
"name": "base",
"hidden": true,
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": {
"value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"type": "FILEPATH"
},
"VCPKG_OVERLAY_TRIPLETS": {
"value": "${sourceDir}/contrib/vcpkg-triplets",
"type": "FILEPATH"
},
"VCPKG_OVERLAY_PORTS": {
"value": "${sourceDir}/contrib/vcpkg-ports",
"type": "FILEPATH"
}
}
},
{
"name": "base-windows",
"hidden": true,
"binaryDir": "${sourceDir}/out/build/${presetName}",
"generator": "Visual Studio 17 2022",
"cacheVariables": {
"VCPKG_MANIFEST_DIR": "${sourceDir}/contrib/vcpkg-manifests/windows",
"VCPKG_HOST_TRIPLET": "x64-windows"
},
"vendor": { "microsoft.com/VisualStudioSettings/CMake/1.0": { "hostOS": [ "Windows" ] } }
},
{
"name": "base-mingw",
"hidden": true,
"generator": "Ninja Multi-Config",
"cacheVariables": {
"CMAKE_SYSTEM_NAME": {
"value": "Windows",
"type": "STRING"
},
"VCPKG_MANIFEST_DIR": "${sourceDir}/contrib/vcpkg-manifests/mingw"
}
},
{
"name": "x64",
"hidden": true,
"architecture": {
"value": "x64",
"strategy": "set"
},
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-windows-ovpn"
}
},
{
"name": "x64-mingw",
"hidden": true,
"binaryDir": "out/build/mingw/x64",
"cacheVariables": {
"CMAKE_C_COMPILER": {
"value": "x86_64-w64-mingw32-gcc",
"type": "STRING"
},
"CMAKE_CXX_COMPILER": {
"value": "x86_64-w64-mingw32-g++",
"type": "STRING"
},
"VCPKG_TARGET_TRIPLET": "x64-mingw-ovpn"
}
},
{
"name": "arm64",
"hidden": true,
"architecture": {
"value": "arm64",
"strategy": "set"
},
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "arm64-windows-ovpn"
}
},
{
"name": "x86",
"hidden": true,
"architecture": {
"value": "Win32",
"strategy": "set"
},
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x86-windows-ovpn"
}
},
{
"name": "i686-mingw",
"hidden": true,
"binaryDir": "out/build/mingw/x86",
"cacheVariables": {
"CMAKE_C_COMPILER": {
"value": "i686-w64-mingw32-gcc",
"type": "STRING"
},
"CMAKE_CXX_COMPILER": {
"value": "i686-w64-mingw32-g++",
"type": "STRING"
},
"VCPKG_TARGET_TRIPLET": "x86-mingw-ovpn"
}
},
{
"name": "debug",
"hidden": true,
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "release",
"hidden": true,
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "mingw-x64",
"inherits": [ "base", "base-mingw", "x64-mingw" ]
},
{
"name": "mingw-x86",
"inherits": [ "base", "base-mingw", "i686-mingw" ]
},
{
"name": "win-amd64-release",
"inherits": [ "base", "base-windows", "x64", "release" ]
},
{
"name": "win-arm64-release",
"inherits": [ "base", "base-windows", "arm64", "release" ]
},
{
"name": "win-x86-release",
"inherits": [ "base", "base-windows", "x86", "release" ]
},
{
"name": "win-amd64-debug",
"inherits": [ "base", "base-windows", "x64", "debug" ]
},
{
"name": "win-arm64-debug",
"inherits": [ "base", "base-windows", "arm64", "debug" ]
},
{
"name": "win-x86-debug",
"inherits": [ "base", "base-windows", "x86", "debug" ]
},
{
"name": "unix-native",
"generator": "Ninja Multi-Config",
"binaryDir": "out/build/unix"
}
],
"buildPresets": [
{
"name": "mingw-x64",
"configurePreset": "mingw-x64"
},
{
"name": "mingw-x86",
"configurePreset": "mingw-x86"
},
{
"name": "win-amd64-release",
"configurePreset": "win-amd64-release",
"configuration": "Release"
},
{
"name": "win-arm64-release",
"configurePreset": "win-arm64-release",
"configuration": "Release"
},
{
"name": "win-x86-release",
"configurePreset": "win-x86-release",
"configuration": "Release"
},
{
"name": "win-amd64-debug",
"configurePreset": "win-amd64-debug",
"configuration": "Debug"
},
{
"name": "win-arm64-debug",
"configurePreset": "win-arm64-debug",
"configuration": "Debug"
},
{
"name": "win-x86-debug",
"configurePreset": "win-x86-debug",
"configuration": "Debug"
},
{
"name": "unix-native",
"configurePreset": "unix-native"
}
],
"testPresets": [
{
"name": "win-amd64-release",
"configurePreset": "win-amd64-release"
},
{
"name": "win-x86-release",
"configurePreset": "win-x86-release"
},
{
"name": "win-amd64-debug",
"configurePreset": "win-amd64-debug"
},
{
"name": "win-x86-debug",
"configurePreset": "win-x86-debug"
},
{
"name": "unix-native",
"configurePreset": "unix-native"
}
]
}