* Use CMAKE_C_COMPILER_VERSION throughouttags/v0.3.28^2
@@ -5,10 +5,10 @@ | |||
include(CheckCCompilerFlag) | |||
if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_C_COMPILER_ID} STREQUAL "LSB" OR ${CMAKE_C_COMPILER_ID} MATCHES "Clang") | |||
set(CCOMMON_OPT "${CCOMMON_OPT} -Wall") | |||
set(COMMON_PROF "${COMMON_PROF} -fno-inline") | |||
set(NO_UNINITIALIZED_WARN "-Wno-uninitialized") | |||
set(GCC_VERSION ${CMAKE_C_COMPILER_VERSION}) | |||
if (QUIET_MAKE) | |||
set(CCOMMON_OPT "${CCOMMON_OPT} ${NO_UNINITIALIZED_WARN} -Wno-unused") | |||
@@ -140,7 +140,6 @@ endif () | |||
if (${CORE} STREQUAL COOPERLAKE) | |||
if (NOT DYNAMIC_ARCH) | |||
if (NOT NO_AVX512) | |||
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) | |||
set (CCOMMON_OPT "${CCOMMON_OPT} -march=cooperlake") | |||
else () | |||
@@ -153,7 +152,6 @@ endif () | |||
if (${CORE} STREQUAL SAPPHIRERAPIDS) | |||
if (NOT DYNAMIC_ARCH) | |||
if (NOT NO_AVX512) | |||
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
if (${GCC_VERSION} VERSION_GREATER 11.0 OR ${GCC_VERSION} VERSION_EQUAL 11.0) | |||
set (CCOMMON_OPT "${CCOMMON_OPT} -march=sapphirerapids") | |||
else () | |||
@@ -167,7 +165,6 @@ if (${CORE} STREQUAL ZEN) | |||
if (HAVE_AVX512VL) | |||
if (NOT DYNAMIC_ARCH) | |||
if (NOT NO_AVX512) | |||
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
if (${GCC_VERSION} VERSION_GREATER 13.0 OR ${GCC_VERSION} VERSION_EQUAL 13.0) | |||
set (CCOMMON_OPT "${CCOMMON_OPT} -march=znver4") | |||
else () | |||
@@ -180,7 +177,6 @@ endif () | |||
if (${CORE} STREQUAL A64FX) | |||
if (NOT DYNAMIC_ARCH) | |||
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
if (${GCC_VERSION} VERSION_GREATER 11.0 OR ${GCC_VERSION} VERSION_EQUAL 11.0) | |||
set (CCOMMON_OPT "${CCOMMON_OPT} -march=armv8.2-a+sve -mtune=a64fx") | |||
else () | |||
@@ -194,7 +190,6 @@ if (${CORE} STREQUAL NEOVERSEN2) | |||
if (${CMAKE_C_COMPILER_ID} STREQUAL "PGI" AND NOT NO_SVE) | |||
set (CCOMMON_OPT "${CCOMMON_OPT} -Msve_intrinsics -march=armv8.5-a+sve+sve2+bf16 -mtune=neoverse-n2") | |||
else () | |||
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
if (${GCC_VERSION} VERSION_GREATER 10.4 OR ${GCC_VERSION} VERSION_EQUAL 10.4) | |||
set (CCOMMON_OPT "${CCOMMON_OPT} -march=armv8.5-a+sve+sve2+bf16 -mtune=neoverse-n2") | |||
else () | |||
@@ -209,7 +204,6 @@ if (${CORE} STREQUAL NEOVERSEV1) | |||
if (${CMAKE_C_COMPILER_ID} STREQUAL "PGI" AND NOT NO_SVE) | |||
set (CCOMMON_OPT "${CCOMMON_OPT} -Msve_intrinsics -march=armv8.4-a+sve -mtune=neoverse-v1") | |||
else () | |||
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
if (${GCC_VERSION} VERSION_GREATER 10.4 OR ${GCC_VERSION} VERSION_EQUAL 10.4) | |||
set (CCOMMON_OPT "${CCOMMON_OPT} -march=armv8.4-a+sve -mtune=neoverse-v1") | |||
else () | |||
@@ -221,7 +215,6 @@ endif () | |||
if (${CORE} STREQUAL NEOVERSEN1) | |||
if (NOT DYNAMIC_ARCH) | |||
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
if (${GCC_VERSION} VERSION_GREATER 9.4 OR ${GCC_VERSION} VERSION_EQUAL 9.4) | |||
set (CCOMMON_OPT "${CCOMMON_OPT} -march=armv8.2-a+sve -mtune=neoverse-n1") | |||
else () | |||
@@ -266,23 +259,21 @@ endif () | |||
if (${CORE} STREQUAL POWER10) | |||
if (NOT DYNAMIC_ARCH) | |||
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
if (${GCC_VERSION} VERSION_GREATER 10.2 OR ${GCC_VERSION} VERSION_EQUAL 10.2) | |||
set (CCOMMON_OPT "${CCOMMON_OPT} -mcpu=power10 -mtune=power10 -mvsx -fno-fast-math") | |||
else () | |||
message(FATAL_ERROR "Compiler GCC.${GCC_VERSION} does not support Power10." ) | |||
message(FATAL_ERROR "Compiler GCC ${GCC_VERSION} does not support Power10." ) | |||
endif() | |||
endif () | |||
endif () | |||
if (${CORE} STREQUAL POWER9) | |||
if (NOT DYNAMIC_ARCH) | |||
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
if (${GCC_VERSION} VERSION_GREATER 5.0 OR ${GCC_VERSION} VERSION_EQUAL 5.0) | |||
set (CCOMMON_OPT "${CCOMMON_OPT} -mcpu=power9 -mtune=power9 -mvsx -fno-fast-math") | |||
else () | |||
set (CCOMMON_OPT "${CCOMMON_OPT} -mcpu=power8 -mtune=power8 -mvsx -fno-fast-math") | |||
message(WARNING "Compiler GCC.${GCC_VERSION} does not fully support Power9.") | |||
message(WARNING "Compiler GCC ${GCC_VERSION} does not fully support Power9.") | |||
endif () | |||
endif () | |||
endif () | |||
@@ -38,7 +38,7 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | |||
# Test for supporting MS_ABI | |||
# removed string parsing in favor of CMake's version comparison -hpa | |||
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
set(GCC_VERSION ${CMAKE_C_COMPILER_VERSION}) | |||
if (${GCC_VERSION} VERSION_GREATER 4.7 OR ${GCC_VERSION} VERSION_EQUAL 4.7) | |||
# GCC Version >=4.7 | |||
# It is compatible with MSVC ABI. | |||
@@ -170,7 +170,6 @@ 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") | |||
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
if (${CMAKE_C_COMPILER_VERSION} VERSION_GREATER 10.09) | |||
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=cooperlake") | |||
else() | |||
@@ -186,7 +185,6 @@ if (DEFINED TARGET) | |||
endif() | |||
if (${TARGET} STREQUAL SAPPHIRERAPIDS AND NOT NO_AVX512) | |||
if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU") | |||
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
if (${CMAKE_C_COMPILER_VERSION} VERSION_GREATER 11.0) | |||
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=sapphirerapids") | |||
else() | |||
@@ -209,7 +207,6 @@ if (DEFINED TARGET) | |||
if (((${TARGET} STREQUAL ZEN) AND HAVE_AVX512VL) AND NOT NO_AVX512) | |||
if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU") | |||
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
if (${CMAKE_C_COMPILER_VERSION} VERSION_GREATER 12.99) | |||
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=znver4") | |||
else() | |||
@@ -227,8 +224,7 @@ if (DEFINED TARGET) | |||
if ((${TARGET} STREQUAL HASWELL OR (${TARGET} STREQUAL ZEN AND NOT HAVE_AVX512VL)) AND NOT NO_AVX2) | |||
if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU") | |||
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
if (${GCC_VERSION} VERSION_GREATER 4.7 OR ${GCC_VERSION} VERSION_EQUAL 4.7) | |||
if (CMAKE_C_COMPILER_VERSION} VERSION_GREATER 4.7 OR CMAKE_C_COMPILER_VERSION VERSION_EQUAL 4.7) | |||
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -mavx2") | |||
endif() | |||
elseif (${CMAKE_C_COMPILER_ID} STREQUAL "CLANG") | |||
@@ -267,20 +263,18 @@ if (DEFINED TARGET) | |||
endif() | |||
if (${TARGET} STREQUAL POWER10) | |||
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
if (${GCC_VERSION} VERSION_GREATER 10.2 OR ${GCC_VERSION} VERSION_EQUAL 10.2) | |||
if (CMAKE_C_COMPILER VERSION VERSION_GREATER 10.2 OR CMAKE_C_COMPILER_VERSION VERSION_EQUAL 10.2) | |||
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -mcpu=power10 -mtune=power10 -mvsx -fno-fast-math") | |||
else () | |||
message(FATAL_ERROR "Compiler GCC.${GCC_VERSION} does not support Power10.") | |||
message(FATAL_ERROR "Compiler GCC ${CMAKE_C_COMPILER_VERSION} does not support Power10.") | |||
endif() | |||
endif() | |||
if (${TARGET} STREQUAL POWER9) | |||
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
if (${GCC_VERSION} VERSION_GREATER 5.0 OR ${GCC_VERSION} VERSION_EQUAL 5.0) | |||
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER 5.0 OR CMAKE_C_COMPILER_VERSION VERSION_EQUAL 5.0) | |||
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -mcpu=power9 -mtune=power9 -mvsx -fno-fast-math") | |||
else () | |||
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -mcpu=power8 -mtune=power8 -mvsx -fno-fast-math") | |||
message(WARNING "Compiler GCC.${GCC_VERSION} does not support fully Power9.") | |||
message(WARNING "Compiler GCC ${CMAKE_C_COMPILER_VERSION} does not support fully Power9.") | |||
endif() | |||
endif() | |||
if (${TARGET} STREQUAL POWER8) | |||
@@ -291,11 +285,10 @@ if (${TARGET} STREQUAL NEOVERSEV1) | |||
if (${CMAKE_C_COMPILER_ID} STREQUAL "PGI" AND NOT NO_SVE) | |||
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -Msve_intrinsics -march=armv8.4-a+sve -mtune=neoverse-v1") | |||
else () | |||
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
if (${GCC_VERSION} VERSION_GREATER 10.4 OR ${GCC_VERSION} VERSION_EQUAL 10.4) | |||
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER 10.4 OR CMAKE_C_COMPILER_VERSION VERSION_EQUAL 10.4) | |||
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=armv8.4-a+sve -mtune=neoverse-v1") | |||
else () | |||
message(FATAL_ERROR "Compiler ${CMAKE_C_COMPILER} ${GCC_VERSION} does not support Neoverse V1.") | |||
message(FATAL_ERROR "Compiler ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_VERSION} does not support Neoverse V1.") | |||
endif() | |||
endif() | |||
endif() | |||
@@ -303,11 +296,10 @@ if (${TARGET} STREQUAL NEOVERSEV1) | |||
if (${CMAKE_C_COMPILER_ID} STREQUAL "PGI" AND NOT NO_SVE) | |||
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -Msve-intrinsics -march=armv8.5-a+sve+sve2+bf16 -mtune=neoverse-n2") | |||
else () | |||
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | |||
if (${GCC_VERSION} VERSION_GREATER 10.4 OR ${GCC_VERSION} VERSION_EQUAL 10.4) | |||
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER 10.4 OR CMAKE_C_COMPILER_VERSION VERSION_EQUAL 10.4) | |||
set (KERNEL_DEFINITIONS "${KERNEL_DEFINITIONS} -march=armv8.5-a+sve+sve2+bf16 -mtune=neoverse-n2") | |||
else () | |||
message(FATAL_ERROR "Compiler $${CMAKE_C_COMPILER} {GCC_VERSION} does not support Neoverse N2.") | |||
message(FATAL_ERROR "Compiler $${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_VERSION} does not support Neoverse N2.") | |||
endif() | |||
endif() | |||
endif() | |||