wpleonardo commented on code in PR #1375:
URL: https://github.com/apache/orc/pull/1375#discussion_r1107117827
##########
CMakeLists.txt:
##########
@@ -157,6 +172,102 @@ elseif (MSVC)
set (WARN_FLAGS "${WARN_FLAGS} -wd4146") # unary minus operator applied to
unsigned type, result still unsigned
endif ()
+include(CheckCXXCompilerFlag)
+include(CheckCXXSourceCompiles)
+message(STATUS "System processor: ${CMAKE_SYSTEM_PROCESSOR}")
+
+if(NOT DEFINED ORC_CPU_FLAG)
+ if(CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64|X86|x86|i[3456]86|x64")
+ set(ORC_CPU_FLAG "x86")
+ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|ARM64|arm64")
+ set(ORC_CPU_FLAG "aarch64")
+ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm$|armv[4-7]")
+ set(ORC_CPU_FLAG "aarch32")
+ else()
+ message(FATAL_ERROR "Unknown system processor")
+ endif()
+endif()
+
+# Check architecture specific compiler flags
+if(ORC_CPU_FLAG STREQUAL "x86")
+ # x86/amd64 compiler flags, msvc/gcc/clang
+ if(MSVC)
+ set(ORC_AVX512_FLAG "/arch:AVX512")
+ set(CXX_SUPPORTS_SSE4_2 TRUE)
+ else()
+ # skylake-avx512 consists of AVX512F,AVX512BW,AVX512VL,AVX512CD,AVX512DQ
+ set(ORC_AVX512_FLAG "-march=native -mbmi2")
+ set(ORC_AVX512_FLAG
+ "${ORC_AVX512_FLAG} -mavx512f -mavx512cd -mavx512vl -mavx512dq
-mavx512bw -mavx512vbmi")
+ endif()
+ check_cxx_compiler_flag(${ORC_AVX512_FLAG} CXX_SUPPORTS_AVX512)
+ if(MINGW)
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65782
+ message(STATUS "Disable AVX512 support on MINGW for now")
+ else()
+ # Check for AVX512 support in the compiler.
+ set(OLD_CMAKE_REQURED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${ORC_AVX512_FLAG}")
Review Comment:
we can find the CMAKE_REQUIRED_FLAGS information in the cmake document:
https://cmake.org/cmake/help/latest/module/CheckCXXSourceCompiles.html
Is there no need to change CMAKE_REQUIRED_FLAGS ? Is my understanding right?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]