Update architecture checks for highwayhash

Now we use cmake to determine which compiler flags are set to
determine which implementation of highwayhash to compile. This should
be much more robust.

Also - fix missing include on old ubuntus.
This commit is contained in:
Johanna Amann 2020-05-12 12:03:10 -07:00
parent fd5e1ae42a
commit 7f137b7d50
4 changed files with 7 additions and 5 deletions

View file

@ -15,6 +15,7 @@ endif ()
include(cmake/CommonCMakeConfig.cmake) include(cmake/CommonCMakeConfig.cmake)
include(cmake/FindClangTidy.cmake) include(cmake/FindClangTidy.cmake)
include(cmake/CheckCompilerArch.cmake)
######################################################################## ########################################################################
## Project/Build Configuration ## Project/Build Configuration

2
cmake

@ -1 +1 @@
Subproject commit d85153d8e0e62fbd6f1125c498b2741f4bc987dc Subproject commit e49c2eecc68f49490297c54c78fb8cff8fa83ac7

View file

@ -329,23 +329,23 @@ set(HH_SRCS
3rdparty/highwayhash/highwayhash/hh_portable.cc 3rdparty/highwayhash/highwayhash/hh_portable.cc
) )
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") if (${COMPILER_ARCHITECTURE} STREQUAL "arm")
set_source_files_properties(${HH_SRCS} PROPERTIES COMPILE_FLAGS set_source_files_properties(${HH_SRCS} PROPERTIES COMPILE_FLAGS
-mfloat-abi=hard -march=armv7-a -mfpu=neon) -mfloat-abi=hard -march=armv7-a -mfpu=neon)
list(APPEND HH_SRCS list(APPEND HH_SRCS
3rdparty/highwayhash/highwayhash/hh_neon.cc 3rdparty/highwayhash/highwayhash/hh_neon.cc
) )
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64") elseif (${COMPILER_ARCHITECTURE} STREQUAL "aarch64")
list(APPEND HH_SRCS list(APPEND HH_SRCS
3rdparty/highwayhash/highwayhash/hh_neon.cc 3rdparty/highwayhash/highwayhash/hh_neon.cc
) )
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)") elseif (${COMPILER_ARCHITECTURE} STREQUAL "power")
set_source_files_properties(3rdparty/highwayhash/highwayhash/hh_avx2.cc PROPERTIES COMPILE_FLAGS set_source_files_properties(3rdparty/highwayhash/highwayhash/hh_avx2.cc PROPERTIES COMPILE_FLAGS
-mvsx) -mvsx)
list(APPEND HH_SRCS list(APPEND HH_SRCS
3rdparty/highwayhash/highwayhash/hh_vsc.cc 3rdparty/highwayhash/highwayhash/hh_vsc.cc
) )
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64)|(AMD64|amd64)") elseif(${COMPILER_ARCHITECTURE} STREQUAL "x86_64")
set_source_files_properties(3rdparty/highwayhash/highwayhash/hh_avx2.cc PROPERTIES COMPILE_FLAGS set_source_files_properties(3rdparty/highwayhash/highwayhash/hh_avx2.cc PROPERTIES COMPILE_FLAGS
-mavx2) -mavx2)
set_source_files_properties(3rdparty/highwayhash/highwayhash/hh_sse41.cc PROPERTIES COMPILE_FLAGS set_source_files_properties(3rdparty/highwayhash/highwayhash/hh_sse41.cc PROPERTIES COMPILE_FLAGS

View file

@ -11,6 +11,7 @@
#include <openssl/evp.h> #include <openssl/evp.h>
#include <sys/types.h> // for u_char #include <sys/types.h> // for u_char
#include <cstdint>
#if ( OPENSSL_VERSION_NUMBER < 0x10100000L ) || defined(LIBRESSL_VERSION_NUMBER) #if ( OPENSSL_VERSION_NUMBER < 0x10100000L ) || defined(LIBRESSL_VERSION_NUMBER)
#define EVP_MD_CTX_new EVP_MD_CTX_create #define EVP_MD_CTX_new EVP_MD_CTX_create