Skip to content

Commit

Permalink
CI & cmake changes for Windows (#263)
Browse files Browse the repository at this point in the history
* Fix OQS_ADDL_SOCKET_LIBS setting for cmake

* Test Windows 2019 with VS 16 2019

* Add path for VS

* Avoid openssl cache conflict

* Add build type into matrix

---------

Co-authored-by: a <[email protected]>
  • Loading branch information
qnfm and a authored Sep 24, 2023
1 parent f332584 commit 9d4faab
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 1 deletion.
104 changes: 104 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,3 +199,107 @@ jobs:
name: oqs-provider-msvc
path: D:/a/oqs-provider/oqs-provider/_build/lib/oqsprovider.dll

msvc_native:
# Run a job for each of the specified target architectures:
strategy:
matrix:
os:
- windows-2019
- windows-2022
platform:
- arch: win64
oqsconfig: -DOQS_ALGS_ENABLED=STD
osslconfig: no-shared no-fips VC-WIN64A
toolchain:
- .CMake/toolchain_windows_amd64.cmake
msarch:
- x64
type:
- Debug
- Release
runs-on: ${{matrix.os}}
steps:
- name: Restore native OpenSSL32 cache
id: cache-openssl32n
uses: actions/cache@v3
with:
path: c:\openssl32n
key: ${{ runner.os }}-msvcopenssl32n
- uses: actions/checkout@v3
- name: Checkout OpenSSL master
if: steps.cache-openssl32n.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
set-safe-directory: true
repository: openssl/openssl
path: openssl
- uses: actions/checkout@v3
with:
set-safe-directory: true
repository: open-quantum-safe/liboqs
path: liboqs
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.platform.arch }}
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1
with:
msbuild-architecture: ${{matrix.msarch}}
vs-version: '[16.10,]'
- name: Setup nasm for OpenSSL build
uses: ilammy/setup-nasm@v1
if: steps.cache-openssl32n.outputs.cache-hit != 'true'
with:
platform: ${{ matrix.platform.arch }}
- name: Setup perl for OpenSSL build
uses: shogo82148/actions-setup-perl@v1
if: steps.cache-openssl32n.outputs.cache-hit != 'true'
- name: build liboqs
run: |
cmake --version
cmake -B build --toolchain ${{ matrix.toolchain }} .
cmake --build build
cmake --build build --target INSTALL
working-directory: liboqs
- name: prepare the OpenSSL build directory
if: steps.cache-openssl32n.outputs.cache-hit != 'true'
run: mkdir _build
working-directory: openssl
- name: OpenSSL config
if: steps.cache-openssl32n.outputs.cache-hit != 'true'
working-directory: openssl\_build
run: |
perl ..\Configure --banner=Configured --prefix=c:\openssl32n no-makedepend ${{ matrix.platform.osslconfig }}
perl configdata.pm --dump
- name: OpenSSL build
if: steps.cache-openssl32n.outputs.cache-hit != 'true'
working-directory: openssl\_build
run: nmake /S
- name: OpenSSL install
# Run on 64 bit only as 32 bit is slow enough already
if: steps.cache-openssl32n.outputs.cache-hit != 'true'
run: |
mkdir c:\openssl32n
nmake install_sw
working-directory: openssl\_build
- name: Save OpenSSL
id: cache-openssl-save
if: steps.cache-openssl32n.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: |
c:\openssl32n
key: ${{ runner.os }}-msvcopenssl32n
- name: build oqs-provider
run: |
cmake -DCMAKE_BUILD_TYPE=${{ matrix.type }} -DCMAKE_C_FLAGS="/wd5105" -DOPENSSL_ROOT_DIR="c:\openssl32n" -Dliboqs_DIR="c:\liboqs\lib\cmake\liboqs" -S . -B _build
cmake --build _build --config=${{ matrix.type }}
- name: Run tests
run: |
ctest --test-dir _build -C ${{ matrix.type }}
- name: Retain oqsprovider.dll
uses: actions/upload-artifact@v3
with:
name: oqs-provider-msvc
path: D:/a/oqs-provider/oqs-provider/_build/lib/oqsprovider.dll

2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if(MSVC)
"${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:LIBCMT")
add_definitions(-DOQS_PROVIDER_NOATOMIC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
set(OQS_ADDL_SOCKET_LIBS "ws2_32.lib gdi32.lib crypt32.lib")
set(OQS_ADDL_SOCKET_LIBS ws2_32.lib gdi32.lib crypt32.lib)
else()
add_compile_options(-Wunused-function)
set(OQS_ADDL_SOCKET_LIBS "")
Expand Down
4 changes: 4 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
include(GNUInstallDirs)
if (CMAKE_GENERATOR MATCHES "Visual Studio")
set(OQS_PROV_BINARY_DIR ${CMAKE_BINARY_DIR}/lib/${CMAKE_BUILD_TYPE})
else()
set(OQS_PROV_BINARY_DIR ${CMAKE_BINARY_DIR}/lib)
endif()

add_test(
NAME oqs_signatures
Expand Down

0 comments on commit 9d4faab

Please sign in to comment.