Module: kamailio
Branch: master
Commit: 26b8bd414ba4cef25c8d5bcfd5a5d97cecf759d2
URL: 
https://github.com/kamailio/kamailio/commit/26b8bd414ba4cef25c8d5bcfd5a5d97cecf759d2

Author: Xenofon Karamanos <x...@gilawa.com>
Committer: Xenofon Karamanos <x...@gilawa.com>
Date: 2025-07-24T13:11:45Z

cmake: Add ppc64 arch compile options

---

Modified: cmake/compiler-specific.cmake

---

Diff:  
https://github.com/kamailio/kamailio/commit/26b8bd414ba4cef25c8d5bcfd5a5d97cecf759d2.diff
Patch: 
https://github.com/kamailio/kamailio/commit/26b8bd414ba4cef25c8d5bcfd5a5d97cecf759d2.patch

---

diff --git a/cmake/compiler-specific.cmake b/cmake/compiler-specific.cmake
index 0e1fe0a04b3..e541dfb2f24 100644
--- a/cmake/compiler-specific.cmake
+++ b/cmake/compiler-specific.cmake
@@ -68,4 +68,36 @@ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
     # common INTERFACE -ftree-vectorize -fno-strict-overflow ) endif()
 
   endif()
+
+elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64$")
+  # PowerPC 64-bit specific flags
+  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 
-fsigned-char)
+
+    # Try to get CPUTYPE from the environment, fallback to "powerpc64" if not 
set
+    if(DEFINED ENV{CPUTYPE} AND NOT "$ENV{CPUTYPE}" STREQUAL "")
+      set(CPUTYPE "$ENV{CPUTYPE}")
+    else()
+      set(CPUTYPE "powerpc64")
+    endif()
+
+    if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.2)
+      target_compile_options(
+        common_compiler_flags INTERFACE -ftree-vectorize -fno-strict-overflow 
-mtune=${CPUTYPE}
+                                        -maltivec
+      )
+    elseif(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.0)
+      target_compile_options(
+        common_compiler_flags INTERFACE -ftree-vectorize -mtune=${CPUTYPE} 
-maltivec
+      )
+    elseif(CMAKE_C_COMPILER_VERSION VERSION_LESS 3.0)
+      message(
+        WARNING
+          "GCC version ${CMAKE_C_COMPILER_VERSION} is too old for ppc64. Try 
GCC 3.0 or newer."
+      )
+    endif()
+    # else()
+    #   message(FATAL_ERROR "Unsupported compiler (${CMAKE_C_COMPILER_ID}) for 
ppc64. Try GCC.")
+  endif()
 endif()

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to