forked from RaftLib/RaftLib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
126 lines (110 loc) · 3.24 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
cmake_minimum_required(VERSION 3.4 FATAL_ERROR)
project(RaftLib)
set( version 0.7a )
set( CMAKE_INCLUDE_CURRENT_DIR ON )
list( APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake )
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -mtune=native")
##
# check for Scotch, use if there
##
find_package( Scotch )
option( USESCOTCH "Use Scotch partitioning library" )
option( USEQTHREAD "Use QThread threading library" false )
find_package( QThreads )
##
# c std
##
include( CheckSTD )
set( HELPER_DIR ${CMAKE_SOURCE_DIR}/helpers )
##
# helper exec to get the L1 cache size from Linux/OS X/Win
##
execute_process( COMMAND ${CMAKE_CXX_COMPILER} ${HELPER_DIR}/cacheinfo.cpp -o ${HELPER_DIR}/cacheinfo)
execute_process( COMMAND ${HELPER_DIR}/cacheinfo
COMMAND tr -d '\n'
OUTPUT_VARIABLE L1D_LINE_SIZE )
execute_process( COMMAND rm -f ${HELPER_DIR}/cacheinfo )
if( NOT L1D_LINE_SIZE )
set( L1D_LINE_SIZE 64 )
message( INFO " Couldn't detect cache line size, set to: ${L1D_LINE_SIZE}" )
else( NOT L1D_LINE_SIZE )
message( INFO " Detected cache line size, set to: ${L1D_LINE_SIZE}" )
endif( NOT L1D_LINE_SIZE )
##
# for cache line size
##
add_definitions( "-DL1D_CACHE_LINE_SIZE=${L1D_LINE_SIZE}" )
##
# for tcmalloc
##
#add_definitions( "-fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free" )
include_directories ( ${CMAKE_SOURCE_DIR}/raftinc )
include_directories ( ${CMAKE_SOURCE_DIR} )
include( CheckGitDep )
add_subdirectory( src )
add_subdirectory( raftinc )
add_subdirectory( examples )
add_subdirectory( benchmarks )
mark_as_advanced( BUILD_WOPENCV false )
if( BUILD_WOPENCV )
add_subdirectory( examples/opencv )
endif( BUILD_WOPENCV )
##
# we need boost to demangle names, might use
# for random numbers too
##
include( CheckBoostDep )
##
# Set up unit tests
##
add_subdirectory( testsuite )
enable_testing()
set( TESTAPPS allocate portTypeException dynallocate stdlibsupport split
join lambdatest allocate_s foreach peekrange
partitionTest parallel peek
bracketsTest uniform splitchain
staticLongSplitChain staticSplitJoin
staticSplitChainJoin staticJoin staticContJoin
fitInCacheLine
isExtClass
doesntFitInCacheLine
isInlineClass
isExtArray
fixedAllocate
isExtAlloc
isInlineNonClass
allocateSendPush
allocateSendRandomPush
allocatePopPush
allocatePopInternal
allocatePopInternalObject
allocatePopExternal
prefetchEffective
parallelchain
ksettest
fixedMatchTest
splitchainRetStruct
staticContJoinRetStruct
staticJoinRetStruct
staticLongSplitChainRetStruct
staticSplitChainJoinRetStruct
staticSplitJoinRetStruct
chainMultiplePorts )
if( BUILDRANDOM )
list( APPEND TESTAPPS gamma uniform gaussian exponential sequential )
endif( BUILDRANDOM )
foreach( TEST ${TESTAPPS} )
add_test( NAME "${TEST}_test" COMMAND ${TEST} )
endforeach( TEST ${TESTAPPS} )
##
# install main headers in ${prefix}/include dir
##
set( MAINHEADERS
raft
raftio
raftmath
raftrandom
raftstat )
foreach( HFILE ${MAINHEADERS} )
install( FILES ${CMAKE_SOURCE_DIR}/${HFILE} DESTINATION ${CMAKE_INSTALL_PREFIX}/include )
endforeach( HFILE ${MAINHEADERS} )