From 63b7ec288796b7248b3ad551246fd2e31c922a31 Mon Sep 17 00:00:00 2001 From: SChernykh Date: Mon, 29 Nov 2021 09:48:15 +0100 Subject: [PATCH] Check compiler support for VAES --- cmake/cpu.cmake | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cmake/cpu.cmake b/cmake/cpu.cmake index 4fd1f25a..4a661b23 100644 --- a/cmake/cpu.cmake +++ b/cmake/cpu.cmake @@ -9,6 +9,18 @@ if (NOT CMAKE_SYSTEM_PROCESSOR) message(WARNING "CMAKE_SYSTEM_PROCESSOR not defined") endif() +include(CheckCXXCompilerFlag) + +if (CMAKE_CXX_COMPILER_ID MATCHES MSVC) + set(VAES_SUPPORTED ON) +else() + CHECK_CXX_COMPILER_FLAG("-mavx2 -mvaes" VAES_SUPPORTED) +endif() + +if (NOT VAES_SUPPORTED) + set(WITH_VAES OFF) +endif() + if (XMRIG_64_BIT AND CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|AMD64)$") add_definitions(-DRAPIDJSON_SSE2) else() @@ -30,8 +42,6 @@ if (ARM_TARGET AND ARM_TARGET GREATER 6) message(STATUS "Use ARM_TARGET=${ARM_TARGET} (${CMAKE_SYSTEM_PROCESSOR})") - include(CheckCXXCompilerFlag) - if (ARM_TARGET EQUAL 8) CHECK_CXX_COMPILER_FLAG(-march=armv8-a+crypto XMRIG_ARM_CRYPTO)