Browse Source

cmake: Add mips64 compile options

Xenofon Karamanos 2 weeks ago
parent
commit
2938e32cf5
1 changed files with 21 additions and 0 deletions
  1. 21 0
      cmake/compiler-specific.cmake

+ 21 - 0
cmake/compiler-specific.cmake

@@ -308,6 +308,27 @@ elseif(TARGET_ARCH STREQUAL "mips2")
         "Unsupported compiler (${CMAKE_C_COMPILER_ID}) for ${TARGET_ARCH}. Try GCC. Compile at your own risk!"
         "Unsupported compiler (${CMAKE_C_COMPILER_ID}) for ${TARGET_ARCH}. Try GCC. Compile at your own risk!"
     )
     )
   endif()
   endif()
+elseif(TARGET_ARCH STREQUAL "mips64")
+  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 -ftree-vectorize -fno-strict-overflow)
+    elseif(CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.0)
+      target_compile_options(common_compiler_flags INTERFACE -ftree-vectorize)
+    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()
 else()
   message(
   message(
     WARNING
     WARNING