-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathCMakeLists.txt
60 lines (50 loc) · 1.92 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
cmake_minimum_required(VERSION 3.12)
# set(CMAKE_CXX_COMPILER clang++)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
project(mallocvis LANGUAGES CXX)
add_compile_options($<$<CXX_COMPILER_ID:GNU,Clang>:-Wall$<SEMICOLON>-Wextra$<SEMICOLON>-Werror=return-type$<SEMICOLON>>)
add_link_options($<$<CXX_COMPILER_ID:GNU>:-rdynamic>)
# add_compile_options($<$<CXX_COMPILER_ID:Clang>:-stdlib=libc++>)
# add_link_options($<$<CXX_COMPILER_ID:Clang>:-stdlib=libc++>)
add_library(mallocvis SHARED malloc_hook.cpp plot_actions.cpp)
find_package(Threads)
if (Threads_FOUND)
target_link_libraries(mallocvis PRIVATE Threads::Threads)
target_compile_definitions(mallocvis PRIVATE -DHAS_THREADS)
endif()
add_executable(example example.cpp)
target_link_libraries(example PRIVATE mallocvis)
find_package(tsl-robin-map)
if (tsl-robin-map_FOUND)
target_link_libraries(example PRIVATE tsl::robin_map)
target_compile_definitions(example PRIVATE -DHAS_TSL)
endif()
find_package(absl)
if (absl_FOUND)
target_link_libraries(example PRIVATE absl::flat_hash_set absl::node_hash_set)
target_compile_definitions(example PRIVATE -DHAS_ABSL)
endif()
find_package(OpenVDB)
if (OpenVDB_FOUND)
add_executable(vdb_example vdb_example.cpp)
target_link_libraries(vdb_example PRIVATE mallocvis)
target_link_libraries(vdb_example PRIVATE OpenVDB::openvdb)
endif()
if (Threads_FOUND)
add_executable(mt_example mt_example.cpp)
target_link_libraries(mt_example PRIVATE mallocvis)
target_link_libraries(mt_example PRIVATE Threads::Threads)
endif()
find_package(OpenGL)
find_package(glfw3)
find_package(glm)
if (OpenGL_FOUND AND glfw3_FOUND AND glm_FOUND)
add_executable(visualizer visualize.cpp)
target_link_libraries(visualizer PRIVATE OpenGL::GL)
target_link_libraries(visualizer PRIVATE glfw)
target_link_libraries(visualizer PRIVATE glm)
endif()