瀏覽代碼

cmake: Add alpha compile options

Xenofon Karamanos 2 周之前
父節點
當前提交
d32ce5536d
共有 1 個文件被更改,包括 18 次插入1 次删除
  1. 18 1
      cmake/compiler-specific.cmake

+ 18 - 1
cmake/compiler-specific.cmake

@@ -328,7 +328,24 @@ elseif(TARGET_ARCH STREQUAL "mips64")
         "Unsupported compiler (${CMAKE_C_COMPILER_ID}) for ${TARGET_ARCH}. Try GCC. Compile at your own risk!"
     )
   endif()
-
+elseif(TARGET_ARCH STREQUAL "alpha")
+  if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+    target_compile_definitions(common_compiler_flags INTERFACE CC_GCC_LIKE_ASM)
+    target_compile_options(common_compiler_flags INTERFACE -funroll-loops)
+    if(CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.2)
+      target_compile_options(common_compiler_flags INTERFACE -fno-strict-overflow)
+    elseif(CMAKE_C_COMPILER_VERSION VERSION_LESS 3.0)
+      message(
+        WARNING
+          "You are using an old and unsupported gcc version ${CMAKE_C_COMPILER_VERSION}, compile at your own risk!"
+      )
+    endif()
+  else()
+    message(
+      WARNING
+        "Unsupported compiler (${CMAKE_C_COMPILER_ID}) for ${TARGET_ARCH}. Try GCC. Compile at your own risk!"
+    )
+  endif()
 else()
   message(
     WARNING