Skip to content

Commit 52ad091

Browse files
committed
support for msys2 CI under AppVeyor
1 parent d444542 commit 52ad091

File tree

4 files changed

+65
-31
lines changed

4 files changed

+65
-31
lines changed

.appveyor/appveyor_build.bat

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
@echo off
2+
IF %COMPILER%==msvc2019 (
3+
@echo on
4+
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
5+
cd %APPVEYOR_BUILD_FOLDER%
6+
mkdir build
7+
cd build
8+
cmake .. -DLIBOQS_INCLUDE_DIR="C:\%LIBOQS_INCLUDE_DIR%" -DLIBOQS_LIB_DIR="C:\%LIBOQS_LIB_DIR%"
9+
msbuild -verbosity:minimal oqs_cpp.sln
10+
cd ../unit_tests
11+
mkdir build
12+
cd build
13+
cmake .. -DLIBOQS_INCLUDE_DIR="C:\%LIBOQS_INCLUDE_DIR%" -DLIBOQS_LIB_DIR="C:\%LIBOQS_LIB_DIR%"
14+
msbuild -verbosity:minimal oqs_cpp_testing.sln
15+
%APPVEYOR_BUILD_FOLDER%\build\Debug\kem.exe
16+
%APPVEYOR_BUILD_FOLDER%\build\Debug\rand.exe
17+
%APPVEYOR_BUILD_FOLDER%\build\Debug\sig.exe
18+
)
19+
IF %COMPILER%==msys2 (
20+
@echo on
21+
SET "PATH=C:\msys64\mingw64\bin;%PATH%"
22+
cd %APPVEYOR_BUILD_FOLDER%
23+
bash -lc 'ls /c/%LIBOQS_INCLUDE_DIR%'
24+
mkdir build
25+
cd build
26+
bash -lc "cmake .. -DLIBOQS_INCLUDE_DIR=/c/%LIBOQS_INCLUDE_DIR% -DLIBOQS_LIB_DIR=/c/%LIBOQS_LIB_DIR% -GNinja && ninja"
27+
cd ../unit_tests
28+
mkdir build
29+
cd build
30+
bash -lc "cmake .. -DLIBOQS_INCLUDE_DIR=/c/%LIBOQS_INCLUDE_DIR% -DLIBOQS_LIB_DIR=/c/%LIBOQS_LIB_DIR% -GNinja && ninja"
31+
%APPVEYOR_BUILD_FOLDER%\build\kem.exe
32+
%APPVEYOR_BUILD_FOLDER%\build\rand.exe
33+
%APPVEYOR_BUILD_FOLDER%\build\sig.exe
34+
)

