Remove -march=native as default in Makefile and CMake (PR #465)
Remove -march=native as default in Makefile and CMake (PR #465)pull/469/head
parent
559fc3bd89
commit
9c9e69119f
|
|
@ -22,23 +22,101 @@ image:
|
|||
- Visual Studio 2015
|
||||
- Visual Studio 2013
|
||||
|
||||
environment:
|
||||
|
||||
matrix:
|
||||
|
||||
- BUILD_MODE: CMake
|
||||
- BUILD_MODE: MSBuild
|
||||
|
||||
# Disable build through solution file
|
||||
build: off
|
||||
|
||||
# Build through commands in script below
|
||||
test_script:
|
||||
|
||||
- cmd: >-
|
||||
- ps: >-
|
||||
|
||||
msbuild /t:Build /p:platform=%platform%;configuration=%configuration% cryptlib.vcxproj
|
||||
if($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2017" -and $env:BUILD_MODE -eq "CMake")
|
||||
{
|
||||
|
||||
msbuild /t:Build /p:platform=%platform%;configuration=%configuration% cryptest.vcxproj
|
||||
mkdir cmake-build
|
||||
|
||||
msbuild /t:CopyCryptestToRoot cryptest.vcxproj
|
||||
cd cmake-build
|
||||
|
||||
cryptest.exe v
|
||||
cmake -G "Visual Studio 15 2017" -DCMAKE_BUILD_TYPE=$env:configuration ..\
|
||||
|
||||
cryptest.exe tv all
|
||||
msbuild /t:Build cryptopp-static.vcxproj
|
||||
|
||||
msbuild /t:Build cryptest.vcxproj
|
||||
|
||||
robocopy $env:APPVEYOR_BUILD_FOLDER\cmake-build\$env:configuration\ $env:APPVEYOR_BUILD_FOLDER\ cryptest.exe
|
||||
|
||||
cd $env:APPVEYOR_BUILD_FOLDER\
|
||||
|
||||
.\cryptest.exe v
|
||||
|
||||
.\cryptest.exe tv all
|
||||
|
||||
}
|
||||
elseif($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2015" -and $env:BUILD_MODE -eq "CMake")
|
||||
{
|
||||
|
||||
mkdir cmake-build
|
||||
|
||||
cd cmake-build
|
||||
|
||||
cmake -G "Visual Studio 14 2015" -DCMAKE_BUILD_TYPE=$env:configuration ..\
|
||||
|
||||
msbuild /t:Build cryptopp-static.vcxproj
|
||||
|
||||
msbuild /t:Build cryptest.vcxproj
|
||||
|
||||
robocopy $env:APPVEYOR_BUILD_FOLDER\cmake-build\$env:configuration\ $env:APPVEYOR_BUILD_FOLDER\ cryptest.exe
|
||||
|
||||
cd $env:APPVEYOR_BUILD_FOLDER\
|
||||
|
||||
.\cryptest.exe v
|
||||
|
||||
.\cryptest.exe tv all
|
||||
|
||||
}
|
||||
elseif($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2013" -and $env:BUILD_MODE -eq "CMake")
|
||||
{
|
||||
|
||||
mkdir cmake-build
|
||||
|
||||
cd cmake-build
|
||||
|
||||
cmake -G "Visual Studio 12 2013" -DCMAKE_BUILD_TYPE=$env:configuration ..\
|
||||
|
||||
msbuild /t:Build cryptopp-static.vcxproj
|
||||
|
||||
msbuild /t:Build cryptest.vcxproj
|
||||
|
||||
robocopy $env:APPVEYOR_BUILD_FOLDER\cmake-build\$env:configuration\ $env:APPVEYOR_BUILD_FOLDER\ cryptest.exe
|
||||
|
||||
cd $env:APPVEYOR_BUILD_FOLDER\
|
||||
|
||||
.\cryptest.exe v
|
||||
|
||||
.\cryptest.exe tv all
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
msbuild /t:Build /p:platform="$env:platform" /p:configuration="$env:configuration" cryptlib.vcxproj
|
||||
|
||||
msbuild /t:Build /p:platform="$env:platform" /p:configuration="$env:configuration" cryptest.vcxproj
|
||||
|
||||
msbuild /t:CopyCryptestToRoot cryptest.vcxproj
|
||||
|
||||
.\cryptest.exe v
|
||||
|
||||
.\cryptest.exe tv all
|
||||
|
||||
}
|
||||
|
||||
notifications:
|
||||
- provider: Email
|
||||
|
|
|
|||
10
.travis.yml
10
.travis.yml
|
|
@ -23,6 +23,7 @@ env:
|
|||
|
||||
matrix:
|
||||
- BUILD_MODE="all"
|
||||
- BUILD_MODE="native"
|
||||
- BUILD_MODE="no-asm"
|
||||
- BUILD_MODE="debug"
|
||||
- BUILD_MODE="asan"
|
||||
|
|
@ -31,6 +32,7 @@ env:
|
|||
- BUILD_MODE="ios-arm64"
|
||||
- BUILD_MODE="ios-watch"
|
||||
- BUILD_MODE="ios-tv"
|
||||
- BUILD_MODE="cmake"
|
||||
|
||||
matrix:
|
||||
|
||||
|
|
@ -82,6 +84,14 @@ script:
|
|||
CXXFLAGS="-DDEBUG -g2 -O1" make
|
||||
./cryptest.exe v
|
||||
./cryptest.exe tv all
|
||||
elif [[ "$BUILD_MODE" == "cmake" ]]; then
|
||||
CRYPTOPP_DIR=$(pwd)
|
||||
mkdir cryptopp-build
|
||||
cd cryptopp-build
|
||||
cmake $CRYPTOPP_DIR
|
||||
make -j 4 VERBOSE=1
|
||||
./cryptest.exe v
|
||||
./cryptest.exe tv all
|
||||
else
|
||||
make "$BUILD_MODE"
|
||||
./cryptest.exe v
|
||||
|
|
|
|||
200
CMakeLists.txt
200
CMakeLists.txt
|
|
@ -1,5 +1,4 @@
|
|||
# Please ensure your changes or patch meets minimum requirements.
|
||||
# Please ensure your changes or patch meets minimum requirements.
|
||||
# The minimum requirements are 2.8.5. They roughly equate to Ubuntu 12.04 LTS
|
||||
# Please do not check in something for 2.8.12 or 3.5.0. To test your changes,
|
||||
# please set up a Ubuntu 12.04 LTS system. Then, manually install Cmake 2.8.5
|
||||
|
|
@ -25,7 +24,6 @@ set(cryptopp_VERSION_MINOR 0)
|
|||
set(cryptopp_VERSION_PATCH 0)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
include(TestBigEndian)
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
#============================================================================
|
||||
|
|
@ -48,7 +46,6 @@ option(DISABLE_SSSE3 "Disable SSSE3" OFF)
|
|||
option(DISABLE_SSE4 "Disable SSE4" OFF)
|
||||
option(DISABLE_AESNI "Disable AES-NI" OFF)
|
||||
option(DISABLE_SHA "Disable SHA" OFF)
|
||||
option(DISABLE_NATIVE_ARCH "Disable the addition of -march=native" OFF)
|
||||
set(CRYPTOPP_DATA_DIR "" CACHE PATH "Crypto++ test data directory")
|
||||
|
||||
#============================================================================
|
||||
|
|
@ -58,14 +55,6 @@ set(CRYPTOPP_DATA_DIR "" CACHE PATH "Crypto++ test data directory")
|
|||
# Stop hiding the damn output...
|
||||
# set(CMAKE_VERBOSE_MAKEFILE on)
|
||||
|
||||
# Previous variable name. Deprecated because (1) it controls the addition of
|
||||
# -march=native (2) its not related to optimizations, like -O3 or -Os, and
|
||||
# (3) DISABLE_NATIVE_ARCH is documented on the wiki.
|
||||
if (DISABLE_CXXFLAGS_OPTIMIZATIONS)
|
||||
set(DISABLE_NATIVE_ARCH 1)
|
||||
unset(DISABLE_CXXFLAGS_OPTIMIZATIONS)
|
||||
endif()
|
||||
|
||||
# Always 1 ahead in Master. Also see http://groups.google.com/forum/#!topic/cryptopp-users/SFhqLDTQPG4
|
||||
set(LIB_VER ${cryptopp_VERSION_MAJOR}${cryptopp_VERSION_MINOR}${cryptopp_VERSION_PATCH})
|
||||
|
||||
|
|
@ -85,32 +74,75 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
|
|||
add_definitions(-wd68 -wd186 -wd279 -wd327 -wd161 -wd3180)
|
||||
endif()
|
||||
|
||||
# Endianness
|
||||
TEST_BIG_ENDIAN(IS_BIG_ENDIAN)
|
||||
if(IS_BIG_ENDIAN)
|
||||
add_definitions(-DIS_BIG_ENDIAN)
|
||||
endif()
|
||||
|
||||
# Also see http://github.com/weidai11/cryptopp/issues/395
|
||||
if(DISABLE_ASM)
|
||||
add_definitions(-DCRYPTOPP_DISABLE_ASM)
|
||||
endif()
|
||||
if(DISABLE_SSSE3)
|
||||
add_definitions(-DCRYPTOPP_DISABLE_SSSE3)
|
||||
set(DISABLE_NATIVE_ARCH 1)
|
||||
endif()
|
||||
if(DISABLE_SSE4)
|
||||
add_definitions(-DCRYPTOPP_DISABLE_SSE4)
|
||||
endif()
|
||||
if(DISABLE_AESNI)
|
||||
add_definitions(-DCRYPTOPP_DISABLE_AESNI)
|
||||
set(DISABLE_NATIVE_ARCH 1)
|
||||
endif()
|
||||
if(DISABLE_SHA)
|
||||
add_definitions(-DCRYPTOPP_DISABLE_SHA)
|
||||
set(DISABLE_NATIVE_ARCH 1)
|
||||
endif()
|
||||
if(NOT CRYPTOPP_DATA_DIR STREQUAL "")
|
||||
add_definitions(-DCRYPTOPP_DATA_DIR="${CRYPTOPP_DATA_DIR}")
|
||||
endif()
|
||||
|
||||
###############################################################################
|
||||
|
||||
# Begin JW hack
|
||||
|
||||
# Attempt to determine the machine the compiler is targeting.
|
||||
|
||||
set(SHELL_CMD sh -c)
|
||||
set(GREP_CMD egrep -i -c)
|
||||
|
||||
execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1"
|
||||
COMMAND ${GREP_CMD} "x86_64"
|
||||
OUTPUT_VARIABLE CRYPTOPP_X86_64
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1"
|
||||
COMMAND ${GREP_CMD} "i.86"
|
||||
OUTPUT_VARIABLE CRYPTOPP_I386
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1"
|
||||
COMMAND ${GREP_CMD} "x32"
|
||||
OUTPUT_VARIABLE CRYPTOPP_X32
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1"
|
||||
COMMAND ${GREP_CMD} "Aarch32"
|
||||
OUTPUT_VARIABLE CRYPTOPP_AARCH32
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1"
|
||||
COMMAND ${GREP_CMD} "Aarch64"
|
||||
OUTPUT_VARIABLE CRYPTOPP_AARCH64
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
# http://stackoverflow.com/q/12515462/608639
|
||||
execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1"
|
||||
COMMAND ${GREP_CMD} "\\<ARM\\>"
|
||||
OUTPUT_VARIABLE CRYPTOPP_ARMHF
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1"
|
||||
COMMAND ${GREP_CMD} "ARMHF"
|
||||
OUTPUT_VARIABLE CRYPTOPP_ARMHF
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
# End JW hack
|
||||
|
||||
###############################################################################
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
# TODO(unassigned): should we avoid these (for cross-platform compatability)?
|
||||
set(SHELL_CMD sh -c)
|
||||
|
|
@ -132,8 +164,6 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
|||
|
||||
if (GAS_OUTPUT)
|
||||
#.intel_syntax wasn't supported until GNU assembler 2.10
|
||||
# No DISABLE_NATIVE_ARCH with CRYPTOPP_DISABLE_ASM for now
|
||||
# See http://github.com/weidai11/cryptopp/issues/395
|
||||
|
||||
# TODO(unassigned): string() REGEX was not cooperating at time of writing. Re-implement as needed.
|
||||
execute_process(COMMAND echo ${GAS_STRING}
|
||||
|
|
@ -148,7 +178,6 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
|||
OUTPUT_VARIABLE GAS217_OR_LATER)
|
||||
if (GAS217_OR_LATER EQUAL 0)
|
||||
add_definitions(-DCRYPTOPP_DISABLE_SSSE3)
|
||||
set(DISABLE_NATIVE_ARCH 1)
|
||||
endif()
|
||||
|
||||
# OpenBSD and CentOS 5 needed this one due to ARIA and BLAKE2
|
||||
|
|
@ -157,7 +186,6 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
|||
OUTPUT_VARIABLE GAS218_OR_LATER)
|
||||
if (GAS218_OR_LATER EQUAL 0)
|
||||
add_definitions(-DCRYPTOPP_DISABLE_SSE4)
|
||||
set(DISABLE_NATIVE_ARCH 1)
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND echo ${GAS_STRING}
|
||||
|
|
@ -165,7 +193,6 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
|||
OUTPUT_VARIABLE GAS219_OR_LATER)
|
||||
if (GAS219_OR_LATER EQUAL 0)
|
||||
add_definitions(-DCRYPTOPP_DISABLE_AESNI)
|
||||
set(DISABLE_NATIVE_ARCH 1)
|
||||
endif()
|
||||
|
||||
# Ubuntu 10 and Ubuntu 12 needed this one
|
||||
|
|
@ -174,7 +201,6 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
|||
OUTPUT_VARIABLE GAS223_OR_LATER)
|
||||
if (GAS223_OR_LATER EQUAL 0)
|
||||
add_definitions(-DCRYPTOPP_DISABLE_SHA)
|
||||
set(DISABLE_NATIVE_ARCH 1)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
|
@ -218,37 +244,28 @@ if ((NOT CRYPTOPP_CROSS_COMPILE) AND (NOT (WINDOWS OR WINDOWS_STORE OR WINDOWS_P
|
|||
endif()
|
||||
endif()
|
||||
|
||||
# -march=native for GCC, Clang and ICC in any version that does support it.
|
||||
if ((NOT DISABLE_NATIVE_ARCH) AND (NOT CRYPTOPP_CROSS_COMPILE) AND (CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU|Intel"))
|
||||
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_OPT_ARCH_NATIVE_SUPPORTED)
|
||||
if (COMPILER_OPT_ARCH_NATIVE_SUPPORTED AND NOT CMAKE_CXX_FLAGS MATCHES "-march=")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Solaris specific
|
||||
if ((NOT CRYPTOPP_CROSS_COMPILE) AND "${UNAME_SYSTEM}" STREQUAL "SunOS")
|
||||
if (NOT DISABLE_NATIVE_ARCH)
|
||||
# SunCC needs -native
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "SunPro")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -native")
|
||||
endif()
|
||||
|
||||
# Determine 32-bit vs 64-bit
|
||||
set (ISA_CMD "isainfo")
|
||||
set (ISA_ARG "-b")
|
||||
execute_process(COMMAND ${ISA_CMD} ${ISA_ARG}
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
RESULT_VARIABLE ISA_RESULT
|
||||
OUTPUT_VARIABLE ISA_INFO)
|
||||
string(REGEX REPLACE "\n$" "" ISA_INFO "${ISA_INFO}")
|
||||
# SunCC needs -native
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "SunPro")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -native")
|
||||
endif()
|
||||
|
||||
# Set 64-bit or 32-bit
|
||||
if ("${ISA_INFO}" STREQUAL "64")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
|
||||
else()
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
|
||||
endif()
|
||||
# Determine 32-bit vs 64-bit
|
||||
set (ISA_CMD "isainfo")
|
||||
set (ISA_ARG "-b")
|
||||
execute_process(COMMAND ${ISA_CMD} ${ISA_ARG}
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
RESULT_VARIABLE ISA_RESULT
|
||||
OUTPUT_VARIABLE ISA_INFO)
|
||||
string(REGEX REPLACE "\n$" "" ISA_INFO "${ISA_INFO}")
|
||||
|
||||
# Set 64-bit or 32-bit
|
||||
if ("${ISA_INFO}" STREQUAL "64")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
|
||||
else()
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
|
||||
endif()
|
||||
|
||||
# GCC needs to enable use of '/'
|
||||
|
|
@ -256,7 +273,7 @@ if ((NOT CRYPTOPP_CROSS_COMPILE) AND "${UNAME_SYSTEM}" STREQUAL "SunOS")
|
|||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wa,--divide")
|
||||
endif()
|
||||
|
||||
# SunCC needs -native
|
||||
# SunCC needs -template=no%extdef
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "SunPro")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -template=no%extdef")
|
||||
endif()
|
||||
|
|
@ -330,6 +347,81 @@ if(MSVC AND NOT DISABLE_ASM)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
#============================================================================
|
||||
# Architecture flags
|
||||
#============================================================================
|
||||
|
||||
# New as of Pull Request 461, http://github.com/weidai11/cryptopp/pull/461.
|
||||
if (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU"))
|
||||
|
||||
if (("${CRYPTOPP_X86_64}" STREQUAL "1") OR ("${CRYPTOPP_I386}" STREQUAL "1") OR ("${CRYPTOPP_X32}" STREQUAL "1"))
|
||||
|
||||
CHECK_CXX_COMPILER_FLAG("-mssse3" CRYPTOPP_IA32_SSSE3)
|
||||
CHECK_CXX_COMPILER_FLAG("-msse4.2" CRYPTOPP_IA32_SSE4)
|
||||
CHECK_CXX_COMPILER_FLAG("-mssse3 -mpclmul" CRYPTOPP_IA32_CLMUL)
|
||||
CHECK_CXX_COMPILER_FLAG("-msse4.1 -maes" CRYPTOPP_IA32_AES)
|
||||
CHECK_CXX_COMPILER_FLAG("-msse4.2 -msha" CRYPTOPP_IA32_SHA)
|
||||
|
||||
if ("${CRYPTOPP_IA32_SSSE3}" STREQUAL "1")
|
||||
set_source_files_properties(aria-simd.cpp PROPERTIES COMPILE_FLAGS "-mssse3")
|
||||
endif()
|
||||
if ("${CRYPTOPP_IA32_SSE4}" STREQUAL "1")
|
||||
set_source_files_properties(blake2-simd.cpp PROPERTIES COMPILE_FLAGS "-msse4.2")
|
||||
set_source_files_properties(crc-simd.cpp PROPERTIES COMPILE_FLAGS "-msse4.2")
|
||||
endif()
|
||||
if ("${CRYPTOPP_IA32_CLMUL}" STREQUAL "1")
|
||||
set_source_files_properties(gcm-simd.cpp PROPERTIES COMPILE_FLAGS "-mssse3 -mpclmul")
|
||||
endif()
|
||||
if ("${CRYPTOPP_IA32_AES}" STREQUAL "1")
|
||||
set_source_files_properties(rijndael-simd.cpp PROPERTIES COMPILE_FLAGS "-msse4.1 -maes")
|
||||
endif()
|
||||
if ("${CRYPTOPP_IA32_SHA}" STREQUAL "1")
|
||||
set_source_files_properties(sha-simd.cpp PROPERTIES COMPILE_FLAGS "-msse4.2 -msha")
|
||||
set_source_files_properties(shacal2-simd.cpp PROPERTIES COMPILE_FLAGS "-msse4.2 -msha")
|
||||
endif()
|
||||
|
||||
elseif (("${CRYPTOPP_AARCH32}" STREQUAL "1") OR ("${CRYPTOPP_AARCH64}" STREQUAL "1") OR ("${CRYPTOPP_ARMV8}" STREQUAL "1"))
|
||||
|
||||
CHECK_CXX_COMPILER_FLAG("-march=armv8-a" CRYPTOPP_ARMV8A_ASIMD)
|
||||
CHECK_CXX_COMPILER_FLAG("-march=armv8-a+crc" CRYPTOPP_ARMV8A_CRC)
|
||||
CHECK_CXX_COMPILER_FLAG("-march=armv8-a+crypto" CRYPTOPP_ARMV8A_CRYPTO)
|
||||
|
||||
if ("${CRYPTOPP_ARMV8A_ASIMD}" STREQUAL "1")
|
||||
set_source_files_properties(aria-simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a")
|
||||
set_source_files_properties(blake2-simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a")
|
||||
set_source_files_properties(neon-simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a")
|
||||
endif()
|
||||
if ("${CRYPTOPP_ARMV8A_CRC}" STREQUAL "1")
|
||||
set_source_files_properties(crc-simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a+crc")
|
||||
endif()
|
||||
if ("${CRYPTOPP_ARMV8A_CRYPTO}" STREQUAL "1")
|
||||
set_source_files_properties(gcm-simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a+crypto")
|
||||
set_source_files_properties(rijndael-simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a+crypto")
|
||||
set_source_files_properties(sha-simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a+crypto")
|
||||
set_source_files_properties(shacal2-simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a+crypto")
|
||||
endif()
|
||||
|
||||
elseif (("${CRYPTOPP_ARM}" STREQUAL "1") OR ("${CRYPTOPP_ARMHF}" STREQUAL "1"))
|
||||
|
||||
CHECK_CXX_COMPILER_FLAG("-march=armv7-a -mfloat-abi=hard -mfpu=neon" CRYPTOPP_ARMV7A_HARD)
|
||||
CHECK_CXX_COMPILER_FLAG("-march=armv7-a -mfloat-abi=softfp -mfpu=neon" CRYPTOPP_ARMV7A_SOFTFP)
|
||||
|
||||
if ("${CRYPTOPP_ARMV7A_HARD}" STREQUAL "1")
|
||||
# Need to set floating point ABI to something, like "hard" of "softfp". Most Linux use hard floats ("hard").
|
||||
set_source_files_properties(aria-simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfloat-abi=hard -mfpu=neon")
|
||||
set_source_files_properties(blake2-simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfloat-abi=hard -mfpu=neon")
|
||||
set_source_files_properties(gcm-simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfloat-abi=hard -mfpu=neon")
|
||||
set_source_files_properties(neon-simd.cpp PROPERTIES COMPILE_FLAGS "-mfloat-abi=hard -mfpu=neon")
|
||||
elseif ("${CRYPTOPP_ARMV7A_SOFTFP}" STREQUAL "1")
|
||||
# Need to set floating point ABI to something, like "hard" of "softfp". Most Linux use hard floats ("hard").
|
||||
set_source_files_properties(aria-simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfloat-abi=softfp -mfpu=neon")
|
||||
set_source_files_properties(blake2-simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfloat-abi=softfp -mfpu=neon")
|
||||
set_source_files_properties(gcm-simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfloat-abi=softfp -mfpu=neon")
|
||||
set_source_files_properties(neon-simd.cpp PROPERTIES COMPILE_FLAGS "-mfloat-abi=softfp -mfpu=neon")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#============================================================================
|
||||
# Compile targets
|
||||
#============================================================================
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ mqv.cpp
|
|||
mqv.h
|
||||
nbtheory.cpp
|
||||
nbtheory.h
|
||||
neon.cpp
|
||||
neon-simd.cpp
|
||||
network.cpp
|
||||
network.h
|
||||
nr.h
|
||||
|
|
|
|||
50
GNUmakefile
50
GNUmakefile
|
|
@ -53,13 +53,6 @@ SUNCC_511_OR_LATER := $(shell $(CXX) -V 2>&1 | $(EGREP) -c "CC: (Sun|Studio) .*
|
|||
SUNCC_512_OR_LATER := $(shell $(CXX) -V 2>&1 | $(EGREP) -c "CC: (Sun|Studio) .* (5\.1[2-9]|5\.[2-9]|6\.)")
|
||||
SUNCC_513_OR_LATER := $(shell $(CXX) -V 2>&1 | $(EGREP) -c "CC: (Sun|Studio) .* (5\.1[3-9]|5\.[2-9]|6\.)")
|
||||
|
||||
# Set this to 1 to avoid -march=native
|
||||
DISABLE_NATIVE_ARCH ?= 0
|
||||
# Check CXXFLAGS for -DDISABLE_NATIVE_ARCH
|
||||
ifneq ($(findstring -DDISABLE_NATIVE_ARCH,$(CXXFLAGS)),)
|
||||
DISABLE_NATIVE_ARCH := 1
|
||||
endif
|
||||
|
||||
# Enable shared object versioning for Linux
|
||||
HAS_SOLIB_VERSION := $(IS_LINUX)
|
||||
|
||||
|
|
@ -130,7 +123,7 @@ endif
|
|||
|
||||
ifneq ($(HAS_NEWLIB),0)
|
||||
ifeq ($(findstring -D_XOPEN_SOURCE,$(CXXFLAGS)),)
|
||||
CXXFLAGS += -D_XOPEN_SOURCE=700
|
||||
CXXFLAGS += -D_XOPEN_SOURCE=600
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
@ -232,32 +225,6 @@ endif # -DCRYPTOPP_DISABLE_AESNI
|
|||
endif # -DCRYPTOPP_DISABLE_SSE4
|
||||
endif # -DCRYPTOPP_DISABLE_SSSE3
|
||||
|
||||
# BEGIN_NATIVE_ARCH
|
||||
# Guard use of -march=native (or -m{32|64} on some platforms)
|
||||
# Don't add anything if -march=XXX or -mtune=XXX is specified
|
||||
ifeq ($(DISABLE_NATIVE_ARCH),0)
|
||||
ifeq ($(findstring -march,$(CXXFLAGS)),)
|
||||
ifeq ($(findstring -mtune,$(CXXFLAGS)),)
|
||||
ifeq ($(GCC42_OR_LATER)$(IS_NETBSD),10)
|
||||
CXXFLAGS += -march=native
|
||||
else ifneq ($(CLANG_COMPILER)$(INTEL_COMPILER),00)
|
||||
CXXFLAGS += -march=native
|
||||
else
|
||||
# GCC 3.3 and "unknown option -march="
|
||||
# Ubuntu GCC 4.1 compiler crash with -march=native
|
||||
# NetBSD GCC 4.8 compiler and "bad value (native) for -march= switch"
|
||||
# Sun compiler is handled below
|
||||
ifeq ($(SUN_COMPILER)$(IS_X64),01)
|
||||
CXXFLAGS += -m64
|
||||
else ifeq ($(SUN_COMPILER)$(IS_X86),01)
|
||||
CXXFLAGS += -m32
|
||||
endif # X86/X32/X64
|
||||
endif
|
||||
endif # -mtune
|
||||
endif # -march
|
||||
endif # DISABLE_NATIVE_ARCH
|
||||
# END_NATIVE_ARCH
|
||||
|
||||
ifneq ($(INTEL_COMPILER),0)
|
||||
CXXFLAGS += -wd68 -wd186 -wd279 -wd327 -wd161 -wd3180
|
||||
ifeq ($(ICC111_OR_LATER),0)
|
||||
|
|
@ -436,6 +403,13 @@ CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
|
|||
endif # CXXFLAGS
|
||||
endif # No ASM
|
||||
|
||||
# Native build testing. Issue 'make native'.
|
||||
ifeq ($(findstring native,$(MAKECMDGOALS)),native)
|
||||
ifeq ($(findstring -march=native,$(CXXFLAGS)),)
|
||||
CXXFLAGS += -march=native
|
||||
endif # CXXFLAGS
|
||||
endif # Native
|
||||
|
||||
# Undefined Behavior Sanitizer (UBsan) testing. Issue 'make ubsan'.
|
||||
ifeq ($(findstring ubsan,$(MAKECMDGOALS)),ubsan)
|
||||
CXXFLAGS := $(CXXFLAGS:-g%=-g3)
|
||||
|
|
@ -597,7 +571,7 @@ TESTOBJS := $(TESTSRCS:.cpp=.o)
|
|||
LIBOBJS := $(filter-out $(TESTOBJS),$(OBJS))
|
||||
|
||||
# List cryptlib.cpp first, then cpu.cpp, then integer.cpp to tame C++ static initialization problems.
|
||||
DLLSRCS := cryptlib.cpp cpu.cpp integer.cpp 3way.cpp adler32.cpp algebra.cpp algparam.cpp arc4.cpp aria-simd.cpp aria.cpp ariatab.cpp asn.cpp authenc.cpp base32.cpp base64.cpp basecode.cpp bfinit.cpp blake2-simd.cpp blake2.cpp blowfish.cpp blumshub.cpp camellia.cpp cast.cpp casts.cpp cbcmac.cpp ccm.cpp chacha.cpp channels.cpp cmac.cpp crc-simd.cpp crc.cpp default.cpp des.cpp dessp.cpp dh.cpp dh2.cpp dll.cpp dsa.cpp eax.cpp ec2n.cpp eccrypto.cpp ecp.cpp elgamal.cpp emsa2.cpp eprecomp.cpp esign.cpp files.cpp filters.cpp fips140.cpp fipstest.cpp gcm-simd.cpp gcm.cpp gf256.cpp gf2_32.cpp gf2n.cpp gfpcrypt.cpp gost.cpp gzip.cpp hex.cpp hmac.cpp hrtimer.cpp ida.cpp idea.cpp iterhash.cpp kalyna.cpp kalynatab.cpp keccak.cpp luc.cpp mars.cpp marss.cpp md2.cpp md4.cpp md5.cpp misc.cpp modes.cpp mqueue.cpp mqv.cpp nbtheory.cpp neon.cpp network.cpp oaep.cpp ospstore.cpp osrng.cpp panama.cpp pkcspad.cpp poly1305.cpp polynomi.cpp pssr.cpp pubkey.cpp queue.cpp rabin.cpp randpool.cpp rc2.cpp rc5.cpp rc6.cpp rdrand.cpp rdtables.cpp rijndael.cpp ripemd.cpp rng.cpp rsa.cpp rw.cpp safer.cpp salsa.cpp seal.cpp seed.cpp serpent.cpp sha-simd.cpp sha.cpp sha3.cpp shacal2-simd.cpp shacal2.cpp shark.cpp sharkbox.cpp skipjack.cpp socketft.cpp sosemanuk.cpp square.cpp squaretb.cpp strciphr.cpp tea.cpp tftables.cpp threefish.cpp tiger.cpp tigertab.cpp trdlocal.cpp ttmac.cpp twofish.cpp vmac.cpp wait.cpp wake.cpp whrlpool.cpp xtr.cpp xtrcrypt.cpp zdeflate.cpp zinflate.cpp zlib.cpp
|
||||
DLLSRCS := cryptlib.cpp cpu.cpp integer.cpp 3way.cpp adler32.cpp algebra.cpp algparam.cpp arc4.cpp aria-simd.cpp aria.cpp ariatab.cpp asn.cpp authenc.cpp base32.cpp base64.cpp basecode.cpp bfinit.cpp blake2-simd.cpp blake2.cpp blowfish.cpp blumshub.cpp camellia.cpp cast.cpp casts.cpp cbcmac.cpp ccm.cpp chacha.cpp channels.cpp cmac.cpp crc-simd.cpp crc.cpp default.cpp des.cpp dessp.cpp dh.cpp dh2.cpp dll.cpp dsa.cpp eax.cpp ec2n.cpp eccrypto.cpp ecp.cpp elgamal.cpp emsa2.cpp eprecomp.cpp esign.cpp files.cpp filters.cpp fips140.cpp fipstest.cpp gcm-simd.cpp gcm.cpp gf256.cpp gf2_32.cpp gf2n.cpp gfpcrypt.cpp gost.cpp gzip.cpp hex.cpp hmac.cpp hrtimer.cpp ida.cpp idea.cpp iterhash.cpp kalyna.cpp kalynatab.cpp keccak.cpp luc.cpp mars.cpp marss.cpp md2.cpp md4.cpp md5.cpp misc.cpp modes.cpp mqueue.cpp mqv.cpp nbtheory.cpp neon-simd.cpp network.cpp oaep.cpp ospstore.cpp osrng.cpp panama.cpp pkcspad.cpp poly1305.cpp polynomi.cpp pssr.cpp pubkey.cpp queue.cpp rabin.cpp randpool.cpp rc2.cpp rc5.cpp rc6.cpp rdrand.cpp rdtables.cpp rijndael.cpp ripemd.cpp rng.cpp rsa.cpp rw.cpp safer.cpp salsa.cpp seal.cpp seed.cpp serpent.cpp sha-simd.cpp sha.cpp sha3.cpp shacal2-simd.cpp shacal2.cpp shark.cpp sharkbox.cpp skipjack.cpp socketft.cpp sosemanuk.cpp square.cpp squaretb.cpp strciphr.cpp tea.cpp tftables.cpp threefish.cpp tiger.cpp tigertab.cpp trdlocal.cpp ttmac.cpp twofish.cpp vmac.cpp wait.cpp wake.cpp whrlpool.cpp xtr.cpp xtrcrypt.cpp zdeflate.cpp zinflate.cpp zlib.cpp
|
||||
|
||||
DLLOBJS := $(DLLSRCS:.cpp=.export.o)
|
||||
|
||||
|
|
@ -626,8 +600,8 @@ dep deps depend GNUmakefile.deps:
|
|||
$(CXX) $(strip $(CXXFLAGS)) -MM *.cpp > GNUmakefile.deps
|
||||
|
||||
# CXXFLAGS are tuned earlier.
|
||||
.PHONY: asan ubsan no-asm
|
||||
no-asm asan ubsan: libcryptopp.a cryptest.exe
|
||||
.PHONY: native no-asm asan ubsan
|
||||
native no-asm asan ubsan: libcryptopp.a cryptest.exe
|
||||
|
||||
# CXXFLAGS are tuned earlier. Applications must use linker flags
|
||||
# -Wl,--gc-sections (Linux and Unix) or -Wl,-dead_strip (OS X)
|
||||
|
|
@ -894,7 +868,7 @@ aria-simd.o : aria-simd.cpp
|
|||
$(CXX) $(strip $(CXXFLAGS) $(ARIA_FLAG) -c) $<
|
||||
|
||||
# SSE4.2 or NEON available
|
||||
neon.o : neon.cpp
|
||||
neon-simd.o : neon-simd.cpp
|
||||
$(CXX) $(strip $(CXXFLAGS) $(NEON_FLAG) -c) $<
|
||||
|
||||
# SSE4.2 or ARMv8a available
|
||||
|
|
|
|||
|
|
@ -127,8 +127,8 @@ LDLIBS = $(LDLIBS) ws2_32.lib kernel32.lib
|
|||
!IF "$(PLATFORM)" == "ARM" || "$(PLATFORM)" == "arm" || "$(PLATFORM)" == "ARM64" || "$(PLATFORM)" == "arm64"
|
||||
# CXXFLAGS = $(CXXFLAGS) /D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1 /DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP
|
||||
CXXFLAGS = $(CXXFLAGS) /DWINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP
|
||||
LIB_SRCS = $(LIB_SRCS) neon.cpp
|
||||
LIB_OBJS = $(LIB_OBJS) neon.obj
|
||||
LIB_SRCS = $(LIB_SRCS) neon-simd.cpp
|
||||
LIB_OBJS = $(LIB_OBJS) neon-simd.obj
|
||||
# CXXFLAGS = $(CXXFLAGS) /DWINAPI_FAMILY=WINAPI_FAMILY_APP
|
||||
# LDLIBS = $(LDLIBS) ws2_32.lib
|
||||
!ENDIF
|
||||
|
|
|
|||
Loading…
Reference in New Issue