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 @@ ...@@ -15,15 +15,29 @@
# Symbols with information about the CPU. # Symbols with information about the CPU.
FIND_PROGRAM(GETCONF getconf) IF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
MARK_AS_ADVANCED(GETCONF) FIND_PROGRAM(SYSCTL sysctl)
MARK_AS_ADVANCED(SYSCTL)
IF(GETCONF) 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( EXECUTE_PROCESS(
COMMAND ${GETCONF} LEVEL1_DCACHE_LINESIZE COMMAND ${GETCONF} LEVEL1_DCACHE_LINESIZE
OUTPUT_VARIABLE CPU_LEVEL1_DCACHE_LINESIZE OUTPUT_VARIABLE CPU_LEVEL1_DCACHE_LINESIZE
) )
ENDIF()
ENDIF() ENDIF()
IF(CPU_LEVEL1_DCACHE_LINESIZE AND CPU_LEVEL1_DCACHE_LINESIZE GREATER 0) IF(CPU_LEVEL1_DCACHE_LINESIZE AND CPU_LEVEL1_DCACHE_LINESIZE GREATER 0)
ELSE() ELSE()
SET(CPU_LEVEL1_DCACHE_LINESIZE 64) 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