Fix compiler version check for Intel Cooperlake support (clang-cl does not accept -dumpversion)
@@ -148,16 +148,20 @@ endif ()
include("${PROJECT_SOURCE_DIR}/cmake/prebuild.cmake")
if (DEFINED TARGET)
if (${TARGET} STREQUAL COOPERLAKE AND NOT NO_AVX512)
-# if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
+ if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
- if (${GCC_VERSION} VERSION_GREATER 10.1 OR ${GCC_VERSION} VERSION_EQUAL 10.1)
+ if (${CMAKE_C_COMPILER_VERSION} VERSION_GREATER 10.1 OR ${CMAKE_C_COMPILER_VERSION} VERSION_EQUAL 10.1)
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=cooperlake")
else()
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=skylake-avx512")
endif()
-# elseif (${CMAKE_C_COMPILER_ID} STREQUAL "CLANG")
-# set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -mavx2")
-# endif()
+ elseif (${CMAKE_C_COMPILER_ID} STREQUAL "CLANG")
+ if (${CMAKE_C_COMPILER_VERSION} VERSION_GREATER 8.99)
+ set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=cooperlake")
+ else()
+ set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=skylake-avx512")
+ endif()
+ endif()
endif()
if (${TARGET} STREQUAL SKYLAKEX AND NOT NO_AVX512)
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=skylake-avx512")