.appveyor/appveyor_test.bat

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@echo off
2+
IF %COMPILER%==msvc2019 (
3+
%APPVEYOR_BUILD_FOLDER%\unit_tests\build\tests\Debug\oqs_cpp_testing.exe
4+
)
5+
IF %COMPILER%==msys2 (
6+
%APPVEYOR_BUILD_FOLDER%\unit_tests\build\tests\oqs_cpp_testing.exe
7+
)

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,13 @@ The examples in the [`examples`](https://github.com/open-quantum-safe/liboqs-cpp
4747
Building on POSIX (Linux/UNIX-like) platforms
4848
---------------------------------------------
4949

50-
First, you must build the master branch of liboqs according to the [liboqs building instructions](https://github.com/open-quantum-safe/liboqs#linuxmacos) with shared library support enabled (add `-DBUILD_SHARED_LIBS=ON` to the `cmake` command), followed (optionally) by a `sudo ninja install` to ensure that the compiled library is visible system-wide (by default it installs under `/usr/local/include` and `/usr/local/lib` on Linux/macOS).
50+
First, you must build the master branch of liboqs according to the [liboqs building instructions](https://github.com/open-quantum-safe/liboqs#linuxmacos) with shared library support enabled (add `-DBUILD_SHARED_LIBS=ON` to the `cmake` command), followed (optionally) by a `sudo ninja install` to ensure that the shared library is visible system-wide (by default it installs under `/usr/local/include` and `/usr/local/lib` on Linux/macOS).
51+
52+
You may need to set the `LD_LIBRARY_PATH` (`DYLD_LIBRARY_PATH` on macOS) environment variable to point to the path to liboqs' library directory, e.g.
53+
54+
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
55+
56+
assuming `liboqs.so.*` were installed in `/usr/local/lib` (true if you ran `sudo ninja install` after building liboqs).
5157

5258
Next, to use the wrapper, you simply `#include "oqs_cpp.h"` in your program. The wrapper contains
5359
a CMake build system for both examples and unit tests. To compile and run the examples, create a `build` directory inside the root directory of the project, change
@@ -73,11 +79,13 @@ The above commands build `tests/oqs_cpp_testing` suite of unit tests. Again you
7379
Building on Windows
7480
-------------------
7581

76-
We provide CMake support for Visual Studio. We recommend using Visual Studio 2017 or later (preferably Visual Studio 2019). For comprehensive details about using CMake with Visual Studio please read [this page](https://docs.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio?view=vs-2019).
77-
78-
---
82+
We provide CMake support for Visual Studio. We recommend using Visual Studio 2017 or later (preferably Visual Studio 2019). For comprehensive details about using CMake with Visual Studio please read [this page](https://docs.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio?view=vs-2019).
7983

80-
Note: in case you built `liboqs` as a shared library, add the directory that contains `oqs.dll` (e.g. `C:\Users\yourusername\Documents\GitHub\liboqs\build\bin`) to the `PATH` environment variable.
84+
Ensure that the liboqs shared library `oqs.dll` is visible system-wide. Use the "Edit the system environment variables" Control Panel tool or type in a Command Prompt
85+
86+
set PATH="%PATH%;C:\some\dir\liboqs\build\bin"
87+
88+
of course replacing the paths with the ones corresponding to your system.
8189

8290
Documentation
8391
-------------

appveyor.yml

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,26 @@ platform: x64
77
environment:
88
LIBOQS_INSTALL_PATH: C:\liboqs
99
LIBOQS_BUILD_DIR: C:\liboqs\build
10-
LIBOQS_INCLUDE_DIR: C:\liboqs\build\include
11-
LIBOQS_LIB_DIR: C:\liboqs\build\lib
1210
LIBOQS_DLL_DIR: C:\liboqs\build\bin
11+
LIBOQS_INCLUDE_DIR: liboqs/build/include
12+
LIBOQS_LIB_DIR: liboqs/build/lib
13+
matrix:
14+
- compiler: msvc2019
15+
- compiler: msys2
1316

14-
before_build:
17+
install:
1518
- cmd: |-
1619
@echo on
17-
set "PATH=C:\Python37;C:\Python37\Scripts;%LIBOQS_DLL_DIR%;%PATH%"
18-
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
20+
set "PATH=%LIBOQS_DLL_DIR%;%PATH%"
21+
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
1922
git clone https://github.com/open-quantum-safe/liboqs %LIBOQS_INSTALL_PATH%
2023
mkdir %LIBOQS_BUILD_DIR%
2124
cd %LIBOQS_BUILD_DIR%
22-
cmake -DCMAKE_BUILD_TYPE=Optimized .. -G"Ninja" -DBUILD_SHARED_LIBS=ON
25+
cmake .. -DCMAKE_BUILD_TYPE=Optimized -DBUILD_SHARED_LIBS=ON -G"Ninja"
2326
ninja 1> nul
2427
2528
build_script:
26-
- cmd: |-
27-
cd %APPVEYOR_BUILD_FOLDER%
28-
mkdir build
29-
cd build
30-
cmake -DLIBOQS_INCLUDE_DIR=%LIBOQS_INCLUDE_DIR% -DLIBOQS_LIB_DIR=%LIBOQS_LIB_DIR% ..
31-
msbuild -verbosity:minimal oqs_cpp.sln
32-
%APPVEYOR_BUILD_FOLDER%\build\Debug\kem.exe
33-
%APPVEYOR_BUILD_FOLDER%\build\Debug\rand.exe
34-
%APPVEYOR_BUILD_FOLDER%\build\Debug\sig.exe
35-
36-
before_test:
37-
- cmd: |-
38-
cd %APPVEYOR_BUILD_FOLDER%\unit_tests
39-
mkdir build
40-
cd build
41-
cmake -DLIBOQS_INCLUDE_DIR=%LIBOQS_INCLUDE_DIR% -DLIBOQS_LIB_DIR=%LIBOQS_LIB_DIR% ..
42-
msbuild -verbosity:minimal oqs_cpp_testing.sln
43-
29+
- cmd: '%APPVEYOR_BUILD_FOLDER%\.appveyor\appveyor_build.bat'
4430

4531
test_script:
46-
- cmd: |-
47-
%APPVEYOR_BUILD_FOLDER%\unit_tests\build\tests\Debug\oqs_cpp_testing.exe
32+
- cmd: '%APPVEYOR_BUILD_FOLDER%\.appveyor\appveyor_test.bat'

0 commit comments

Comments
 (0)