Skip to content

Commit 6aa4e78

Browse files
malytomaszpostfacto
authored andcommitted
test multiple crypto libraries on multiple versions of windows
1 parent 6e7ec28 commit 6aa4e78

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,13 @@ jobs:
3333

3434
build-and-test-windows:
3535
#if: false # Temporarily disable
36-
name: Build And Test Windows
37-
runs-on: windows-latest
36+
name: Build And Test Windows ${{ matrix.os-version }} ${{ matrix.crypto }}
37+
runs-on: windows-${{ matrix.os-version }}
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
os-version: [2019, 2022]
42+
crypto: [OpenSSL, BCrypt]
3843
env:
3944
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
4045
steps:
@@ -65,7 +70,7 @@ jobs:
6570
run: |
6671
mkdir build
6772
cd build
68-
cmake -S .. -G Ninja -DBUILD_TESTS=ON -DBUILD_EXAMPLES=ON -DBUILD_TOOLS=ON -DCMAKE_TOOLCHAIN_FILE=${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake
73+
cmake -S .. -G Ninja -DBUILD_TESTS=ON -DBUILD_EXAMPLES=ON -DBUILD_TOOLS=ON -DCMAKE_TOOLCHAIN_FILE=${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake -DUSE_CRYPTO=${{matrix.crypto}}
6974
shell: cmd
7075

7176
# Mark all directories as safe so checkouts performed in CMakeLists.txt don't cause "unsafe repository" errors.

CMakeLists.txt

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,17 @@ if (WIN32)
8484
string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
8585
string(REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
8686

87-
#
88-
# Check whether BCrypt can be used with this SDK version
89-
#
90-
cmake_push_check_state()
91-
set(CMAKE_REQUIRED_LIBRARIES bcrypt)
92-
check_symbol_exists(BCryptEncrypt windows.h BCRYPT_AVAILABLE)
93-
cmake_pop_check_state()
94-
if (NOT BCRYPT_AVAILABLE AND USE_CRYPTO STREQUAL "BCrypt")
95-
message(FATAL_ERROR "You're on Windows but BCrypt seems to be unavailable, you will need OpenSSL")
87+
if (USE_CRYPTO STREQUAL "BCrypt")
88+
#
89+
# Check whether BCrypt can be used with this SDK version
90+
#
91+
cmake_push_check_state()
92+
set(CMAKE_REQUIRED_LIBRARIES bcrypt)
93+
check_symbol_exists(BCryptEncrypt windows.h BCRYPT_AVAILABLE)
94+
cmake_pop_check_state()
95+
if (NOT BCRYPT_AVAILABLE)
96+
message(FATAL_ERROR "You're on Windows but BCrypt seems to be unavailable, you will need OpenSSL")
97+
endif()
9698
endif()
9799
endif()
98100

0 commit comments

Comments
 (0)