Update cryptopp to 8.5.0 (#5669)
* Update cryptopp to 8.3.0 Modified the CMakeLists.txt based on the noloader/cryptopp-cmake 8.3.0 CMakeLists.txt. * Update cryptopp to version 8.5.0
This commit is contained in:
parent
d6356f5e9f
commit
60d1def6f8
|
@ -1,31 +1,46 @@
|
||||||
# The CMakeLists.txt shipped with cryptopp pollutes our option list and installation list,
|
# A trimmed down version of the CMakeLists.txt from noloader/cryptopp-cmake
|
||||||
# so we made our own one. This is basically a trimmed down version of the shipped CMakeLists.txt
|
|
||||||
# The differences are:
|
# The differences are:
|
||||||
# - removed support for legacy CMake versions
|
# - removed support for legacy CMake versions
|
||||||
# - removed support for 32-bit
|
# - removed support for 32-bit
|
||||||
# - removed -march=native flag
|
# - added prefix "CRYPTOPP_OPT_" to all option names
|
||||||
# - removed rdrand module.asm as a workaround for an issue (see below)
|
|
||||||
# - added prefix "CRYPTOPP_" to all option names
|
|
||||||
# - disabled testing
|
# - disabled testing
|
||||||
# - disabled installation
|
# - disabled installation
|
||||||
# - disabled documentation
|
# - disabled documentation
|
||||||
# - configured to build a static library only
|
# - configured to build a static library only
|
||||||
# - adds include directories to the library target
|
# - adds include directories to the library target
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.1)
|
||||||
|
if (POLICY CMP0048)
|
||||||
|
cmake_policy(SET CMP0048 NEW)
|
||||||
|
endif ()
|
||||||
|
project(cryptopp VERSION 8.5.0)
|
||||||
|
if (POLICY CMP0054)
|
||||||
|
cmake_policy(SET CMP0054 NEW)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
set(SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cryptopp)
|
||||||
|
|
||||||
include(TestBigEndian)
|
include(TestBigEndian)
|
||||||
|
include(GNUInstallDirs)
|
||||||
include(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
|
|
||||||
|
set(TEST_PROG_DIR ${SRC_DIR}/TestPrograms)
|
||||||
|
set(TEST_CXX_FILE ${TEST_PROG_DIR}/test_cxx.cxx)
|
||||||
|
|
||||||
#============================================================================
|
#============================================================================
|
||||||
# Settable options
|
# Settable options
|
||||||
#============================================================================
|
#============================================================================
|
||||||
|
|
||||||
option(CRYPTOPP_DISABLE_ASM "Disable ASM" OFF)
|
option(CRYPTOPP_OPT_DISABLE_ASM "Disable ASM" OFF)
|
||||||
option(CRYPTOPP_DISABLE_SSSE3 "Disable SSSE3" OFF)
|
option(CRYPTOPP_OPT_DISABLE_SSSE3 "Disable SSSE3" OFF)
|
||||||
option(CRYPTOPP_DISABLE_AESNI "Disable AES-NI" OFF)
|
option(CRYPTOPP_OPT_DISABLE_SSE4 "Disable SSE4" OFF)
|
||||||
option(CRYPTOPP_DISABLE_CXXFLAGS_OPTIMIZATIONS "Disable CXXFLAGS optimizations" OFF)
|
option(CRYPTOPP_OPT_DISABLE_AESNI "Disable AES-NI" OFF)
|
||||||
|
option(CRYPTOPP_OPT_DISABLE_SHA "Disable SHA" OFF)
|
||||||
|
option(CRYPTOPP_OPT_DISABLE_AVX "Disable AVX" OFF)
|
||||||
|
option(CRYPTOPP_OPT_DISABLE_AVX2 "Disable AVX2" OFF)
|
||||||
|
|
||||||
#============================================================================
|
#============================================================================
|
||||||
# Internal compiler options
|
# Compiler options
|
||||||
#============================================================================
|
#============================================================================
|
||||||
|
|
||||||
# Only set when cross-compiling, http://www.vtk.org/Wiki/CMake_Cross_Compiling
|
# Only set when cross-compiling, http://www.vtk.org/Wiki/CMake_Cross_Compiling
|
||||||
|
@ -35,13 +50,14 @@ else()
|
||||||
set(CRYPTOPP_CROSS_COMPILE 0)
|
set(CRYPTOPP_CROSS_COMPILE 0)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(CRYPTOPP_COMPILE_DEFINITIONS)
|
||||||
|
set(CRYPTOPP_COMPILE_OPTIONS)
|
||||||
|
|
||||||
# Don't use RPATH's. The resulting binary could fail a security audit.
|
# Don't use RPATH's. The resulting binary could fail a security audit.
|
||||||
if (NOT CMAKE_VERSION VERSION_LESS 2.8.12)
|
|
||||||
set(CMAKE_MACOSX_RPATH 0)
|
set(CMAKE_MACOSX_RPATH 0)
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
|
if(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
|
||||||
add_definitions(-wd68 -wd186 -wd279 -wd327 -wd161 -wd3180)
|
list(APPEND CRYPTOPP_COMPILE_OPTIONS -wd68 -wd186 -wd279 -wd327 -wd161 -wd3180)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
|
@ -55,14 +71,35 @@ if(IS_BIG_ENDIAN)
|
||||||
add_definitions(-DIS_BIG_ENDIAN)
|
add_definitions(-DIS_BIG_ENDIAN)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CRYPTOPP_DISABLE_ASM)
|
if (CRYPTOPP_OPT_DISABLE_ASM)
|
||||||
add_definitions(-DCRYPTOPP_DISABLE_ASM)
|
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_ASM)
|
||||||
endif ()
|
endif ()
|
||||||
if(CRYPTOPP_DISABLE_SSSE3)
|
if (CRYPTOPP_OPT_DISABLE_SSSE3)
|
||||||
add_definitions(-DCRYPTOPP_DISABLE_SSSE3)
|
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_SSSE3)
|
||||||
endif ()
|
endif ()
|
||||||
if(CRYPTOPP_DISABLE_AESNI)
|
if (CRYPTOPP_OPT_DISABLE_SSE4)
|
||||||
add_definitions(-DCRYPTOPP_DISABLE_AESNI)
|
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_SSSE4)
|
||||||
|
endif ()
|
||||||
|
if (CRYPTOPP_OPT_DISABLE_CLMUL)
|
||||||
|
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_CLMUL)
|
||||||
|
endif ()
|
||||||
|
if (CRYPTOPP_OPT_DISABLE_AESNI)
|
||||||
|
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_AESNI)
|
||||||
|
endif ()
|
||||||
|
if (CRYPTOPP_OPT_DISABLE_RDRAND)
|
||||||
|
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_RDRAND)
|
||||||
|
endif ()
|
||||||
|
if (CRYPTOPP_OPT_DISABLE_RDSEED)
|
||||||
|
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_RDSEED)
|
||||||
|
endif ()
|
||||||
|
if (CRYPTOPP_OPT_DISABLE_AVX)
|
||||||
|
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_AVX)
|
||||||
|
endif ()
|
||||||
|
if (CRYPTOPP_OPT_DISABLE_AVX2)
|
||||||
|
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_AVX2)
|
||||||
|
endif ()
|
||||||
|
if (CRYPTOPP_OPT_DISABLE_SHA)
|
||||||
|
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_SHA)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# We need the output 'uname -s' for Unix and Linux system detection
|
# We need the output 'uname -s' for Unix and Linux system detection
|
||||||
|
@ -87,11 +124,110 @@ if (NOT CRYPTOPP_CROSS_COMPILE)
|
||||||
string(REGEX REPLACE "\n$" "" UNAME_MACHINE "${UNAME_MACHINE}")
|
string(REGEX REPLACE "\n$" "" UNAME_MACHINE "${UNAME_MACHINE}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WINDOWS_STORE OR WINDOWS_PHONE)
|
###############################################################################
|
||||||
if("${CMAKE_SYSTEM_VERSION}" MATCHES "10\\.0.*")
|
|
||||||
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D\"_WIN32_WINNT=0x0A00\"" )
|
# Try to find a Posix compatible grep and sed. Solaris, Digital Unix,
|
||||||
|
# Tru64, HP-UX and a few others need tweaking
|
||||||
|
|
||||||
|
if (EXISTS /usr/xpg4/bin/grep)
|
||||||
|
set(GREP_CMD /usr/xpg4/bin/grep)
|
||||||
|
elseif (EXISTS /usr/gnu/bin/grep)
|
||||||
|
set(GREP_CMD /usr/gnu/bin/grep)
|
||||||
|
elseif (EXISTS /usr/linux/bin/grep)
|
||||||
|
set(GREP_CMD /usr/linux/bin/grep)
|
||||||
|
else ()
|
||||||
|
set(GREP_CMD grep)
|
||||||
endif ()
|
endif ()
|
||||||
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FI\"winapifamily.h\"" )
|
|
||||||
|
if (EXISTS /usr/xpg4/bin/sed)
|
||||||
|
set(SED_CMD /usr/xpg4/bin/sed)
|
||||||
|
elseif (EXISTS /usr/gnu/bin/sed)
|
||||||
|
set(SED_CMD /usr/gnu/bin/sed)
|
||||||
|
elseif (EXISTS /usr/linux/bin/sed)
|
||||||
|
set(SED_CMD /usr/linux/bin/sed)
|
||||||
|
else ()
|
||||||
|
set(SED_CMD sed)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
function(CheckCompileOption opt var)
|
||||||
|
CHECK_CXX_COMPILER_FLAG(${opt} ${var})
|
||||||
|
endfunction(CheckCompileOption)
|
||||||
|
|
||||||
|
function(CheckCompileLinkOption opt var prog)
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
|
||||||
|
# TODO: improve this...
|
||||||
|
CHECK_CXX_COMPILER_FLAG(${opt} ${var})
|
||||||
|
|
||||||
|
elseif (APPLE)
|
||||||
|
|
||||||
|
message(STATUS "Performing Test ${var}")
|
||||||
|
try_compile(COMMAND_SUCCESS ${CMAKE_BINARY_DIR} ${prog} COMPILE_DEFINITIONS ${opt})
|
||||||
|
if (COMMAND_SUCCESS)
|
||||||
|
set(${var} 1 PARENT_SCOPE)
|
||||||
|
message(STATUS "Performing Test ${var} - Success")
|
||||||
|
else ()
|
||||||
|
set(${var} 0 PARENT_SCOPE)
|
||||||
|
message(STATUS "Performing Test ${var} - Failed")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
else ()
|
||||||
|
|
||||||
|
message(STATUS "Performing Test ${var}")
|
||||||
|
try_compile(COMMAND_SUCCESS ${CMAKE_BINARY_DIR} ${prog} COMPILE_DEFINITIONS ${opt})
|
||||||
|
if (COMMAND_SUCCESS)
|
||||||
|
set(${var} 1 PARENT_SCOPE)
|
||||||
|
message(STATUS "Performing Test ${var} - Success")
|
||||||
|
else ()
|
||||||
|
set(${var} 0 PARENT_SCOPE)
|
||||||
|
message(STATUS "Performing Test ${var} - Failed")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
endfunction(CheckCompileLinkOption)
|
||||||
|
|
||||||
|
function(AddCompileOption opt)
|
||||||
|
|
||||||
|
if ("${COMMAND_OUTPUT}" NOT STREQUAL "")
|
||||||
|
list(APPEND CRYPTOPP_COMPILE_OPTIONS "${opt}")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
endfunction(AddCompileOption)
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
function(DumpMachine output pattern)
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
|
||||||
|
# CMake does not provide a generic shell/terminal mechanism
|
||||||
|
# and Microsoft environments don't know what 'sh' is.
|
||||||
|
set(${output} 0 PARENT_SCOPE)
|
||||||
|
|
||||||
|
else ()
|
||||||
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES ${pattern})
|
||||||
|
set(${output} TRUE PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endfunction(DumpMachine)
|
||||||
|
|
||||||
|
# Thansk to Anonimal for MinGW; see http://github.com/weidai11/cryptopp/issues/466
|
||||||
|
DumpMachine(CRYPTOPP_AMD64 "(x86_64|AMD64|amd64)")
|
||||||
|
DumpMachine(CRYPTOPP_MINGW64 "(w64-mingw32)|(mingw64)")
|
||||||
|
DumpMachine(CRYPTOPP_ARMV8 "(armv8|aarch64)")
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
if(CMAKE_SYSTEM_VERSION MATCHES "10\\.0.*")
|
||||||
|
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS "_WIN32_WINNT=0x0A00")
|
||||||
|
endif()
|
||||||
|
list(APPEND CRYPTOPP_COMPILE_OPTIONS /FI winapifamily.h)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Enable PIC for all targets except Windows and 32-bit x86.
|
# Enable PIC for all targets except Windows and 32-bit x86.
|
||||||
|
@ -114,7 +250,13 @@ endif()
|
||||||
#============================================================================
|
#============================================================================
|
||||||
|
|
||||||
# Library headers
|
# Library headers
|
||||||
file(GLOB cryptopp_HEADERS cryptopp/*.h)
|
file(GLOB cryptopp_HEADERS ${SRC_DIR}/*.h)
|
||||||
|
|
||||||
|
# Remove headers used to build test suite
|
||||||
|
list(REMOVE_ITEM cryptopp_HEADERS
|
||||||
|
${SRC_DIR}/bench.h
|
||||||
|
${SRC_DIR}/validate.h
|
||||||
|
)
|
||||||
|
|
||||||
# Library sources.
|
# Library sources.
|
||||||
# These have been trimmed to include only things Citra uses. This speeds up
|
# These have been trimmed to include only things Citra uses. This speeds up
|
||||||
|
@ -124,117 +266,169 @@ set(cryptopp_SOURCES
|
||||||
# to avoid "problems associated with C++ static initialization order",
|
# to avoid "problems associated with C++ static initialization order",
|
||||||
# but doesn't actually tell what could go wrong. Better safe than sorry
|
# but doesn't actually tell what could go wrong. Better safe than sorry
|
||||||
# I guess...
|
# I guess...
|
||||||
cryptopp/cryptlib.cpp
|
${SRC_DIR}/cryptlib.cpp
|
||||||
cryptopp/cpu.cpp
|
${SRC_DIR}/cpu.cpp
|
||||||
cryptopp/integer.cpp
|
${SRC_DIR}/integer.cpp
|
||||||
|
|
||||||
cryptopp/algparam.cpp
|
${SRC_DIR}/algparam.cpp
|
||||||
cryptopp/asn.cpp
|
${SRC_DIR}/allocate.cpp
|
||||||
cryptopp/authenc.cpp
|
${SRC_DIR}/asn.cpp
|
||||||
cryptopp/base64.cpp
|
${SRC_DIR}/authenc.cpp
|
||||||
cryptopp/basecode.cpp
|
${SRC_DIR}/base64.cpp
|
||||||
cryptopp/ccm.cpp
|
${SRC_DIR}/basecode.cpp
|
||||||
cryptopp/crc-simd.cpp
|
${SRC_DIR}/ccm.cpp
|
||||||
cryptopp/des.cpp
|
${SRC_DIR}/crc_simd.cpp
|
||||||
cryptopp/dessp.cpp
|
${SRC_DIR}/des.cpp
|
||||||
cryptopp/dll.cpp
|
${SRC_DIR}/dessp.cpp
|
||||||
cryptopp/ec2n.cpp
|
${SRC_DIR}/dll.cpp
|
||||||
cryptopp/ecp.cpp
|
${SRC_DIR}/ec2n.cpp
|
||||||
cryptopp/filters.cpp
|
${SRC_DIR}/ecp.cpp
|
||||||
cryptopp/fips140.cpp
|
${SRC_DIR}/filters.cpp
|
||||||
cryptopp/gcm-simd.cpp
|
${SRC_DIR}/fips140.cpp
|
||||||
cryptopp/gf2n.cpp
|
${SRC_DIR}/gcm_simd.cpp
|
||||||
cryptopp/gfpcrypt.cpp
|
${SRC_DIR}/gf2n_simd.cpp
|
||||||
cryptopp/hex.cpp
|
${SRC_DIR}/gf2n.cpp
|
||||||
cryptopp/hmac.cpp
|
${SRC_DIR}/gfpcrypt.cpp
|
||||||
cryptopp/hrtimer.cpp
|
${SRC_DIR}/hex.cpp
|
||||||
cryptopp/iterhash.cpp
|
${SRC_DIR}/hmac.cpp
|
||||||
cryptopp/md5.cpp
|
${SRC_DIR}/hrtimer.cpp
|
||||||
cryptopp/misc.cpp
|
${SRC_DIR}/iterhash.cpp
|
||||||
cryptopp/modes.cpp
|
${SRC_DIR}/md5.cpp
|
||||||
cryptopp/mqueue.cpp
|
${SRC_DIR}/misc.cpp
|
||||||
cryptopp/nbtheory.cpp
|
${SRC_DIR}/modes.cpp
|
||||||
cryptopp/neon-simd.cpp
|
${SRC_DIR}/mqueue.cpp
|
||||||
cryptopp/oaep.cpp
|
${SRC_DIR}/nbtheory.cpp
|
||||||
cryptopp/osrng.cpp
|
${SRC_DIR}/neon_simd.cpp
|
||||||
cryptopp/ppc-simd.cpp
|
${SRC_DIR}/oaep.cpp
|
||||||
cryptopp/pubkey.cpp
|
${SRC_DIR}/osrng.cpp
|
||||||
cryptopp/queue.cpp
|
${SRC_DIR}/ppc_simd.cpp
|
||||||
cryptopp/randpool.cpp
|
${SRC_DIR}/pubkey.cpp
|
||||||
cryptopp/rdtables.cpp
|
${SRC_DIR}/queue.cpp
|
||||||
cryptopp/rijndael-simd.cpp
|
${SRC_DIR}/randpool.cpp
|
||||||
cryptopp/rijndael.cpp
|
${SRC_DIR}/rdtables.cpp
|
||||||
cryptopp/rng.cpp
|
${SRC_DIR}/rijndael_simd.cpp
|
||||||
cryptopp/sha-simd.cpp
|
${SRC_DIR}/rijndael.cpp
|
||||||
cryptopp/sha.cpp
|
${SRC_DIR}/rng.cpp
|
||||||
cryptopp/sse-simd.cpp
|
${SRC_DIR}/sha_simd.cpp
|
||||||
|
${SRC_DIR}/sha.cpp
|
||||||
|
${SRC_DIR}/sse_simd.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if (MINGW OR WIN32)
|
if(ANDROID)
|
||||||
list(APPEND cryptopp_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/winpipes.cpp)
|
include_directories(${ANDROID_NDK}/sources/android/cpufeatures)
|
||||||
|
list(APPEND cryptopp_SOURCES ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MSVC AND NOT CRYPTOPP_DISABLE_ASM)
|
set(cryptopp_SOURCES_ASM)
|
||||||
|
|
||||||
|
if (MSVC AND NOT DISABLE_ASM)
|
||||||
if (${CMAKE_GENERATOR} MATCHES ".*ARM")
|
if (${CMAKE_GENERATOR} MATCHES ".*ARM")
|
||||||
message(STATUS "Disabling ASM because ARM is specified as target platform.")
|
message(STATUS "Disabling ASM because ARM is specified as target platform.")
|
||||||
else ()
|
else ()
|
||||||
# Note that we removed rdrand.asm. This is a workaround for the issue that rdrand.asm cannnot compiled properly
|
|
||||||
# on MSVC. Because there is also a rdrand.S file in the submodule, CMake will specify the target path for
|
|
||||||
# rdrand.asm as "/crytopp.dir/{Debug|Release}/cryptopp/rdrand.asm.obj". The additional target folder "cryptopp"
|
|
||||||
# is specified because the file rdrand.asm is in the source folder "cryptopp". But MSVC assembler can't build
|
|
||||||
# target file to an non-existing folder("cryptopp").
|
|
||||||
list(APPEND cryptopp_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/x64dll.asm)
|
|
||||||
list(APPEND cryptopp_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/x64masm.asm)
|
|
||||||
# list(APPEND cryptopp_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/rdrand.asm)
|
|
||||||
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/x64dll.asm PROPERTIES COMPILE_FLAGS "/D_M_X64")
|
|
||||||
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/x64masm.asm PROPERTIES COMPILE_FLAGS "/D_M_X64")
|
|
||||||
# set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/rdrand.asm PROPERTIES COMPILE_FLAGS "/D_M_X64")
|
|
||||||
enable_language(ASM_MASM)
|
enable_language(ASM_MASM)
|
||||||
|
list(APPEND cryptopp_SOURCES_ASM
|
||||||
|
${SRC_DIR}/rdrand.asm
|
||||||
|
${SRC_DIR}/rdseed.asm
|
||||||
|
)
|
||||||
|
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
list(APPEND cryptopp_SOURCES_ASM
|
||||||
|
${SRC_DIR}/x64dll.asm
|
||||||
|
${SRC_DIR}/x64masm.asm
|
||||||
|
)
|
||||||
|
set_source_files_properties(${cryptopp_SOURCES_ASM} PROPERTIES COMPILE_DEFINITIONS "_M_X64")
|
||||||
|
else ()
|
||||||
|
set_source_files_properties(${cryptopp_SOURCES_ASM} PROPERTIES COMPILE_DEFINITIONS "_M_X86" COMPILE_FLAGS "/safeseh")
|
||||||
|
endif ()
|
||||||
|
set_source_files_properties(${cryptopp_SOURCES_ASM} PROPERTIES LANGUAGE ASM_MASM)
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if ((CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT CRYPTOPP_DISABLE_ASM)
|
#============================================================================
|
||||||
check_cxx_compiler_flag(-msse2 CRYPTOPP_HAS_MSSE2)
|
# Architecture flags
|
||||||
check_cxx_compiler_flag(-mssse3 CRYPTOPP_HAS_MSSSE3)
|
#============================================================================
|
||||||
check_cxx_compiler_flag(-msse4.1 CRYPTOPP_HAS_MSSE41)
|
|
||||||
check_cxx_compiler_flag(-msse4.2 CRYPTOPP_HAS_MSSE42)
|
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Intel" OR CMAKE_CXX_COMPILER MATCHES "xlC")
|
||||||
check_cxx_compiler_flag(-maes CRYPTOPP_HAS_MAES)
|
|
||||||
check_cxx_compiler_flag(-mpclmul CRYPTOPP_HAS_PCLMUL)
|
if (CRYPTOPP_AMD64 OR CRYPTOPP_I386)
|
||||||
check_cxx_compiler_flag(-msha CRYPTOPP_HAS_MSHA)
|
CheckCompileLinkOption("-msse2" CRYPTOPP_IA32_SSE2
|
||||||
check_cxx_compiler_flag(-march=armv8-a+crc CRYPTOPP_HAS_ARMV8_CRC32)
|
"${TEST_PROG_DIR}/test_x86_sse2.cxx")
|
||||||
check_cxx_compiler_flag(-march=armv8-a+crypto CRYPTOPP_HAS_ARMV8_CRYPTO)
|
CheckCompileLinkOption("-mssse3" CRYPTOPP_IA32_SSSE3
|
||||||
if (CRYPTOPP_HAS_MSSE2)
|
"${TEST_PROG_DIR}/test_x86_ssse3.cxx")
|
||||||
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/sse-simd.cpp PROPERTIES COMPILE_FLAGS "-msse2")
|
CheckCompileLinkOption("-msse4.1" CRYPTOPP_IA32_SSE41
|
||||||
|
"${TEST_PROG_DIR}/test_x86_sse41.cxx")
|
||||||
|
CheckCompileLinkOption("-msse4.2" CRYPTOPP_IA32_SSE42
|
||||||
|
"${TEST_PROG_DIR}/test_x86_sse42.cxx")
|
||||||
|
CheckCompileLinkOption("-mssse3 -mpclmul" CRYPTOPP_IA32_CLMUL
|
||||||
|
"${TEST_PROG_DIR}/test_x86_clmul.cxx")
|
||||||
|
CheckCompileLinkOption("-msse4.1 -maes" CRYPTOPP_IA32_AES
|
||||||
|
"${TEST_PROG_DIR}/test_x86_aes.cxx")
|
||||||
|
CheckCompileLinkOption("-mavx" CRYPTOPP_IA32_AVX
|
||||||
|
"${TEST_PROG_DIR}/test_x86_avx.cxx")
|
||||||
|
CheckCompileLinkOption("-mavx2" CRYPTOPP_IA32_AVX2
|
||||||
|
"${TEST_PROG_DIR}/test_x86_avx2.cxx")
|
||||||
|
CheckCompileLinkOption("-msse4.2 -msha" CRYPTOPP_IA32_SHA
|
||||||
|
"${TEST_PROG_DIR}/test_x86_sha.cxx")
|
||||||
|
if (EXISTS "${TEST_PROG_DIR}/test_asm_mixed.cxx")
|
||||||
|
CheckCompileLinkOption("" CRYPTOPP_MIXED_ASM
|
||||||
|
"${TEST_PROG_DIR}/test_asm_mixed.cxx")
|
||||||
|
else ()
|
||||||
|
CheckCompileLinkOption("" CRYPTOPP_MIXED_ASM
|
||||||
|
"${TEST_PROG_DIR}/test_mixed_asm.cxx")
|
||||||
endif ()
|
endif ()
|
||||||
if (CRYPTOPP_HAS_MSSSE3 AND CRYPTOPP_HAS_MAES AND CRYPTOPP_HAS_PCLMUL)
|
|
||||||
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/gcm-simd.cpp
|
if (NOT CRYPTOPP_MIXED_ASM)
|
||||||
PROPERTIES COMPILE_FLAGS "-mssse3 -maes -mpclmul")
|
list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_MIXED_ASM")
|
||||||
endif ()
|
endif ()
|
||||||
if (CRYPTOPP_HAS_MSSE41 AND CRYPTOPP_HAS_MAES)
|
|
||||||
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/rijndael-simd.cpp PROPERTIES COMPILE_FLAGS "-msse4.1 -maes")
|
if (NOT CRYPTOPP_IA32_SSE2 AND NOT CRYPTOPP_DISABLE_ASM)
|
||||||
|
list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_ASM")
|
||||||
|
elseif (CRYPTOPP_IA32_SSE2 AND NOT CRYPTOPP_DISABLE_ASM)
|
||||||
|
set_source_files_properties(${SRC_DIR}/sse_simd.cpp PROPERTIES COMPILE_FLAGS "-msse2")
|
||||||
endif ()
|
endif ()
|
||||||
if (CRYPTOPP_HAS_MSSE42)
|
if (NOT CRYPTOPP_IA32_SSSE3 AND NOT CRYPTOPP_DISABLE_SSSE3)
|
||||||
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/crc-simd.cpp
|
list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_SSSE3")
|
||||||
PROPERTIES COMPILE_FLAGS "-msse4.2")
|
elseif (CRYPTOPP_IA32_SSSE3 AND NOT CRYPTOPP_DISABLE_SSSE3)
|
||||||
|
if (NOT CRYPTOPP_IA32_SSE41 AND NOT CRYPTOPP_DISABLE_SSE4)
|
||||||
|
list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_SSE4")
|
||||||
|
endif ()
|
||||||
|
if (NOT CRYPTOPP_IA32_SSE42 AND NOT CRYPTOPP_DISABLE_SSE4)
|
||||||
|
list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_SSE4")
|
||||||
|
elseif (CRYPTOPP_IA32_SSE42 AND NOT CRYPTOPP_DISABLE_SSE4)
|
||||||
|
set_source_files_properties(${SRC_DIR}/crc_simd.cpp PROPERTIES COMPILE_FLAGS "-msse4.2")
|
||||||
|
if (NOT CRYPTOPP_IA32_CLMUL AND NOT CRYPTOPP_DISABLE_CLMUL)
|
||||||
|
list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_CLMUL")
|
||||||
|
elseif (CRYPTOPP_IA32_CLMUL AND NOT CRYPTOPP_DISABLE_CLMUL)
|
||||||
|
set_source_files_properties(${SRC_DIR}/gcm_simd.cpp PROPERTIES COMPILE_FLAGS "-mssse3 -mpclmul")
|
||||||
|
set_source_files_properties(${SRC_DIR}/gf2n_simd.cpp PROPERTIES COMPILE_FLAGS "-mpclmul")
|
||||||
|
endif ()
|
||||||
|
if (NOT CRYPTOPP_IA32_AES AND NOT CRYPTOPP_DISABLE_AES)
|
||||||
|
list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_AESNI")
|
||||||
|
elseif (CRYPTOPP_IA32_AES AND NOT CRYPTOPP_DISABLE_AES)
|
||||||
|
set_source_files_properties(${SRC_DIR}/rijndael_simd.cpp PROPERTIES COMPILE_FLAGS "-msse4.1 -maes")
|
||||||
|
endif ()
|
||||||
|
if (NOT CRYPTOPP_IA32_AVX2 AND NOT CRYPTOPP_DISABLE_AVX2)
|
||||||
|
list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_AVX2")
|
||||||
|
endif ()
|
||||||
|
if (NOT CRYPTOPP_IA32_SHA AND NOT CRYPTOPP_DISABLE_SHA)
|
||||||
|
list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_SHANI")
|
||||||
|
elseif (CRYPTOPP_IA32_SHA AND NOT CRYPTOPP_DISABLE_SHA)
|
||||||
|
set_source_files_properties(${SRC_DIR}/sha_simd.cpp PROPERTIES COMPILE_FLAGS "-msse4.2 -msha")
|
||||||
endif ()
|
endif ()
|
||||||
if (CRYPTOPP_HAS_MSSE42 AND CRYPTOPP_HAS_MSHA)
|
|
||||||
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/sha-simd.cpp PROPERTIES COMPILE_FLAGS "-msse4.2 -msha")
|
|
||||||
endif ()
|
endif ()
|
||||||
if (CRYPTOPP_HAS_ARMV8_CRC32)
|
|
||||||
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/crc-simd.cpp
|
|
||||||
PROPERTIES COMPILE_FLAGS "-march=armv8-a+crc")
|
|
||||||
endif ()
|
endif ()
|
||||||
if (CRYPTOPP_HAS_ARMV8_CRYPTO)
|
|
||||||
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/rijndael-simd.cpp
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/sha-simd.cpp
|
|
||||||
PROPERTIES COMPILE_FLAGS "-march=armv8-a+crypto")
|
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
#============================================================================
|
#============================================================================
|
||||||
# Compile targets
|
# Compile targets
|
||||||
#============================================================================
|
#============================================================================
|
||||||
add_library(cryptopp STATIC ${cryptopp_SOURCES})
|
|
||||||
|
set(cryptopp_LIBRARY_SOURCES ${cryptopp_SOURCES_ASM})
|
||||||
|
list(APPEND cryptopp_LIBRARY_SOURCES ${cryptopp_SOURCES})
|
||||||
|
|
||||||
|
add_library(cryptopp STATIC ${cryptopp_LIBRARY_SOURCES})
|
||||||
|
target_compile_definitions(cryptopp PUBLIC ${CRYPTOPP_COMPILE_DEFINITIONS})
|
||||||
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}")
|
||||||
target_include_directories(cryptopp INTERFACE .)
|
target_include_directories(cryptopp INTERFACE .)
|
||||||
|
|
||||||
#============================================================================
|
#============================================================================
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit f320e7d92a33ee80ae42deef79da78cfc30868af
|
Subproject commit f2102243e6fdd48c0b2a393a0993cca228f20573
|
Reference in New Issue