-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
109 lines (92 loc) · 3.6 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
cmake_minimum_required(VERSION 3.10)
project(mxtasking)
# Check SSE is available
INCLUDE(scripts/FindSSE.cmake)
FindSSE()
# Set compile flags
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
#set(CMAKE_CXX_CLANG_TIDY "clang-tidy;--extra-arg-before=-std=c++17 --system-headers=0")
set(CMAKE_CXX_FLAGS "-pedantic -Wall -Wextra -Werror \
-Wno-invalid-offsetof -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization \
-Wformat=2 -Winit-self -Wmissing-declarations -Wmissing-include-dirs -Woverloaded-virtual \
-Wredundant-decls -Wshadow -Wsign-promo -Wstrict-overflow=5 -Wswitch-default -Wundef \
-Wno-unused -Wold-style-cast -Wno-uninitialized")
# Set compile flag for x86_64
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -mtune=native")
endif()
# Set SSE flag if available
IF(SSE4_2_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2 -DUSE_SSE2")
ENDIF(SSE4_2_FOUND)
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -g -DNDEBUG -flto")
set(CMAKE_BUILD_TYPE RELEASE)
# Directories for output binaries and libraries
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
# External libraries
find_library(GTEST gtest)
# Include folders
include_directories(src/ lib/)
# Source files
SET(MX_TASKING_SRC
src/mx/resource/builder.cpp
src/mx/tasking/scheduler.cpp
src/mx/tasking/worker.cpp
src/mx/tasking/task.cpp
src/mx/tasking/profiling/profiling_task.cpp
src/mx/util/core_set.cpp
src/mx/util/random.cpp
src/mx/memory/dynamic_size_allocator.cpp
src/mx/memory/reclamation/epoch_manager.cpp
)
SET(MX_BENCHMARKING_SRC
src/benchmark/workload_set.cpp
src/benchmark/workload.cpp
src/benchmark/cores.cpp
src/benchmark/perf.cpp
src/benchmark/string_util.cpp
)
# Build libraries
add_library(mxtasking SHARED ${MX_TASKING_SRC})
add_library(mxbenchmarking SHARED ${MX_BENCHMARKING_SRC})
# Build executables
add_executable(blinktree_benchmark
src/application/blinktree_benchmark/main.cpp
src/application/blinktree_benchmark/benchmark.cpp
)
target_link_libraries(blinktree_benchmark pthread numa atomic mxtasking mxbenchmarking)
add_executable(hashjoin_benchmark
src/application/hashjoin_benchmark/main.cpp
src/application/hashjoin_benchmark/benchmark.cpp
src/application/hashjoin_benchmark/merge_task.cpp
src/application/hashjoin_benchmark/tpch_table_reader.cpp
src/application/hashjoin_benchmark/notifier.cpp
)
target_link_libraries(hashjoin_benchmark pthread numa atomic mxtasking mxbenchmarking)
add_executable(hello_world src/application/hello_world/main.cpp)
target_link_libraries(hello_world pthread numa atomic mxtasking mxbenchmarking)
# Add tests
if (GTEST)
set(TESTS
test/mx/memory/alignment_helper.test.cpp
test/mx/memory/dynamic_size_allocator.test.cpp
test/mx/memory/fixed_size_allocator.test.cpp
test/mx/memory/tagged_ptr.test.cpp
test/mx/util/aligned_t.test.cpp
test/mx/util/mpsc_queue.test.cpp
test/mx/util/queue.test.cpp
test/mx/util/core_set.test.cpp
test/mx/util/vector.test.cpp
)
add_executable(mxtests test/test.cpp ${TESTS})
target_link_libraries(mxtests pthread numa atomic mxtasking mxbenchmarking gtest)
else()
message("Library 'gtest' not found. Please install 'libgtest-dev' for unit tests.")
endif()
# Custom targets
add_custom_target(ycsb-a ${CMAKE_SOURCE_DIR}/scripts/generate_ycsb a randint)
add_custom_target(ycsb-c ${CMAKE_SOURCE_DIR}/scripts/generate_ycsb c randint)