diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml index 7403258..1abe1eb 100644 --- a/.github/workflows/msbuild.yml +++ b/.github/workflows/msbuild.yml @@ -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: diff --git a/.gitignore b/.gitignore index 1776075..b1c4b4f 100644 --- a/.gitignore +++ b/.gitignore @@ -33,4 +33,5 @@ missing .vs x64 -Debug \ No newline at end of file +Debug +out \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index f34f4f5..befbf4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) \ No newline at end of file diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..73f3a94 --- /dev/null +++ b/CMakePresets.json @@ -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" + } + ] +} diff --git a/vcpkg_manifests/openssl_1.1.1/vcpkg.json b/vcpkg_manifests/openssl_1.1.1/vcpkg.json new file mode 100644 index 0000000..a9764bb --- /dev/null +++ b/vcpkg_manifests/openssl_1.1.1/vcpkg.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/vcpkg_manifests/openssl_3/vcpkg.json b/vcpkg_manifests/openssl_3/vcpkg.json new file mode 100644 index 0000000..96db2ed --- /dev/null +++ b/vcpkg_manifests/openssl_3/vcpkg.json @@ -0,0 +1,7 @@ +{ + "name": "openvpn-gui", + "version-string": "0.0.1", + "dependencies": [ + "openssl" + ] +} \ No newline at end of file