-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
148 lines (130 loc) · 4.02 KB
/
CMakeLists.txt
File metadata and controls
148 lines (130 loc) · 4.02 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
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
cmake_minimum_required(VERSION 3.12)
project(FastDevFS LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(PkgConfig REQUIRED)
pkg_check_modules(FUSE3 REQUIRED fuse3)
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG v1.14.0
)
set(BUILD_GMOCK ON CACHE BOOL "" FORCE)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
FetchContent_Declare(
cli11
GIT_REPOSITORY https://github.com/CLIUtils/CLI11.git
GIT_TAG v2.4.2
)
FetchContent_MakeAvailable(cli11)
add_library(fastdevfs_adt STATIC
"src/daemon/directory tree/adt.cpp"
"src/daemon/directory tree/hash.cpp"
"src/daemon/fuse_lowlevel_ops.cpp"
)
target_include_directories(fastdevfs_adt PUBLIC
${CMAKE_SOURCE_DIR}/include
${FUSE3_INCLUDE_DIRS}
)
target_compile_options(fastdevfs_adt PRIVATE ${FUSE3_CFLAGS_OTHER} -Wno-narrowing)
add_library(fastdevfs_common STATIC
src/config.cpp
src/ipc.cpp
src/sha256.cpp
src/ui.cpp
src/dedup_server.cpp
src/dedup_index.cpp
src/library_manager.cpp
)
target_include_directories(fastdevfs_common PUBLIC
${CMAKE_SOURCE_DIR}/include
)
add_executable(fastdevfs
src/main.cpp
src/library_dedup.cpp
)
target_include_directories(fastdevfs PRIVATE
${FUSE3_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/include
)
target_link_libraries(fastdevfs PRIVATE
fastdevfs_adt
fastdevfs_common
library_predictor
${FUSE3_LIBRARIES}
)
target_compile_options(fastdevfs PRIVATE ${FUSE3_CFLAGS_OTHER} -Wno-narrowing)
add_executable(fastdevfs-cli
src/cli.cpp
)
target_include_directories(fastdevfs-cli PRIVATE
${CMAKE_SOURCE_DIR}/include
)
target_link_libraries(fastdevfs-cli PRIVATE
fastdevfs_common
CLI11::CLI11
)
add_library(library_predictor STATIC
src/library_predictor.cpp
)
target_include_directories(library_predictor PUBLIC
${CMAKE_SOURCE_DIR}/include
)
enable_testing()
add_executable(test_predictor test/test_predictor.cpp)
target_link_libraries(test_predictor PRIVATE
library_predictor
)
target_include_directories(test_predictor PRIVATE ${CMAKE_SOURCE_DIR}/include)
add_test(NAME PredictorTests COMMAND test_predictor ${CMAKE_SOURCE_DIR}/models/model_params.bin)
add_executable(test_adt test/test_adt.cpp)
target_link_libraries(test_adt PRIVATE
fastdevfs_adt
GTest::gtest
GTest::gtest_main
)
target_include_directories(test_adt PRIVATE ${CMAKE_SOURCE_DIR}/include)
add_test(NAME AdtTests COMMAND test_adt)
add_executable(test_hash test/test_hash.cpp)
target_link_libraries(test_hash PRIVATE
fastdevfs_adt
GTest::gtest
GTest::gtest_main
)
target_include_directories(test_hash PRIVATE ${CMAKE_SOURCE_DIR}/include)
add_test(NAME HashTests COMMAND test_hash)
add_executable(test_persistence test/test_persistence.cpp)
target_link_libraries(test_persistence PRIVATE
fastdevfs_adt
GTest::gtest
GTest::gtest_main
)
target_include_directories(test_persistence PRIVATE ${CMAKE_SOURCE_DIR}/include)
add_test(NAME PersistenceTests COMMAND test_persistence)
add_executable(test_node_share test/test_node_share.cpp)
target_link_libraries(test_node_share PRIVATE
fastdevfs_adt
GTest::gtest
GTest::gtest_main
)
target_include_directories(test_node_share PRIVATE ${CMAKE_SOURCE_DIR}/include)
add_test(NAME NodeShareTests COMMAND test_node_share)
# Test executable for library detection (two-tier: binary search + MLP)
add_executable(test_library_detection test/test_library_detection.cpp
src/library_dedup.cpp
src/sha256.cpp
src/dedup_index.cpp
)
target_link_libraries(test_library_detection PRIVATE
fastdevfs_adt
library_predictor
)
target_include_directories(test_library_detection PRIVATE
${CMAKE_SOURCE_DIR}/include
${FUSE3_INCLUDE_DIRS}
)
target_compile_options(test_library_detection PRIVATE ${FUSE3_CFLAGS_OTHER} -Wno-narrowing)
target_compile_definitions(test_library_detection PRIVATE SOURCE_DIR="${CMAKE_SOURCE_DIR}")
add_test(NAME LibraryDetectionTests COMMAND test_library_detection)