]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: check nasm and define related MACRO
authorChangcheng Liu <changcheng.liu@aliyun.com>
Thu, 22 Oct 2020 05:05:17 +0000 (13:05 +0800)
committerChangcheng Liu <changcheng.liu@aliyun.com>
Thu, 29 Oct 2020 04:34:57 +0000 (12:34 +0800)
Signed-off-by: Changcheng Liu <changcheng.liu@aliyun.com>
src/CMakeLists.txt
src/include/config-h.in.cmake

index 8b515575896673587843e5dc987601a889f58585..ff64052c95c134ceeb7c86b91ae4601bcb410adb 100644 (file)
@@ -145,6 +145,16 @@ if(HAVE_INTEL)
     set(object_format "elf64")
   endif()
   set(CMAKE_ASM_FLAGS "-f ${object_format}")
+  set(CMAKE_ASM_COMPILER ${PROJECT_SOURCE_DIR}/src/nasm-wrapper)
+  if(NOT WIN32)
+    # The native tools might be located even when cross compiling, which
+    # might not work in this case (especially when targeting Windows).
+    include(CheckNasm)
+    check_nasm_support(${object_format}
+      HAVE_NASM_X64
+      HAVE_NASM_X64_AVX2
+      HAVE_NASM_X64_AVX512)
+  endif()
   set(CMAKE_ASM_COMPILER ${PROJECT_SOURCE_DIR}/src/yasm-wrapper)
   if(NOT WIN32)
     # The native tools might be located even when cross compiling, which
index 65c1fba6a8689e2db877751b9abd9c435104843c..afc2449d80842eb15b2c8cb6b227fc581f9ae49a 100644 (file)
 /* yasm can also build the isa-l:avx512 */
 #cmakedefine HAVE_YASM_X64_AVX512
 
+/* we have a recent nasm and are x86_64 */
+#cmakedefine HAVE_NASM_X64
+
+/* nasm can also build the isa-l:avx2 */
+#cmakedefine HAVE_NASM_X64_AVX2
+
+/* nasm can also build the isa-l:avx512 */
+#cmakedefine HAVE_NASM_X64_AVX512
+
 /* Define if isa-l is compiled for arm64 */
 #cmakedefine HAVE_ARMV8_SIMD