Commit 5136295b authored by Daniel Black's avatar Daniel Black Committed by Sergey Vojtovich

OSX: get cache line size

parent 107de652
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment