1
+ cmake_minimum_required (VERSION 3.6)
2
+ project (cpisync)
3
+ set (CMAKE_CXX_STANDARD 11)
4
+
5
+ # if compiled with RECORD, GenSync server and client produce extensive log files
6
+ # that can be used to reproduce exact sync behavior afterwards
7
+ add_definitions (-DRECORD=".cpisync" )
8
+
9
+ include (CTest)
10
+ include (GNUInstallDirs)
11
+
12
+ # include Apache Data Sketches as a header-only library
13
+ include_directories (incubator-datasketches-cpp/common/include
14
+ incubator-datasketches-cpp/hll/include
15
+ incubator-datasketches-cpp/fi/include )
16
+
17
+ # some flags
18
+ set (CMAKE_CXX_FLAGS "-std=c++11 -DDEFAULT_LOGLEVEL=TEST" )
19
+
20
+ # Set project directory strucuture
21
+ set (SRC_DIR src)
22
+ set (AUX_DIR ${SRC_DIR} /Aux)
23
+ set (DATA_DIR ${SRC_DIR} /Data)
24
+ set (COMM_DIR ${SRC_DIR} /Communicants)
25
+ set (SYNC_DIR ${SRC_DIR} /Syncs)
26
+ set (BENCH_DIR ${SRC_DIR} /Benchmarks)
27
+ set (TOOLS_DIR ${SRC_DIR} /Tools)
28
+
29
+ set (INCLUDE include /CPISync)
30
+ set (AUX_DIR_INC ${INCLUDE} /Aux)
31
+ set (DATA_DIR_INC ${INCLUDE} /Data)
32
+ set (COMM_DIR_INC ${INCLUDE} /Communicants)
33
+ set (SYNC_DIR_INC ${INCLUDE} /Syncs)
34
+ set (SYNC_BENCH_INC ${INCLUDE} /Benchmarks)
35
+
36
+ # Test directory structure
37
+ set (TEST_DIR tests)
38
+ set (UNIT_TEST_DIR ${TEST_DIR} /unit)
39
+ set (SYSLONG_TEST_DIR ${TEST_DIR} /sys/long)
40
+ set (BENCHMARK_TEST_DIR ${TEST_DIR} /sys/benchmark)
41
+
42
+ # Set location of the test runner
43
+ set (TEST_RUNNER ${TEST_DIR} /testRunner.cpp)
44
+
45
+ # Set file config
46
+ set (SOURCE_FILES
47
+
48
+ ${AUX_DIR} /Logger.cpp
49
+ ${AUX_DIR} /UID.cpp
50
+ ${AUX_DIR} /SyncMethod.cpp
51
+ ${AUX_DIR} /Sketches.cpp
52
+
53
+ ${DATA_DIR} /DataObject.cpp
54
+
55
+ ${COMM_DIR} /CommSocket.cpp
56
+ ${COMM_DIR} /CommString.cpp
57
+ ${COMM_DIR} /Communicant.cpp
58
+ ${COMM_DIR} /CommDummy.cpp
59
+
60
+ ${SYNC_DIR} /CPISync.cpp
61
+ ${SYNC_DIR} /GenSync.cpp
62
+ ${SYNC_DIR} /InterCPISync.cpp
63
+ ${SYNC_DIR} /probCPISync.cpp
64
+ ${SYNC_DIR} /HashSync.cpp
65
+ ${SYNC_DIR} /IBLT.cpp
66
+ ${SYNC_DIR} /IBLTMultiset.cpp
67
+ ${SYNC_DIR} /IBLTSync.cpp
68
+ ${SYNC_DIR} /IBLTSync_Multiset.cpp
69
+ ${SYNC_DIR} /IBLTSetOfSets.cpp
70
+ ${SYNC_DIR} /Compact2DBitArray.cpp
71
+ ${SYNC_DIR} /Cuckoo.cpp
72
+ ${SYNC_DIR} /CuckooSync.cpp
73
+ ${SYNC_DIR} /FullSync.cpp
74
+
75
+ ${BENCH_DIR} /Runner.cpp
76
+ ${BENCH_DIR} /BenchParams.cpp
77
+ ${BENCH_DIR} /FromFileGen.cpp
78
+
79
+ ${TOOLS_DIR} /EncodeJoin.cpp
80
+
81
+ ${SRC_DIR} /main.cpp)
82
+
83
+ set (HEADERS
84
+
85
+ ${AUX_DIR_INC} /Auxiliary.h
86
+ ${AUX_DIR_INC} /ConstantsAndTypes.h
87
+ ${AUX_DIR_INC} /Exceptions.h
88
+ ${AUX_DIR_INC} /ForkHandle.h
89
+ ${AUX_DIR_INC} /Logger.h
90
+ ${AUX_DIR_INC} /SyncMethod.h
91
+ ${AUX_DIR_INC} /UID.h
92
+ ${AUX_DIR_INC} /Sketches.h
93
+
94
+ ${DATA_DIR_INC} /DataFileC.h
95
+ ${DATA_DIR_INC} /DataMemC.h
96
+ ${DATA_DIR_INC} /DataObjC.h
97
+ ${DATA_DIR_INC} /DataObject.h
98
+ ${DATA_DIR_INC} /DataPriorityObject.h
99
+
100
+ ${COMM_DIR_INC} /CommSocket.h
101
+ ${COMM_DIR_INC} /CommString.h
102
+ ${COMM_DIR_INC} /Communicant.h
103
+ ${COMM_DIR_INC} /CommDummy.h
104
+
105
+ ${SYNC_DIR_INC} /CPISync.h
106
+ ${SYNC_DIR_INC} /CPISync_ExistingConnection.h
107
+ ${SYNC_DIR_INC} /CPISync_HalfRound.h
108
+ ${SYNC_DIR_INC} /CPISync_HalfRound_Hashed.h
109
+ ${SYNC_DIR_INC} /CPISync_OneLessRound.h
110
+ ${SYNC_DIR_INC} /FullSync.h
111
+ ${SYNC_DIR_INC} /GenSync.h
112
+ ${SYNC_DIR_INC} /HashSync.h
113
+ ${SYNC_DIR_INC} /IBLT.h
114
+ ${SYNC_DIR_INC} /IBLTMultiset.h
115
+ ${SYNC_DIR_INC} /IBLTSync.h
116
+ ${SYNC_DIR_INC} /IBLTSetOfSets.h
117
+ ${SYNC_DIR_INC} /IBLTSync_HalfRound.h
118
+ ${SYNC_DIR_INC} /IBLTSync_Multiset.h
119
+ ${SYNC_DIR_INC} /Compact2DBitArray.h
120
+ ${SYNC_DIR_INC} /Cuckoo.h
121
+ ${SYNC_DIR_INC} /CuckooSync.h
122
+ ${SYNC_DIR_INC} /InterCPISync.h
123
+ ${SYNC_DIR_INC} /PrioCPISync.h
124
+ ${SYNC_DIR_INC} /ProbCPISync.h
125
+
126
+ ${SYNC_BENCH_INC} /BenchObserv.h
127
+ ${SYNC_BENCH_INC} /BenchParams.h
128
+ ${SYNC_BENCH_INC} /DataObjectGenerator.h
129
+ ${SYNC_BENCH_INC} /RandGen.h
130
+ ${SYNC_BENCH_INC} /FromFileGen.h)
131
+
132
+ include_directories (include )
133
+ include_directories (tests)
134
+
135
+ include_directories (/usr/local/include )
136
+ link_directories (/usr/local/lib)
137
+ link_directories (/usr/local/lib64)
138
+ include_directories (${CMAKE_INSTALL_INCLUDEDIR} )
139
+ link_directories (${CMAKE_INSTALL_LIBDIR} )
140
+
141
+ # Add libs and executables
142
+ add_library (cpisync STATIC ${SOURCE_FILES} ${HEADERS} )
143
+ target_include_directories (cpisync PRIVATE ${CMAKE_SOURCE_DIR} /include )
144
+ TARGET_LINK_LIBRARIES (cpisync ntl cppunit pthread gmp)
145
+
146
+ install (CODE "FILE(REMOVE_RECURSE ${CMAKE_INSTALL_INCLUDEDIR} /cpisync)" ) #Remove the existing CPISync library data and reinstall
147
+ install (CODE "FILE(REMOVE_RECURSE ${CMAKE_INSTALL_LIBDIR} /libcpisync.a)" ) #Remove the existing CPISync library data and reinstall
148
+ install (TARGETS cpisync LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} )
149
+ install (DIRECTORY DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} /CPISync) #create a new folder for CPISync inside of the system include directory
150
+ install (DIRECTORY ${AUX_DIR_INC} ${DATA_DIR_INC} ${COMM_DIR_INC} ${SYNC_DIR_INC} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} /CPISync COMPONENT devel) #copy the contents of the include folder into the system include directory
151
+
152
+ # Add the TryMe executable
153
+ add_executable (TryMe ${SRC_DIR} /TryMe.cpp)
154
+ target_link_libraries (TryMe cpisync ntl cppunit pthread gmp)
155
+
156
+ # Benchmarks
157
+ add_executable (Benchmarks ${BENCH_DIR} /Runner.cpp)
158
+ target_link_libraries (Benchmarks cpisync ntl cppunit pthread gmp)
159
+
160
+ # Tools
161
+ add_executable (EncodeJoin ${TOOLS_DIR} /EncodeJoin.cpp)
162
+ target_link_libraries (EncodeJoin cpisync ntl pthread gmp)
163
+
164
+ # Define a macro for adding executables testing multiple files
165
+ # @param dir The relative path to the folder containing test files to add
166
+ # @param name The executable name
167
+ macro (add_group_test dir name )
168
+ FILE (GLOB testPaths ${dir} /*Test .cpp ${dir} /*Tests.cpp)
169
+ ADD_EXECUTABLE (${name} ${TEST_RUNNER} ${testPaths} )
170
+
171
+ FOREACH (test ${testPaths} )
172
+ GET_FILENAME_COMPONENT (testName ${test} NAME_WE )
173
+ TARGET_LINK_LIBRARIES (${name} cpisync ntl cppunit pthread gmp)
174
+ ADD_TEST (${testName} ${name} )
175
+ ENDFOREACH (test )
176
+ endmacro ()
177
+
178
+ # Add test groups (note: executable will throw errors if there are no tests in the respective folder)
179
+ add_group_test(${UNIT_TEST_DIR} UnitTest)
180
+ #add_group_test(${SYSSHORT_TEST_DIR} SystemShortTests)
181
+ add_group_test(${SYSLONG_TEST_DIR} SystemLongTest)
182
+ #add_group_test(${SYSSHORT_TEST_DIR} SystemShortTests)
183
+ add_group_test(${BENCHMARK_TEST_DIR} Benchmark)
184
+
185
+ #Packaging
186
+ set (CPACK_GENERATOR "RPM;DEB" )
187
+ set (CPACK_PACKAGE_VERSION ${VERSION} )
188
+ set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "A library for remote file synchronization research" )
189
+ set (CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR} /README.md )
190
+ set (CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR} /LICENSE)
191
+ set (CPACK_PACKAGE_NAME "CPISync" )
192
+ set (CPACK_PACKAGE_VERSION_MAJOR "2" )
193
+ set (CPACK_PACKAGE_VERSION_MINOR "0" )
194
+ set (CPACK_PACKAGE_VERSION_PATCH "3" )
195
+ set (CPACK_PACKAGE_CONTACT "Ari Trachtenberg" )
196
+ set (CPAKC_PACKAGE_VENDOR "NISLAB" )
197
+ set (CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} )
198
+ set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME} -${CPACK_PACKAGE_VERSION_MAJOR} .${CPACK_PACKAGE_VERSION_MINOR} .${CPACK_PACKAGE_VERSION_PATCH} -${CPACK_PACKAGE_RELEASE} .${CMAKE_SYSTEM_PROCESSOR} " )
199
+ set (CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST /usr/local /usr/local/lib64 /usr/local/lib /usr/local/include )
200
+ include (CPack)
0 commit comments