-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
58 lines (46 loc) · 1.55 KB
/
CMakeLists.txt
File metadata and controls
58 lines (46 loc) · 1.55 KB
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
cmake_minimum_required(VERSION 3.12)
project(cache_patterns VERSION 1.0.0 LANGUAGES CXX)
# Set C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Use RelWithDebInfo for debug symbols (important for CodSpeed profiling)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo)
endif()
# Include FetchContent for downloading dependencies
include(FetchContent)
# Enable downloading dependencies for benchmark
set(BENCHMARK_DOWNLOAD_DEPENDENCIES ON)
# Disable specific warnings for CodSpeed/Google Benchmark
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
add_compile_options(-Wno-sign-conversion -Wno-error)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
add_compile_options(-Wno-sign-conversion -Wno-error)
endif()
# Fetch CodSpeed's Google Benchmark compatibility layer
FetchContent_Declare(
google_benchmark
GIT_REPOSITORY https://github.com/CodSpeedHQ/codspeed-cpp
GIT_TAG main
SOURCE_SUBDIR google_benchmark
)
FetchContent_MakeAvailable(google_benchmark)
# Create library for particle simulation code
add_library(cache_patterns_lib
src/aos.cpp
src/soa.cpp
)
target_include_directories(cache_patterns_lib PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
)
# Create benchmark executable
add_executable(particle_simulation_bench
benchmarks/particle_simulation.cpp
)
target_link_libraries(particle_simulation_bench
cache_patterns_lib
benchmark::benchmark
)
target_include_directories(particle_simulation_bench PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include
)