mirror of https://github.com/OpenVPN/openvpn-gui
Use vcpkg manifest and cmake presets
Manifest is a convenient way to automatically install dependencies. Since we have to support both OpenSSL 1.1.1 (for OpenVPN 2.5) and OpenSSL 3 (for coming OpenVPN 2.6) and manifest file name is hardcoded, we create two manifests and put them into different directories. To simplify build process, define configuration presets for arch (x86/x64/arm64), debug/release and oss1.1.1/ossl3. This way building is greatly simplified: cmake -S . --preset x64-debug-ossl3 cmake --build --preset x64-debug-ossl3 Update GitHub Actions script accordingly. Signed-off-by: Lev Stipakov <lev@openvpn.net>pull/500/head
parent
79f5cb91c6
commit
b6f26818a9
|
@ -6,60 +6,37 @@ jobs:
|
|||
msvc:
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [x86, amd64, amd64_arm64]
|
||||
ossl: [openssl, openssl3]
|
||||
include:
|
||||
- arch: amd64_arm64
|
||||
triplet: arm64
|
||||
- arch: x86
|
||||
triplet: x86
|
||||
- arch: amd64
|
||||
triplet: x64
|
||||
arch: [x86, x64, arm64]
|
||||
ossl: [ossl1.1.1, ossl3]
|
||||
|
||||
env:
|
||||
# Indicates the location of the vcpkg as a Git submodule of the project repository.
|
||||
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
|
||||
SOLUTION_FILE_PATH: .
|
||||
BUILD_CONFIGURATION: Release
|
||||
VCPKG_OVERLAY_PORTS: '${{ github.workspace }}/openvpn/contrib/vcpkg-ports'
|
||||
buildDir: '${{ github.workspace }}/build/'
|
||||
|
||||
name: "msvc - ${{matrix.triplet}} - ${{ matrix.ossl }}"
|
||||
runs-on: windows-latest
|
||||
name: 'msvc - ${{matrix.arch}} - ${{ matrix.ossl }}'
|
||||
runs-on: windows-2019
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: lukka/get-cmake@latest
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: ${{ matrix.arch }}
|
||||
|
||||
- name: Clone openvpn repo
|
||||
uses: actions/checkout@v2
|
||||
- name: Restore artifacts, or setup vcpkg (do not install any package)
|
||||
uses: lukka/run-vcpkg@v10
|
||||
with:
|
||||
repository: openvpn/openvpn
|
||||
path: openvpn
|
||||
vcpkgGitCommitId: "a5d6d145164e82e67fbf91a4a30f98699d30de63"
|
||||
appendedCacheKey: "${{ matrix.arch }} - ${{ matrix.ossl }}"
|
||||
|
||||
- name: Install dependencies
|
||||
uses: lukka/run-vcpkg@v7.4
|
||||
- name: Run CMake consuming CMakePreset.json and vcpkg.json by mean of vcpkg.
|
||||
uses: lukka/run-cmake@v10
|
||||
with:
|
||||
vcpkgGitCommitId: 'b18b17865cfb6bd24620a00f30691be6775abb96'
|
||||
vcpkgArguments: ${{ matrix.ossl }}
|
||||
vcpkgTriplet: '${{ matrix.triplet }}-windows'
|
||||
configurePreset: '${{ matrix.arch }}-release-${{ matrix.ossl }}'
|
||||
buildPreset: '${{ matrix.arch }}-release-${{ matrix.ossl }}'
|
||||
|
||||
- name: Build
|
||||
uses: lukka/run-cmake@v3
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
useVcpkgToolchainFile: true
|
||||
buildWithCMake: true
|
||||
cmakeBuildType: ${{env.BUILD_CONFIGURATION}}
|
||||
buildDirectory: ${{ env.buildDir }}
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: openvpn-gui_${{ matrix.triplet }}_${{ matrix.ossl }}
|
||||
name: openvpn-gui_${{ matrix.arch }}_${{ matrix.ossl }}
|
||||
path: |
|
||||
${{ env.buildDir }}/*.exe
|
||||
${{ env.buildDir }}/*.dll
|
||||
out/build/${{ matrix.arch }}-release-${{ matrix.ossl }}/*.dll
|
||||
out/build/${{ matrix.arch }}-release-${{ matrix.ossl }}/*.exe
|
||||
|
||||
mingw:
|
||||
strategy:
|
||||
|
|
|
@ -34,3 +34,4 @@ missing
|
|||
.vs
|
||||
x64
|
||||
Debug
|
||||
out
|
|
@ -1,5 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
if(NOT VCPKG_MANIFEST_DIR)
|
||||
set(VCPKG_MANIFEST_DIR ${CMAKE_SOURCE_DIR}/vcpkg_manifests/openssl_3)
|
||||
endif()
|
||||
|
||||
project(openvpn-gui C)
|
||||
|
||||
add_executable(${PROJECT_NAME} WIN32
|
||||
|
@ -66,3 +70,11 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE
|
|||
UNICODE
|
||||
WIN32_LEAN_AND_MEAN
|
||||
HAVE_CONFIG_H)
|
||||
|
||||
if(MSVC)
|
||||
# work around msvc generator Debug/Release directory ugliness, doesn't apply for Ninja
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/$<0:>
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/$<0:>
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/$<0:>)
|
||||
endif(MSVC)
|
|
@ -0,0 +1,173 @@
|
|||
{
|
||||
"version": 2,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "base",
|
||||
"hidden": true,
|
||||
"binaryDir": "${sourceDir}/out/build/${presetName}",
|
||||
"cacheVariables": {
|
||||
"CMAKE_TOOLCHAIN_FILE": {
|
||||
"value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
|
||||
"type": "FILEPATH"
|
||||
}
|
||||
},
|
||||
"vendor": { "microsoft.com/VisualStudioSettings/CMake/1.0": { "hostOS": [ "Windows" ] } }
|
||||
},
|
||||
{
|
||||
"name": "ossl3",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"VCPKG_MANIFEST_DIR": "${sourceDir}/vcpkg_manifests/openssl_3"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ossl1.1.1",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"VCPKG_MANIFEST_DIR": "${sourceDir}/vcpkg_manifests/openssl_1.1.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "x64",
|
||||
"generator": "Ninja",
|
||||
"hidden": true,
|
||||
"architecture": {
|
||||
"value": "x64",
|
||||
"strategy": "external"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "arm64",
|
||||
"generator": "Ninja",
|
||||
"hidden": true,
|
||||
"architecture": {
|
||||
"value": "arm64",
|
||||
"strategy": "external"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "x86",
|
||||
"generator": "Visual Studio 16 2019",
|
||||
"hidden": true,
|
||||
"architecture": {
|
||||
"value": "Win32"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "debug",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "release",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "x64-debug-ossl3",
|
||||
"inherits": [ "base", "ossl3", "x64", "debug" ]
|
||||
},
|
||||
{
|
||||
"name": "x64-debug-ossl1.1.1",
|
||||
"inherits": [ "base", "ossl1.1.1", "x64", "debug" ]
|
||||
},
|
||||
{
|
||||
"name": "arm64-debug-ossl3",
|
||||
"inherits": [ "base", "ossl3", "arm64", "debug" ]
|
||||
},
|
||||
{
|
||||
"name": "arm64-debug-ossl1.1.1",
|
||||
"inherits": [ "base", "ossl1.1.1", "arm64", "debug" ]
|
||||
},
|
||||
{
|
||||
"name": "x86-debug-ossl3",
|
||||
"inherits": [ "base", "ossl3", "x86", "debug" ]
|
||||
},
|
||||
{
|
||||
"name": "x86-debug-ossl1.1.1",
|
||||
"inherits": [ "base", "ossl1.1.1", "x86", "debug" ]
|
||||
},
|
||||
{
|
||||
"name": "x64-release-ossl3",
|
||||
"inherits": [ "base", "ossl3", "x64", "release" ]
|
||||
},
|
||||
{
|
||||
"name": "x64-release-ossl1.1.1",
|
||||
"inherits": [ "base", "ossl1.1.1", "x64", "release" ]
|
||||
},
|
||||
{
|
||||
"name": "arm64-release-ossl3",
|
||||
"inherits": [ "base", "ossl3", "arm64", "release" ]
|
||||
},
|
||||
{
|
||||
"name": "arm64-release-ossl1.1.1",
|
||||
"inherits": [ "base", "ossl1.1.1", "arm64", "release" ]
|
||||
},
|
||||
{
|
||||
"name": "x86-release-ossl3",
|
||||
"inherits": [ "base", "ossl3", "x86", "release" ]
|
||||
},
|
||||
{
|
||||
"name": "x86-release-ossl1.1.1",
|
||||
"inherits": [ "base", "ossl1.1.1", "x86", "release" ]
|
||||
}
|
||||
],
|
||||
"buildPresets": [
|
||||
{
|
||||
"name": "x64-release-ossl3",
|
||||
"configurePreset": "x64-release-ossl3"
|
||||
},
|
||||
{
|
||||
"name": "x64-release-ossl1.1.1",
|
||||
"configurePreset": "x64-release-ossl1.1.1"
|
||||
},
|
||||
{
|
||||
"name": "x86-release-ossl3",
|
||||
"configurePreset": "x86-release-ossl3",
|
||||
"configuration": "Release"
|
||||
},
|
||||
{
|
||||
"name": "x86-release-ossl1.1.1",
|
||||
"configurePreset": "x86-release-ossl1.1.1",
|
||||
"configuration": "Release"
|
||||
},
|
||||
{
|
||||
"name": "arm64-release-ossl3",
|
||||
"configurePreset": "arm64-release-ossl3"
|
||||
},
|
||||
{
|
||||
"name": "arm64-release-ossl1.1.1",
|
||||
"configurePreset": "arm64-release-ossl1.1.1"
|
||||
},
|
||||
{
|
||||
"name": "x64-debug-ossl3",
|
||||
"configurePreset": "x64-debug-ossl3"
|
||||
},
|
||||
{
|
||||
"name": "x64-debug-ossl1.1.1",
|
||||
"configurePreset": "x64-debug-ossl1.1.1"
|
||||
},
|
||||
{
|
||||
"name": "x86-debug-ossl3",
|
||||
"configurePreset": "x86-debug-ossl3",
|
||||
"configuration": "Debug"
|
||||
},
|
||||
{
|
||||
"name": "x86-debug-ossl1.1.1",
|
||||
"configurePreset": "x86-debug-ossl1.1.1",
|
||||
"configuration": "Debug"
|
||||
},
|
||||
{
|
||||
"name": "arm64-debug-ossl3",
|
||||
"configurePreset": "arm64-debug-ossl3"
|
||||
},
|
||||
{
|
||||
"name": "arm64-debug-ossl1.1.1",
|
||||
"configurePreset": "arm64-debug-ossl1.1.1"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"name": "openvpn-gui",
|
||||
"version-string": "0.0.1",
|
||||
"dependencies": [
|
||||
"openssl"
|
||||
],
|
||||
"builtin-baseline": "4b766c1cd17205e1b768c4fadfd5f867c1d0510e",
|
||||
"overrides": [
|
||||
{
|
||||
"name": "openssl",
|
||||
"version-string": "1.1.1n"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"name": "openvpn-gui",
|
||||
"version-string": "0.0.1",
|
||||
"dependencies": [
|
||||
"openssl"
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue