mirror of
https://github.com/open-quantum-safe/liboqs.git
synced 2025-10-04 00:02:01 -04:00
Improved support for Mingw-w64 (#648)
* Build fixed through Mingw-w64 * Initial try to build using appveyor and MSYS2
This commit is contained in:
parent
fc1bd942a3
commit
cd24c784a3
@ -57,6 +57,9 @@ if(CMAKE_C_COMPILER_ID STREQUAL "Clang" OR
|
||||
CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcolor-diagnostics -Wno-missing-braces -Wno-missing-field-initializers")
|
||||
endif()
|
||||
if(MINGW OR MSYS OR CYGWIN)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-maybe-uninitialized")
|
||||
endif()
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
|
||||
endif()
|
||||
|
14
appveyor-build.bat
Normal file
14
appveyor-build.bat
Normal file
@ -0,0 +1,14 @@
|
||||
@echo off
|
||||
IF %COMPILER%==msys2 (
|
||||
@echo on
|
||||
SET "PATH=C:\msys64\mingw64\bin;%PATH%"
|
||||
bash -lc "cd ${APPVEYOR_BUILD_FOLDER} && mkdir build && cd build && cmake .. -GNinja -DBUILD_SHARED_LIBS=%BUILD_SHARED% && ninja"
|
||||
)
|
||||
IF %COMPILER%==msvc2019 (
|
||||
@echo on
|
||||
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -GNinja -DBUILD_SHARED_LIBS=%BUILD_SHARED%
|
||||
ninja
|
||||
)
|
41
appveyor.yml
41
appveyor.yml
@ -8,35 +8,32 @@ platform: x64
|
||||
branches:
|
||||
except:
|
||||
- /master-new-.*/
|
||||
|
||||
init:
|
||||
- call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
|
||||
- set PATH="C:\\Python37";"C:\\Python37\Scripts";%PATH%
|
||||
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
- BUILD_SHARED: OFF
|
||||
COMPILER: msvc2019
|
||||
- BUILD_SHARED: ON
|
||||
COMPILER: msvc2019
|
||||
- BUILD_SHARED: OFF
|
||||
COMPILER: msys2
|
||||
- BUILD_SHARED: ON
|
||||
COMPILER: msys2
|
||||
|
||||
before_build:
|
||||
- cmd: |-
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -G"Ninja" -DBUILD_SHARED_LIBS=%BUILD_SHARED%
|
||||
build_script:
|
||||
- ninja
|
||||
|
||||
- cmd: '%APPVEYOR_BUILD_FOLDER%\appveyor-build.bat'
|
||||
|
||||
before_test:
|
||||
- python -m pip install pytest pytest-xdist
|
||||
|
||||
- cmd: |-
|
||||
SET "PATH=C:\Python37;C:\Python37\Scripts;%PATH%"
|
||||
pip.exe install pytest pytest-xdist
|
||||
|
||||
test_script:
|
||||
- cmd: >-
|
||||
cd %APPVEYOR_BUILD_FOLDER%\build
|
||||
|
||||
set PATH=%cd%\bin;%PATH% && ninja run_tests
|
||||
- cmd: |-
|
||||
cd %APPVEYOR_BUILD_FOLDER%\build
|
||||
set PATH=%cd%\bin;%PATH% && ninja run_tests
|
||||
|
||||
after_test:
|
||||
- ps: >-
|
||||
$wc = New-Object 'System.Net.WebClient'
|
||||
|
||||
$wc.UploadFile("https://ci.appveyor.com/api/testresults/xunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\test-results\pytest\test-results.xml))
|
||||
- ps: |-
|
||||
$wc = New-Object 'System.Net.WebClient'
|
||||
$wc.UploadFile("https://ci.appveyor.com/api/testresults/xunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\test-results\pytest\test-results.xml))
|
||||
|
@ -92,11 +92,11 @@ OQS_API void OQS_MEM_insecure_free(void *ptr);
|
||||
* an API specification but when an implementation doesn't actually use the argument
|
||||
* and we'd get a compiler warning otherwise.
|
||||
*/
|
||||
#if defined(_WIN32)
|
||||
#define UNUSED
|
||||
// __attribute__ not supported in VS
|
||||
#else
|
||||
#ifdef __GNUC__
|
||||
#define UNUSED __attribute__((unused))
|
||||
#else
|
||||
// __attribute__ not supported in VS
|
||||
#define UNUSED
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
@ -144,6 +144,11 @@ static __inline unsigned int is_digit_lessthan_ct(digit_t x, digit_t y) { // Is
|
||||
|
||||
#elif (TARGET == TARGET_AMD64 && OS_TARGET == OS_WIN)
|
||||
|
||||
#if defined(__MINGW64__)
|
||||
#include <x86intrin.h>
|
||||
#include <psdk_inc/intrin-impl.h>
|
||||
#endif
|
||||
|
||||
// Digit multiplication
|
||||
#define MUL(multiplier, multiplicand, hi, lo) \
|
||||
(lo) = _umul128((multiplier), (multiplicand), (hi));
|
||||
|
@ -2,7 +2,7 @@ if (MINGW OR MSYS OR CYGWIN)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__USE_MINGW_ANSI_STDIO=1 -Wno-unknown-pragmas -Wno-unused-parameter")
|
||||
endif()
|
||||
|
||||
if(NOT WIN32 OR MINGW OR MSYS OR CYGWIN)
|
||||
if(NOT WIN32)
|
||||
set(LIBM m)
|
||||
|
||||
if(OQS_USE_OPENSSL)
|
||||
|
@ -8,10 +8,10 @@
|
||||
|
||||
#include "system_info.c"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define UNUSED
|
||||
#else
|
||||
#ifdef __GNUC__
|
||||
#define UNUSED __attribute__((unused))
|
||||
#else
|
||||
#define UNUSED
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user