mirror of
https://github.com/open-quantum-safe/liboqs.git
synced 2025-12-11 00:04:48 -05: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")
|
CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcolor-diagnostics -Wno-missing-braces -Wno-missing-field-initializers")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcolor-diagnostics -Wno-missing-braces -Wno-missing-field-initializers")
|
||||||
endif()
|
endif()
|
||||||
|
if(MINGW OR MSYS OR CYGWIN)
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-maybe-uninitialized")
|
||||||
|
endif()
|
||||||
if(BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
|
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
|
||||||
endif()
|
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
|
||||||
|
)
|
||||||
27
appveyor.yml
27
appveyor.yml
@ -9,34 +9,31 @@ branches:
|
|||||||
except:
|
except:
|
||||||
- /master-new-.*/
|
- /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:
|
environment:
|
||||||
matrix:
|
matrix:
|
||||||
- BUILD_SHARED: OFF
|
- BUILD_SHARED: OFF
|
||||||
|
COMPILER: msvc2019
|
||||||
- BUILD_SHARED: ON
|
- 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:
|
build_script:
|
||||||
- ninja
|
- cmd: '%APPVEYOR_BUILD_FOLDER%\appveyor-build.bat'
|
||||||
|
|
||||||
before_test:
|
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:
|
test_script:
|
||||||
- cmd: >-
|
- cmd: |-
|
||||||
cd %APPVEYOR_BUILD_FOLDER%\build
|
cd %APPVEYOR_BUILD_FOLDER%\build
|
||||||
|
|
||||||
set PATH=%cd%\bin;%PATH% && ninja run_tests
|
set PATH=%cd%\bin;%PATH% && ninja run_tests
|
||||||
|
|
||||||
after_test:
|
after_test:
|
||||||
- ps: >-
|
- ps: |-
|
||||||
$wc = New-Object 'System.Net.WebClient'
|
$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))
|
$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
|
* an API specification but when an implementation doesn't actually use the argument
|
||||||
* and we'd get a compiler warning otherwise.
|
* and we'd get a compiler warning otherwise.
|
||||||
*/
|
*/
|
||||||
#if defined(_WIN32)
|
#ifdef __GNUC__
|
||||||
#define UNUSED
|
|
||||||
// __attribute__ not supported in VS
|
|
||||||
#else
|
|
||||||
#define UNUSED __attribute__((unused))
|
#define UNUSED __attribute__((unused))
|
||||||
|
#else
|
||||||
|
// __attribute__ not supported in VS
|
||||||
|
#define UNUSED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#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)
|
#elif (TARGET == TARGET_AMD64 && OS_TARGET == OS_WIN)
|
||||||
|
|
||||||
|
#if defined(__MINGW64__)
|
||||||
|
#include <x86intrin.h>
|
||||||
|
#include <psdk_inc/intrin-impl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
// Digit multiplication
|
// Digit multiplication
|
||||||
#define MUL(multiplier, multiplicand, hi, lo) \
|
#define MUL(multiplier, multiplicand, hi, lo) \
|
||||||
(lo) = _umul128((multiplier), (multiplicand), (hi));
|
(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")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__USE_MINGW_ANSI_STDIO=1 -Wno-unknown-pragmas -Wno-unused-parameter")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT WIN32 OR MINGW OR MSYS OR CYGWIN)
|
if(NOT WIN32)
|
||||||
set(LIBM m)
|
set(LIBM m)
|
||||||
|
|
||||||
if(OQS_USE_OPENSSL)
|
if(OQS_USE_OPENSSL)
|
||||||
|
|||||||
@ -8,10 +8,10 @@
|
|||||||
|
|
||||||
#include "system_info.c"
|
#include "system_info.c"
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#ifdef __GNUC__
|
||||||
#define UNUSED
|
|
||||||
#else
|
|
||||||
#define UNUSED __attribute__((unused))
|
#define UNUSED __attribute__((unused))
|
||||||
|
#else
|
||||||
|
#define UNUSED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user