mirror of
https://github.com/amnezia-vpn/openvpn3.git
synced 2026-05-17 00:16:12 +03:00
CMake: add CMakePresets.json and switch GHA to use it
For now define vcpkg builds for MSVC and MinGW
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
(cherry picked from commit 63499ba7ac)
This commit is contained in:
committed by
Yuriy Darnobyt
parent
f845f7dd95
commit
25ca35d71d
74
.github/workflows/msbuild.yml
vendored
74
.github/workflows/msbuild.yml
vendored
@@ -11,7 +11,6 @@ jobs:
|
||||
env:
|
||||
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
|
||||
BUILD_CONFIGURATION: Release
|
||||
buildDir: '${{ github.workspace }}/build'
|
||||
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
@@ -24,29 +23,64 @@ jobs:
|
||||
- name: Restore from cache and install vcpkg
|
||||
uses: lukka/run-vcpkg@v6
|
||||
with:
|
||||
setupOnly: true
|
||||
vcpkgGitCommitId: 'd8d61c941c333a147edffdcbdc9964dc0c0962f5'
|
||||
additionalCachedPaths: ${{ env.buildDir }}/vcpkg_installed
|
||||
appendedCacheKey: ${{ matrix.arch }}-${{ hashFiles( '**/vcpkg.json' ) }}
|
||||
vcpkgGitCommitId: '36fb23307e10cc6ffcec566c46c4bb3f567c82c6'
|
||||
vcpkgJsonGlob: '**/windows/vcpkg.json'
|
||||
|
||||
- name: Run CMake with vcpkg.json manifest
|
||||
uses: lukka/run-cmake@v3
|
||||
env:
|
||||
VCPKG_OVERLAY_PORTS: '${{ github.workspace }}/deps/vcpkg-ports'
|
||||
uses: lukka/run-cmake@v10
|
||||
with:
|
||||
useVcpkgToolchainFile: true
|
||||
buildDirectory: '${{ env.buildDir }}'
|
||||
buildWithCMake: true
|
||||
cmakeAppendedArgs: '-DCLI_OVPNDCOWIN=ON'
|
||||
cmakeBuildType: ${{env.BUILD_CONFIGURATION}}
|
||||
configurePreset: win-${{ matrix.arch }}-release
|
||||
buildPreset: win-${{ matrix.arch }}-release
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: openvpn3-${{ matrix.arch }}
|
||||
name: openvpn3-msvc-${{ matrix.arch }}
|
||||
path: |
|
||||
${{ env.buildDir }}/**/*.exe
|
||||
${{ env.buildDir }}/**/*.dll
|
||||
!${{ env.buildDir }}/test/ssl/**
|
||||
!${{ env.buildDir }}/test/unittests/**
|
||||
!${{ env.buildDir }}/CMakeFiles/**
|
||||
!${{ env.buildDir }}/vcpkg_installed/**
|
||||
${{ github.workspace }}/build/**/*.exe
|
||||
${{ github.workspace }}/build/**/*.dll
|
||||
!${{ github.workspace }}/build/**/test/ssl/**
|
||||
!${{ github.workspace }}/build/**/test/unittests/**
|
||||
!${{ github.workspace }}/build/**/CMakeFiles/**
|
||||
!${{ github.workspace }}/build/**/vcpkg_installed/**
|
||||
mingw:
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [x86, x64]
|
||||
|
||||
env:
|
||||
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: lukka/get-cmake@latest
|
||||
|
||||
- name: Install dependencies
|
||||
run: sudo apt update && sudo apt install -y mingw-w64 unzip cmake build-essential
|
||||
|
||||
- name: Restore from cache and install vcpkg
|
||||
uses: lukka/run-vcpkg@v10
|
||||
with:
|
||||
vcpkgGitCommitId: '36fb23307e10cc6ffcec566c46c4bb3f567c82c6'
|
||||
vcpkgJsonGlob: '**/mingw/vcpkg.json'
|
||||
|
||||
- name: Run CMake with vcpkg.json manifest
|
||||
uses: lukka/run-cmake@v10
|
||||
with:
|
||||
configurePreset: mingw-${{ matrix.arch }}-release
|
||||
buildPreset: mingw-${{ matrix.arch }}-release
|
||||
|
||||
- name: List $RUNNER_WORKSPACE after build
|
||||
run: find $RUNNER_WORKSPACE
|
||||
shell: bash
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: openvpn3-mingw-${{ matrix.arch }}
|
||||
path: |
|
||||
${{ github.workspace }}/build/**/*.exe
|
||||
${{ github.workspace }}/build/**/*.dll
|
||||
!${{ github.workspace }}/build/**/test/ssl/**
|
||||
!${{ github.workspace }}/build/**/test/unittests/**
|
||||
!${{ github.workspace }}/build/**/CMakeFiles/**
|
||||
!${{ github.workspace }}/build/**/vcpkg_installed/**
|
||||
|
||||
234
CMakePresets.json
Normal file
234
CMakePresets.json
Normal file
@@ -0,0 +1,234 @@
|
||||
{
|
||||
"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}/deps/vcpkg-triplets",
|
||||
"type": "FILEPATH"
|
||||
},
|
||||
"VCPKG_OVERLAY_PORTS": {
|
||||
"value": "${sourceDir}/deps/vcpkg-ports",
|
||||
"type": "FILEPATH"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "base-windows",
|
||||
"hidden": true,
|
||||
"generator": "Visual Studio 17 2022",
|
||||
"cacheVariables": {
|
||||
"CLI_OVPNDCOWIN": {
|
||||
"value": "ON",
|
||||
"type": "BOOL"
|
||||
},
|
||||
"VCPKG_MANIFEST_DIR": "${sourceDir}/deps/vcpkg_manifests/windows"
|
||||
},
|
||||
"vendor": { "microsoft.com/VisualStudioSettings/CMake/1.0": { "hostOS": [ "Windows" ] } }
|
||||
},
|
||||
{
|
||||
"name": "base-mingw",
|
||||
"hidden": true,
|
||||
"generator": "Unix Makefiles",
|
||||
"cacheVariables": {
|
||||
"CMAKE_SYSTEM_NAME": {
|
||||
"value": "Windows",
|
||||
"type": "STRING"
|
||||
},
|
||||
"CLI_OVPNDCOWIN": {
|
||||
"value": "ON",
|
||||
"type": "BOOL"
|
||||
},
|
||||
"VCPKG_MANIFEST_DIR": "${sourceDir}/deps/vcpkg_manifests/mingw"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "x64",
|
||||
"hidden": true,
|
||||
"binaryDir": "build/msvc/amd64",
|
||||
"architecture": {
|
||||
"value": "x64"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "x64-mingw",
|
||||
"hidden": true,
|
||||
"binaryDir": "build/mingw/x64",
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": {
|
||||
"value": "x86_64-w64-mingw32-gcc-posix",
|
||||
"type": "STRING"
|
||||
},
|
||||
"CMAKE_CXX_COMPILER": {
|
||||
"value": "x86_64-w64-mingw32-g++-posix",
|
||||
"type": "STRING"
|
||||
},
|
||||
"VCPKG_TARGET_TRIPLET": "x64-mingw-dynamic"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "arm64",
|
||||
"hidden": true,
|
||||
"binaryDir": "build/msvc/arm64",
|
||||
"architecture": {
|
||||
"value": "arm64"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "x86",
|
||||
"hidden": true,
|
||||
"binaryDir": "build/msvc/x86",
|
||||
"architecture": {
|
||||
"value": "Win32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "i686-mingw",
|
||||
"hidden": true,
|
||||
"binaryDir": "build/mingw/x86",
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": {
|
||||
"value": "i686-w64-mingw32-gcc-posix",
|
||||
"type": "STRING"
|
||||
},
|
||||
"CMAKE_CXX_COMPILER": {
|
||||
"value": "i686-w64-mingw32-g++-posix",
|
||||
"type": "STRING"
|
||||
},
|
||||
"VCPKG_TARGET_TRIPLET": "x86-mingw-dynamic"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "debug",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "release",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "asan",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "ASAN"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "mingw-x64-debug",
|
||||
"inherits": [ "base", "base-mingw", "x64-mingw", "debug" ]
|
||||
},
|
||||
{
|
||||
"name": "mingw-x64-release",
|
||||
"inherits": [ "base", "base-mingw", "x64-mingw", "release" ]
|
||||
},
|
||||
{
|
||||
"name": "mingw-x86-debug",
|
||||
"inherits": [ "base", "base-mingw", "i686-mingw", "debug" ]
|
||||
},
|
||||
{
|
||||
"name": "mingw-x86-release",
|
||||
"inherits": [ "base", "base-mingw", "i686-mingw", "release" ]
|
||||
},
|
||||
{
|
||||
"name": "win-amd64-debug",
|
||||
"inherits": [ "base", "base-windows", "x64", "debug" ]
|
||||
},
|
||||
{
|
||||
"name": "win-arm64-debug",
|
||||
"inherits": [ "base", "base-windows", "arm64", "debug" ]
|
||||
},
|
||||
{
|
||||
"name": "win-amd64_arm64-debug",
|
||||
"inherits": [ "base", "base-windows", "arm64", "debug" ]
|
||||
},
|
||||
{
|
||||
"name": "win-x86-debug",
|
||||
"inherits": [ "base", "base-windows", "x86", "debug" ]
|
||||
},
|
||||
{
|
||||
"name": "win-amd64-release",
|
||||
"inherits": [ "base", "base-windows", "x64", "release" ]
|
||||
},
|
||||
{
|
||||
"name": "win-arm64-release",
|
||||
"inherits": [ "base", "base-windows", "arm64", "release" ]
|
||||
},
|
||||
{
|
||||
"name": "win-amd64_arm64-release",
|
||||
"inherits": [ "base", "base-windows", "arm64", "release" ]
|
||||
},
|
||||
{
|
||||
"name": "win-x86-release",
|
||||
"inherits": [ "base", "base-windows", "x86", "release" ]
|
||||
}
|
||||
],
|
||||
"buildPresets": [
|
||||
{
|
||||
"name": "mingw-x64-debug",
|
||||
"configurePreset": "mingw-x64-debug",
|
||||
"configuration": "Debug"
|
||||
},
|
||||
{
|
||||
"name": "mingw-x86-debug",
|
||||
"configurePreset": "mingw-x86-debug",
|
||||
"configuration": "Debug"
|
||||
},
|
||||
{
|
||||
"name": "mingw-x64-release",
|
||||
"configurePreset": "mingw-x64-release",
|
||||
"configuration": "Release"
|
||||
},
|
||||
{
|
||||
"name": "mingw-x86-release",
|
||||
"configurePreset": "mingw-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": "win-amd64-release",
|
||||
"configurePreset": "win-amd64-release",
|
||||
"configuration": "Release"
|
||||
},
|
||||
{
|
||||
"name": "win-arm64-release",
|
||||
"configurePreset": "win-arm64-release",
|
||||
"configuration": "Release"
|
||||
},
|
||||
{
|
||||
"name": "win-amd64_arm64-release",
|
||||
"configurePreset": "win-arm64-release",
|
||||
"configuration": "Release"
|
||||
},
|
||||
{
|
||||
"name": "win-x86-release",
|
||||
"configurePreset": "win-x86-release",
|
||||
"configuration": "Release"
|
||||
}
|
||||
]
|
||||
}
|
||||
13
deps/vcpkg_manifests/mingw/vcpkg.json
vendored
Normal file
13
deps/vcpkg_manifests/mingw/vcpkg.json
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
|
||||
"name": "openvpn3",
|
||||
"version-string": "3.8",
|
||||
"dependencies": [
|
||||
"asio",
|
||||
"jsoncpp",
|
||||
"lz4",
|
||||
"openssl",
|
||||
"tap-windows6",
|
||||
"xxhash"
|
||||
]
|
||||
}
|
||||
15
deps/vcpkg_manifests/windows/vcpkg.json
vendored
Normal file
15
deps/vcpkg_manifests/windows/vcpkg.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
|
||||
"name": "openvpn3",
|
||||
"version-string": "3.8",
|
||||
"dependencies": [
|
||||
"asio",
|
||||
"gtest",
|
||||
"jsoncpp",
|
||||
"lz4",
|
||||
"openssl",
|
||||
"tap-windows6",
|
||||
"xxhash"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user