-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
203 lines (181 loc) · 7.57 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
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
cmake_minimum_required(VERSION 3.14)
cmake_policy(SET CMP0074 NEW)
project(blimp)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/permissive->)
if(MSVC)
option(MULTIPROCESS_BUILD "Enables the /MP compile flag for Visual C++." ON)
if(MULTIPROCESS_BUILD)
set(MULTIPROCESS_LIMIT_BUILD_PROCESSES 0 CACHE STRING
"If set to a positive number, this will be used as an argument to /MP.")
if(NOT MULTIPROCESS_LIMIT_BUILD_PROCESSES)
add_compile_options(/MP)
else()
add_compile_options(/MP${MULTIPROCESS_LIMIT_BUILD_PROCESSES})
endif()
endif()
endif()
option(BLIMP_BUILD_TESTS "Determines whether to build tests for blimp" ON)
option(BLIMP_BUILD_PLUGINS "Determines whether to build blimp plugins" ON)
if(BLIMP_BUILD_TESTS)
enable_testing()
endif()
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
find_package(BlimpBuildBox QUIET)
add_subdirectory(external)
find_package(Qt5BaseDir)
if(QT5_BASE_DIR)
list(APPEND CMAKE_PREFIX_PATH ${QT5_BASE_DIR})
endif()
find_package(Qt5Widgets REQUIRED)
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost REQUIRED filesystem system)
find_package(Threads REQUIRED)
find_package(ZLIB)
if(ZLIB_FOUND)
add_executable(zlib_demo ${PROJECT_SOURCE_DIR}/src/deflate/zlib_demo.cpp)
target_link_libraries(zlib_demo PUBLIC ZLIB::ZLIB)
if(WIN32)
find_file(ZLIB_DLL NAMES zlib.dll HINTS ${BLIMP_BUILDBOX_DIRECTORY} PATH_SUFFIXES bin)
find_file(ZLIBD_DLL NAMES zlibd.dll HINTS ${BLIMP_BUILDBOX_DIRECTORY} PATH_SUFFIXES bin)
mark_as_advanced(ZLIB_DLL ZLIBD_DLL)
file(COPY ${ZLIB_DLL} ${ZLIBD_DLL} DESTINATION ${PROJECT_BINARY_DIR})
endif()
endif()
if(WIN32)
add_executable(fileio_demo ${PROJECT_SOURCE_DIR}/src/fileio/fileio_demo.cpp)
endif()
add_library(blimp_plugin_sdk INTERFACE)
target_include_directories(blimp_plugin_sdk INTERFACE ${PROJECT_SOURCE_DIR}/sdk)
target_sources(blimp_plugin_sdk INTERFACE ${PROJECT_SOURCE_DIR}/sdk/blimp_plugin_sdk.h)
add_library(blimp_plugin_helper_cpp INTERFACE)
target_link_libraries(blimp_plugin_helper_cpp INTERFACE blimp_plugin_sdk)
target_sources(blimp_plugin_helper_cpp INTERFACE ${PROJECT_SOURCE_DIR}/sdk/blimp_plugin_helper_cpp.hpp)
if(BLIMP_BUILD_PLUGINS)
add_subdirectory(plugins)
endif()
set(BLIMP_SOURCE_DIRECTORY ${PROJECT_SOURCE_DIR}/src)
set(BLIMP_INCLUDE_DIRECTORY ${PROJECT_SOURCE_DIR}/src)
set(BLIMP_SOURCE_FILES
${BLIMP_SOURCE_DIRECTORY}/main.cpp
${BLIMP_SOURCE_DIRECTORY}/file_bundling.cpp
${BLIMP_SOURCE_DIRECTORY}/file_hash.cpp
${BLIMP_SOURCE_DIRECTORY}/file_io.cpp
${BLIMP_SOURCE_DIRECTORY}/plugin_common.cpp
${BLIMP_SOURCE_DIRECTORY}/plugin_compression.cpp
${BLIMP_SOURCE_DIRECTORY}/plugin_encryption.cpp
${BLIMP_SOURCE_DIRECTORY}/plugin_key_value_store.cpp
${BLIMP_SOURCE_DIRECTORY}/plugin_storage.cpp
${BLIMP_SOURCE_DIRECTORY}/processing_pipeline.cpp
${BLIMP_SOURCE_DIRECTORY}/worker_pool.cpp
${BLIMP_SOURCE_DIRECTORY}/db/blimpdb.cpp
)
set(BLIMP_HEADER_FILES
${BLIMP_SOURCE_DIRECTORY}/exceptions.hpp
${BLIMP_SOURCE_DIRECTORY}/file_bundling.hpp
${BLIMP_SOURCE_DIRECTORY}/file_chunk.hpp
${BLIMP_SOURCE_DIRECTORY}/file_hash.hpp
${BLIMP_SOURCE_DIRECTORY}/file_info.hpp
${BLIMP_SOURCE_DIRECTORY}/file_io.hpp
${BLIMP_SOURCE_DIRECTORY}/plugin_common.hpp
${BLIMP_SOURCE_DIRECTORY}/plugin_compression.hpp
${BLIMP_SOURCE_DIRECTORY}/plugin_encryption.hpp
${BLIMP_SOURCE_DIRECTORY}/plugin_key_value_store.hpp
${BLIMP_SOURCE_DIRECTORY}/plugin_storage.hpp
${BLIMP_SOURCE_DIRECTORY}/processing_pipeline.hpp
${BLIMP_SOURCE_DIRECTORY}/storage_container.hpp
${BLIMP_SOURCE_DIRECTORY}/storage_location.hpp
${BLIMP_SOURCE_DIRECTORY}/uuid.hpp
${BLIMP_SOURCE_DIRECTORY}/version.hpp
${BLIMP_SOURCE_DIRECTORY}/worker_pool.hpp
${BLIMP_SOURCE_DIRECTORY}/db/blimpdb.hpp
${BLIMP_SOURCE_DIRECTORY}/db/file_element_id.hpp
)
set(BLIMP_TABLE_HEADER_FILES
${BLIMP_SOURCE_DIRECTORY}/db/table/table_layout.hpp
${BLIMP_SOURCE_DIRECTORY}/db/table/blimp_properties.hpp
${BLIMP_SOURCE_DIRECTORY}/db/table/file_contents.hpp
${BLIMP_SOURCE_DIRECTORY}/db/table/file_elements.hpp
${BLIMP_SOURCE_DIRECTORY}/db/table/indexed_locations.hpp
${BLIMP_SOURCE_DIRECTORY}/db/table/plugin_kv_store.hpp
${BLIMP_SOURCE_DIRECTORY}/db/table/snapshots.hpp
${BLIMP_SOURCE_DIRECTORY}/db/table/snapshot_contents.hpp
${BLIMP_SOURCE_DIRECTORY}/db/table/sqlite_master.hpp
${BLIMP_SOURCE_DIRECTORY}/db/table/storage_containers.hpp
${BLIMP_SOURCE_DIRECTORY}/db/table/storage_inventory.hpp
${BLIMP_SOURCE_DIRECTORY}/db/table/user_selection.hpp
)
source_group("Table Headers" FILES ${BLIMP_TABLE_HEADER_FILES})
set(BLIMP_QT_SOURCE_FILES
${BLIMP_SOURCE_DIRECTORY}/ui/file_diff_model.cpp
${BLIMP_SOURCE_DIRECTORY}/ui/filesystem_model.cpp
${BLIMP_SOURCE_DIRECTORY}/ui/main_window.cpp
${BLIMP_SOURCE_DIRECTORY}/ui/snapshot_browser.cpp
${BLIMP_SOURCE_DIRECTORY}/ui/snapshot_contents_model.cpp
${BLIMP_SOURCE_DIRECTORY}/file_scanner.cpp
${BLIMP_SOURCE_DIRECTORY}/file_processor.cpp
)
set(BLIMP_QT_HEADER_FILES
${BLIMP_SOURCE_DIRECTORY}/ui/filesize_to_string.hpp
)
set(BLIMP_QT_MOC_HEADER_FILES
${BLIMP_INCLUDE_DIRECTORY}/ui/file_diff_model.hpp
${BLIMP_INCLUDE_DIRECTORY}/ui/filesystem_model.hpp
${BLIMP_INCLUDE_DIRECTORY}/ui/main_window.hpp
${BLIMP_INCLUDE_DIRECTORY}/ui/snapshot_browser.hpp
${BLIMP_INCLUDE_DIRECTORY}/ui/snapshot_contents_model.hpp
${BLIMP_INCLUDE_DIRECTORY}/file_scanner.hpp
${BLIMP_INCLUDE_DIRECTORY}/file_processor.hpp
)
qt5_wrap_cpp(BLIMP_QT_MOC_SOURCE_FILES ${BLIMP_QT_MOC_HEADER_FILES})
source_group(moc FILES
${BLIMP_QT_MOC_SOURCE_FILES}
)
add_executable(blimp
${BLIMP_SOURCE_FILES}
${BLIMP_HEADER_FILES}
${BLIMP_TABLE_HEADER_FILES}
${BLIMP_QT_SOURCE_FILES}
${BLIMP_QT_HEADER_FILES}
${BLIMP_QT_MOC_HEADER_FILES}
${BLIMP_QT_MOC_SOURCE_FILES}
)
target_include_directories(blimp PUBLIC ${BLIMP_INCLUDE_DIRECTORY})
target_include_directories(blimp PUBLIC ${PROJECT_SOURCE_DIR}/sdk)
target_link_libraries(blimp PUBLIC
aws-cpp-sdk-core
aws-cpp-sdk-glacier
Boost::disable_autolinking
Boost::filesystem
Boost::system
cryptopp-static
gbBase
sqlpp11-connector-sqlite3
sqlite3
Qt5::Widgets
Threads::Threads
${CMAKE_DL_LIBS}
)
target_include_directories(blimp PUBLIC external/date)
target_include_directories(blimp PUBLIC external/sqlpp11/include)
target_include_directories(blimp PUBLIC external/sqlpp11-connector-sqlite3/include)
target_compile_definitions(blimp PUBLIC $<$<STREQUAL:$<CXX_COMPILER_ID>,MSVC>:_CRT_SECURE_NO_WARNINGS>)
target_compile_definitions(blimp PUBLIC BLIMP_BUILD_CONFIGURATION=$<CONFIG>)
target_compile_options(blimp PUBLIC $<$<AND:$<STREQUAL:$<CXX_COMPILER_ID>,MSVC>,$<NOT:$<CONFIG:Debug>>>:/Zo>)
target_compile_definitions(blimp PUBLIC BLIMP_BUILD_CONFIGURATION=$<CONFIG>)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT blimp)
add_executable(aws_tester src/aws_prototype.cpp)
target_link_libraries(aws_tester PUBLIC aws-cpp-sdk-core aws-cpp-sdk-glacier cryptopp-static)
if(WIN32)
getQt5Dlls(Qt5::Widgets qt_DLLS)
file(COPY ${qt_DLLS} ${QT5_ADDITIONAL_DLLS} DESTINATION ${PROJECT_BINARY_DIR})
endif()
if(BLIMP_BUILD_TESTS)
add_executable(test_blimp_ui
${PROJECT_SOURCE_DIR}/test/ui/filesize_to_string.t.cpp
)
target_include_directories(test_blimp_ui PUBLIC ${BLIMP_INCLUDE_DIRECTORY})
target_link_libraries(test_blimp_ui PUBLIC Catch2 Qt5::Widgets)
add_test(NAME BlimpUI COMMAND test_blimp_ui)
endif()