Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
168 changes: 154 additions & 14 deletions .github/workflows/cmake-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@ name: CI Matrix

on: [push, pull_request]

env:
BUILD_TYPE: Release

jobs:
build:
name: ${{ matrix.config.name }}
name: '${{ matrix.config.name }} - ${{ matrix.build-type }}'
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
build-type: [Release, Debug]
config:
- {
name: "windows-latest",
name: "windows-latest-ninja",
os: windows-latest,
artifact: "Windows-MSVC.7z",
build_type: "Release",
Expand All @@ -24,6 +22,28 @@ jobs:
archiver: "7z a",
generators: "Visual Studio 17 2022",
}
- {
name: "windows-latest-nmake",
os: windows-latest,
artifact: "Windows-MSVC.7z",
build_type: "Release",
cc: "cl",
cxx: "cl",
environment_script: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
archiver: "7z a",
generators: "Visual Studio 17 2022",
}
- {
name: "windows-msvc",
os: windows-2019,
artifact: "Windows-MSVC.7z",
build_type: "Release",
cc: "cl",
cxx: "cl",
environment_script: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
archiver: "7z a",
generators: "Visual Studio 17 2022",
}
- {
name: "ubuntu-latest",
os: ubuntu-latest,
Expand Down Expand Up @@ -89,11 +109,12 @@ jobs:
uses: abdes/gha-setup-ninja@master
with:
version: 1.11.0
if: ${{ !endsWith(matrix.config.name, 'msvc') }}

- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1.13
with:
cmake-version: 3.21.x
cmake-version: 3.20.0

- name: Install ccache
shell: cmake -P {0}
Expand Down Expand Up @@ -188,17 +209,25 @@ jobs:
set(OMP "OFF")
endif()

if ("${{ matrix.config.name }}" STREQUAL "windows-msvc")
set(Generator -G "Visual Studio 16 2019")
elseif("${{ matrix.config.name }}" STREQUAL "windows-latest-nmake")
set(Generator -G "NMake Makefiles" -D CMAKE_MAKE_PROGRAM=nmake)
else()
set(Generator -G Ninja -D CMAKE_MAKE_PROGRAM=ninja)
endif()

execute_process(
COMMAND cmake
-S .
-B build
-D CMAKE_BUILD_TYPE=$ENV{BUILD_TYPE}
-G Ninja
-D CMAKE_MAKE_PROGRAM=ninja
-D CMAKE_BUILD_TYPE=${{ matrix.build-type }}
${Generator}
-D USE_CCACHE=${enable_ccache}
-D CMAKE_VERBOSE_MAKEFILE=ON
-D USE_OPENMP=${OMP}
RESULT_VARIABLE result
COMMAND_ECHO STDOUT
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
Expand All @@ -219,7 +248,7 @@ jobs:
endif()

execute_process(
COMMAND cmake --build build --target all
COMMAND cmake --build build --config ${{ matrix.build-type }}
RESULT_VARIABLE result
OUTPUT_VARIABLE output
ERROR_VARIABLE output
Expand All @@ -241,8 +270,17 @@ jobs:

set(ENV{CTEST_OUTPUT_ON_FAILURE} "ON")

if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x")
file(STRINGS environment_script_output.txt output_lines)
foreach(line IN LISTS output_lines)
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
endif()
endforeach()
endif()

execute_process(
COMMAND ctest "--verbose" "-R" "cryptest"
COMMAND ctest "--verbose" "-R" "cryptest" "-C" "${{ matrix.build-type }}"
WORKING_DIRECTORY build
RESULT_VARIABLE result
OUTPUT_VARIABLE output
Expand All @@ -265,8 +303,17 @@ jobs:

set(ENV{CTEST_OUTPUT_ON_FAILURE} "ON")

if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x")
file(STRINGS environment_script_output.txt output_lines)
foreach(line IN LISTS output_lines)
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
endif()
endforeach()
endif()

execute_process(
COMMAND ctest "-E" "cryptest"
COMMAND ctest "-E" "cryptest" "-C" "${{ matrix.build-type }}"
WORKING_DIRECTORY build
RESULT_VARIABLE result
OUTPUT_VARIABLE output
Expand All @@ -281,7 +328,7 @@ jobs:
endif()

- name: Install Strip
run: cmake --install build --prefix instdir --strip
run: cmake --install build --prefix instdir --strip --config ${{ matrix.build-type }}

- name: Pack
working-directory: instdir
Expand Down Expand Up @@ -322,7 +369,7 @@ jobs:

publish:
if: contains(github.ref, 'tags/CRYPTOPP_')
name: ${{ matrix.config.name }}
name: 'Publish ${{ matrix.config.name }}'
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -374,3 +421,96 @@ jobs:
asset_path: ./${{ matrix.config.artifact }}
asset_name: ${{ matrix.config.artifact }}
asset_content_type: application/x-gtar
msys-build:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
build-type: [Release, Debug]
sys: [mingw32, mingw64, ucrt64, clang64]
name: 'MSys - ${{ matrix.sys }} - ${{ matrix.build-type }}'
defaults:
run:
shell: msys2 {0}
steps:
- name: 'Checkout'
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 'Setup MSYS2'
uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.sys}}
update: true
install: >-
git
make
pacboy: >-
toolchain:p
cmake:p
- name: Setup ccache
uses: Chocobo1/setup-ccache-action@v1
with:
prepend_symlinks_to_path: false
windows_compile_environment: msys2
- name: 'Configure'
run: |
cmake -G"Unix Makefiles" -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=ON -DUSE_CCACHE=ON -DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
- name: 'Build'
run: |
cmake --build build
- name: 'Run cryptest'
run: |
ctest --test-dir build --verbose -R cryptest
- name: 'Run tests'
run: |
ctest --test-dir build --output-on-failure -E cryptest

cygwin-build:
strategy:
fail-fast: false
matrix:
build-type: [Release, Debug]
runs-on: windows-latest
name: 'Cygwin - ${{ matrix.build-type }}'
steps:
- name: 'Checkout'
env:
HOME: C:\cygwin\home\runneradmin
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 'Setup cygwin'
uses: cygwin/cygwin-install-action@master
with:
packages: >-
ccache
cmake
gcc-g++
git
ninja
- name: 'Removing ccache from choco'
run: |
Remove-Item -Path C:\ProgramData\Chocolatey\bin\ccache.exe -Verbose
- name: Setup ccache
uses: Chocobo1/setup-ccache-action@v1
with:
install_ccache: false
prepend_symlinks_to_path: false
update_packager_index: false
windows_compile_environment: msvc
- name: 'Configure'
run: |
cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=Release -D CMAKE_VERBOSE_MAKEFILE=ON -D USE_CCACHE=ON -DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
- name: 'Build'
run: |
cmake --build build
- name: 'Run cryptest'
run: |
ctest --test-dir build --verbose -R cryptest
- name: Run tests
run: |
ctest --test-dir build --verbose -E cryptest
- name: 'Workaround git warning'
run: |
git config --global --add safe.directory /cygdrive/d/a/cryptopp-cmake/cryptopp-cmake
6 changes: 6 additions & 0 deletions cmake/TargetArch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ set(archdetect_c_code
# error cmake_ARCH arm
# endif

#elif defined(__CYGWIN__)
#error cmake_ARCH cygwin
#elif defined(__MINGW64__)
#error cmake_ARCH mingw64
#elif defined(__MINGW32__)
#error cmake_ARCH mingw32
#elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
#error cmake_ARCH i386
#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64)
Expand Down
18 changes: 16 additions & 2 deletions cryptopp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,22 @@ check_target_architecture(CRYPTOPP_AMD64 "(x86_64|amd64)")
check_target_architecture(CRYPTOPP_I386 "^i.86$")
check_target_architecture(CRYPTOPP_MINGW32 "^mingw32")
check_target_architecture(CRYPTOPP_MINGW64 "(w64-mingw32|mingw64)")
check_target_architecture(CRYPTOPP_CYGWIN "(^cygwin)")
check_target_architecture(CRYPTOPP_ARMV8 "(armv8|arm64|aarch32|aarch64)")
check_target_architecture(CRYPTOPP_ARM32 "(^arm$|arm32|armhf|arm7l|eabihf)")
check_target_architecture(CRYPTOPP_PPC32 "^(powerpc|ppc)")
check_target_architecture(CRYPTOPP_PPC64 "^ppc64")

if (CRYPTOPP_MINGW32 AND NOT DISABLE_ASM)
message (STATUS "[cryptopp] Disabling ASM on MinGW32")
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS "CRYPTOPP_DISABLE_ASM=1")
endif()

if (CRYPTOPP_CYGWIN AND NOT DISABLE_ASM)
message (STATUS "[cryptopp] Disabling ASM on Cygwin")
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS "CRYPTOPP_DISABLE_ASM=1")
endif()

# Cleanup 32/64 bit
if(CRYPTOPP_AMD64)
set(CRYPTOPP_I386 0)
Expand Down Expand Up @@ -409,7 +420,7 @@ include(sources)
# X86/X32/X64 Options #####
# ##############################################################################

if((CRYPTOPP_I386 OR CRYPTOPP_AMD64) AND NOT MSVC)
if((CRYPTOPP_I386 OR CRYPTOPP_AMD64 OR MINGW) AND NOT MSVC)
if(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
set(sse2_flag "-xarch=sse2")
set(sse3_flag "-xarch=sse3")
Expand Down Expand Up @@ -1233,7 +1244,8 @@ if(CRYPTOPP_BUILD_TESTING)
DESTINATION ${PROJECT_BINARY_DIR})

add_test(NAME build_cryptest COMMAND "${CMAKE_COMMAND}" --build
${CMAKE_BINARY_DIR} --target cryptest)
${PROJECT_BINARY_DIR} --target cryptest
--config ${CMAKE_BUILD_TYPE})
add_test(
NAME cryptest
COMMAND $<TARGET_FILE:cryptest> v
Expand Down Expand Up @@ -1356,6 +1368,8 @@ elseif(CRYPTOPP_MINGW32)
message(STATUS "[cryptopp] Platform: MinGW-32")
elseif(CRYPTOPP_MINGW64)
message(STATUS "[cryptopp] Platform: MinGW-64")
elseif(CRYPTOPP_CYGWIN)
message(STATUS "[cryptopp] Platform: Cygwin")
endif()
if(CRYPTOPP_HAVE_ARM_NEON)
message(STATUS "[cryptopp] NEON: TRUE")
Expand Down
Loading