From 46f43bc4f78018e0e581938b1def9a18216ff5fb Mon Sep 17 00:00:00 2001 From: Cameron Cawley Date: Sun, 13 May 2018 11:34:32 +0100 Subject: [PATCH] cryptopp: Fix compilation on non-x86/x86_64 systems --- externals/cryptopp/CMakeLists.txt | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/externals/cryptopp/CMakeLists.txt b/externals/cryptopp/CMakeLists.txt index add5fb4447..e5e63d83f0 100644 --- a/externals/cryptopp/CMakeLists.txt +++ b/externals/cryptopp/CMakeLists.txt @@ -189,13 +189,20 @@ if(MSVC AND NOT CRYPTOPP_DISABLE_ASM) endif() if ((CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT CRYPTOPP_DISABLE_ASM) - if(${CMAKE_GENERATOR} MATCHES ".*ARM") - message(STATUS "Disabling ASM because ARM is specified as target platform.") - else() - set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/rijndael-simd.cpp PROPERTIES COMPILE_FLAGS "-msse4.1 -maes") - set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/sha-simd.cpp PROPERTIES COMPILE_FLAGS "-msse4.2 -msha") + check_cxx_compiler_flag(-msse2 CRYPTOPP_HAS_MSSE2) + check_cxx_compiler_flag(-msse4.1 CRYPTOPP_HAS_MSSE41) + check_cxx_compiler_flag(-msse4.2 CRYPTOPP_HAS_MSSE42) + check_cxx_compiler_flag(-maes CRYPTOPP_HAS_MAES) + check_cxx_compiler_flag(-msha CRYPTOPP_HAS_MSHA) + if (CRYPTOPP_HAS_MSSE2) set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/cryptopp/sse-simd.cpp PROPERTIES COMPILE_FLAGS "-msse2") 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") + 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() #============================================================================