-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
71 lines (52 loc) · 1.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
cmake_minimum_required(VERSION 3.25)
project(PetDB)
SET(CMAKE_CXX_STANDARD 20)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -g -pg")
include(FetchContent)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/f8d7d77.zip
)
set(COMMON
common/utils/generate.cpp
common/utils/threadpool.cpp
common/structures/skiplist.cpp
)
set(TABLE_SOURCES
table/table.cpp
table/block_based/data_block.cpp
table/block_based/index_block.cpp
table/block_based/metadata_block.cpp
table/block_based/block_builder.cpp
)
set(COMPACTION_SOURCES
compaction/sst_manager.cpp
)
set(MEMTABLE_SOURCES
memtable/memtable.cpp
compaction/sst_manager.cpp
)
set(READER_SOURCES
reader/sst_reader.cpp
reader/read_engine.cpp
)
set(TEST_SOURCES
tests/table/block_based/data_block_test.cpp
tests/common/skiplist_test.cpp
)
file(GLOB CPP_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} main/*.cpp)
foreach(CPP_FILE ${CPP_FILES})
get_filename_component(EXE_NAME ${CPP_FILE} NAME_WE)
add_executable(${EXE_NAME} ${CPP_FILE} ${COMMON} ${TABLE_SOURCES} ${READER_SOURCES} ${MEMTABLE_SOURCES} ${COMPACTION_SOURCES})
endforeach(CPP_FILE ${CPP_FILES})
add_executable(${PROJECT_NAME} main.cpp ${COMMON} ${MEMTABLE_SOURCES} ${TABLE_SOURCES} ${READER_SOURCES})
add_executable(reader reader/reader.cpp ${COMMON} ${TABLE_SOURCES} ${READER_SOURCES})
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
enable_testing()
add_executable(${PROJECT_NAME}_test tests/test_all.cpp ${COMMON} ${TEST_SOURCES} ${MEMTABLE_SOURCES} ${TABLE_SOURCES} ${READER_SOURCES})
target_link_libraries(${PROJECT_NAME}_test gtest_main)
add_test(NAME ${PROJECT_NAME}_test COMMAND ${PROJECT_NAME}_test)
target_link_libraries(${PROJECT_NAME}_test gtest_main)