-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
89 lines (71 loc) · 2.91 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
cmake_minimum_required(VERSION 3.28)
project(measure_everything LANGUAGES C CXX)
include(FetchContent)
set(BENCHMARK_DOWNLOAD_DEPENDENCIES on)
FetchContent_Declare(
benchmark
GIT_REPOSITORY https://github.com/google/benchmark.git
GIT_TAG 654d8d6cf368233018c3df2f84f1118603839ac5
)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
#set(MI_TRACK_ASAN ON
# set(MI_USE_CXX ON)
# set(MI_TRACK_VALGRIND ON)
# set(MI_DEBUG_FULL ON)
endif()
set(MI_OVERRIDE OFF)
FetchContent_Declare(
mimalloc
#GIT_REPOSITORY https://github.com/microsoft/mimalloc.git
GIT_REPOSITORY https://github.com/rHermes/mimalloc.git
#GIT_TAG dev
GIT_TAG fix-passing-heap-v2
)
FetchContent_MakeAvailable(benchmark mimalloc)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_EXTENSIONS OFF)
# I really don't know how to do this and I'm giving up. I hate cmake :(
#add_library(pcg INTERFACE)
#target_sources(pcg FILE_SET HEADERS TYPE HEADERS FILES third_party/pcg_extras.hpp third_party/pcg_uint128.hpp third_party/pcg_random.hpp)
add_executable(measure_everything main.cpp
vector2d.h
sparse-table.h
vector_benches.cpp
range_sum_benchmarks.cpp
range_min_benchmarks.cpp
third_party/pcg_extras.hpp third_party/pcg_uint128.hpp third_party/pcg_random.hpp
)
target_link_libraries(measure_everything benchmark::benchmark_main)
add_executable(mimalloc-stuff
third_party/pcg_extras.hpp third_party/pcg_uint128.hpp third_party/pcg_random.hpp
mimalloc-stuff/main.cpp
)
target_link_libraries(mimalloc-stuff mimalloc benchmark::benchmark_main)
add_executable(mthreads
third_party/pcg_extras.hpp third_party/pcg_uint128.hpp third_party/pcg_random.hpp
mthreads/main.cpp
mthreads/MutexSPSC.h
mthreads/AtomicSPSC.h
third_party/SPSCQueue.h
)
target_link_libraries(mthreads mimalloc)
if(MSVC)
target_compile_options(mthreads PRIVATE /W4 /WX)
target_compile_options(mimalloc-stuff PRIVATE /W4 /WX)
target_compile_options(measure_everything PRIVATE /W4 /WX)
else()
target_compile_options(mthreads PRIVATE -Wall -Wextra -Wpedantic -Werror -Wconversion -Wno-interference-size)
target_compile_options(mimalloc-stuff PRIVATE -Wall -Wextra -Wpedantic -Werror -Wconversion -Wno-interference-size)
target_compile_options(measure_everything PRIVATE -Wall -Wextra -Wpedantic -Werror -Wconversion -Wno-interference-size)
target_compile_options(mthreads PRIVATE -march=native)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
# target_compile_options(mthreads PRIVATE -fsanitize=address)
#target_link_options(mthreads PRIVATE -fsanitize=address)
target_compile_options(mthreads PRIVATE -fsanitize=thread)
target_link_options(mthreads PRIVATE -fsanitize=thread)
#set(MI_TRACK_ASAN ON
# set(MI_USE_CXX ON)
# set(MI_TRACK_VALGRIND ON)
# set(MI_DEBUG_FULL ON)
endif()
endif()