summaryrefslogtreecommitdiff
path: root/cmake/cpu_info.cmake
diff options
context:
space:
mode:
authorDaniel Black <daniel.black@au1.ibm.com>2017-04-02 20:11:12 +1000
committerSergey Vojtovich <svoj@mariadb.org>2017-04-20 13:44:58 +0400
commit5136295b21aac41709672c17a5a596f996a27735 (patch)
treed99e31d424cc77387560454924f713833bde9fa9 /cmake/cpu_info.cmake
parent107de652b62f2750e8172fd6e894fa0eb80b0501 (diff)
downloadmariadb-git-5136295b21aac41709672c17a5a596f996a27735.tar.gz
OSX: get cache line size
Diffstat (limited to 'cmake/cpu_info.cmake')
-rw-r--r--cmake/cpu_info.cmake28
1 files changed, 21 insertions, 7 deletions
diff --git a/cmake/cpu_info.cmake b/cmake/cpu_info.cmake
index 32b98142ace..1772510e72b 100644
--- a/cmake/cpu_info.cmake
+++ b/cmake/cpu_info.cmake
@@ -15,15 +15,29 @@
# Symbols with information about the CPU.
-FIND_PROGRAM(GETCONF getconf)
-MARK_AS_ADVANCED(GETCONF)
+IF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
+ FIND_PROGRAM(SYSCTL sysctl)
+ MARK_AS_ADVANCED(SYSCTL)
-IF(GETCONF)
- EXECUTE_PROCESS(
- COMMAND ${GETCONF} LEVEL1_DCACHE_LINESIZE
- OUTPUT_VARIABLE CPU_LEVEL1_DCACHE_LINESIZE
- )
+ IF(SYSCTL)
+ EXECUTE_PROCESS(
+ COMMAND ${SYSCTL} -n hw.cachelinesize
+ OUTPUT_VARIABLE CPU_LEVEL1_DCACHE_LINESIZE
+ )
+ ENDIF()
+
+ELSE()
+ FIND_PROGRAM(GETCONF getconf)
+ MARK_AS_ADVANCED(GETCONF)
+
+ IF(GETCONF)
+ EXECUTE_PROCESS(
+ COMMAND ${GETCONF} LEVEL1_DCACHE_LINESIZE
+ OUTPUT_VARIABLE CPU_LEVEL1_DCACHE_LINESIZE
+ )
+ ENDIF()
ENDIF()
+
IF(CPU_LEVEL1_DCACHE_LINESIZE AND CPU_LEVEL1_DCACHE_LINESIZE GREATER 0)
ELSE()
SET(CPU_LEVEL1_DCACHE_LINESIZE 64)