-
Notifications
You must be signed in to change notification settings - Fork 172
/
CMakeLists.txt
458 lines (403 loc) · 17.4 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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
cmake_minimum_required(VERSION 2.8)
project(pktminerg)
option(PROJECT_WITH_PROF "Enable profiling and coverage report analysis" OFF)
message("\${PROJECT_WITH_PROF}: ${PROJECT_WITH_PROF}")
# cmake cxx flags
if (NOT WIN32)
if (${PROJECT_WITH_PROF})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -pthread -lrt -fprofile-arcs -ftest-coverage")
set(LINK_FLAGS "${LINK_FLAGS} -fprofile-arcs")
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -pthread -lrt")
endif ()
endif ()
# set PKTMINERG_MAJOR_VERSION, PKTMINERG_MINOR_VERSION, etc.
set(PKTMINERG_MAJOR_VERSION "0")
set(PKTMINERG_MINOR_VERSION "8")
set(PKTMINERG_PATCH_VERSION "4")
set(PKTMINERG_VERSION_STRING "${PKTMINERG_MAJOR_VERSION}.${PKTMINERG_MINOR_VERSION}.${PKTMINERG_PATCH_VERSION}")
if (WIN32)
Add_Definitions(-D_XKEYCHECK_H)
endif ()
# Get the current working branch
execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
# COMMAND git symbolic-ref --short HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message("branch: " ${GIT_BRANCH})
# Get the latest abbreviated commit hash of the working branch
execute_process(
COMMAND git log -1 --format=%h
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message("commit: " ${GIT_COMMIT_HASH})
# Get build time
string(TIMESTAMP BUILD_TIME "%Y-%m-%d %H:%M:%S")
add_definitions("-DGIT_COMMIT_HASH=${GIT_COMMIT_HASH}")
add_definitions("-DGIT_BRANCH=${GIT_BRANCH}")
add_definitions("-DBUILD_TIME=${BUILD_TIME}")
configure_file(
${PROJECT_SOURCE_DIR}/version.h.in
${PROJECT_BINARY_DIR}/version.h
)
if (APPLE)
find_library(LIBPCAP NAMES libpcap.dylib)
find_library(LIBSTDCPP NAMES libstdc++.6.dylib)
find_library(LIBGCCS NAMES libgcc_s.1.dylib)
add_definitions(-DMAC)
elseif (UNIX)
find_library(LIBSTDCPP NAMES libstdc++.so.6)
find_library(LIBGCCS NAMES libgcc_s.so.1)
endif ()
if (UNIX)
if (NOT LIBSTDCPP)
message(FATAL_ERROR "lib stdcpp not found")
endif ()
message("LIBSTDCPP: " ${LIBSTDCPP})
if (NOT LIBGCCS)
message(FATAL_ERROR "lib gccs not found")
endif ()
message("LIBGCCS: " ${LIBGCCS})
INCLUDE(FindBoost)
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost 1.41.0 REQUIRED COMPONENTS program_options system filesystem date_time)
find_package(cppzmq)
message("Boost_INCLUDE_DIRS: " ${Boost_INCLUDE_DIRS})
message("Boost_LIBRARY_DIRS: " ${Boost_LIBRARY_DIRS})
# include dir
include_directories(
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/src
${PROJECT_BINARY_DIR}
${Boost_INCLUDE_DIRS}
)
endif ()
set(ASSETS_ROOT "${PROJECT_SOURCE_DIR}/assets")
if (UNIX)
set(DEP_ROOT "${PROJECT_SOURCE_DIR}/dep/unix")
elseif (WIN32)
set(DEP_ROOT "${PROJECT_SOURCE_DIR}/dep/win")
endif ()
if (WIN32)
set(Boost_USE_STATIC_LIBS ON)
#find_package(Boost REQUIRED COMPONENTS program_options system filesystem)
include_directories(
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/src
${PROJECT_BINARY_DIR}
${DEP_ROOT}/include
)
link_directories(
${DEP_ROOT}/lib)
endif ()
if (UNIX AND NOT APPLE)
# link dir
link_directories(${Boost_LIBRARY_DIRS})
# read the real file which libstdc++.so links to
execute_process(COMMAND readlink -f ${LIBSTDCPP}
OUTPUT_VARIABLE STDCPP_REAL_FILE OUTPUT_STRIP_TRAILING_WHITESPACE)
message("STDCPP REAL FILE: " ${STDCPP_REAL_FILE})
# read the real file which libgcc_s.so links to
execute_process(COMMAND readlink -f ${LIBGCCS}
OUTPUT_VARIABLE GCCS_REAL_FILE OUTPUT_STRIP_TRAILING_WHITESPACE)
message("GCCS REAL FILE: " ${GCCS_REAL_FILE})
# read the real file which libboost_*.so links to
execute_process(COMMAND readlink -f ${Boost_FILESYSTEM_LIBRARY}
OUTPUT_VARIABLE BOOST_FILESYSTEM_REAL_FILE OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND readlink -f ${Boost_PROGRAM_OPTIONS_LIBRARY}
OUTPUT_VARIABLE BOOST_PROGRAM_OPTIONS_REAL_FILE OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND readlink -f ${Boost_SYSTEM_LIBRARY}
OUTPUT_VARIABLE BOOST_SYSTEM_REAL_FILE OUTPUT_STRIP_TRAILING_WHITESPACE)
# mkdir tmp dir to store third party lib
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/netis)
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/3rdlib)
file(COPY
${BOOST_FILESYSTEM_REAL_FILE}
${BOOST_PROGRAM_OPTIONS_REAL_FILE}
${BOOST_SYSTEM_REAL_FILE}
${PCAP_REAL_FILE}
${STDCPP_REAL_FILE}
${GCCS_REAL_FILE}
DESTINATION ${PROJECT_BINARY_DIR}/3rdlib
)
# make link file
execute_process(COMMAND basename ${LIBPCAP} OUTPUT_VARIABLE BN_PCAP_LINK OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND basename ${PCAP_REAL_FILE} OUTPUT_VARIABLE BN_PCAP_REAL OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ln -s ${BN_PCAP_REAL} ${BN_PCAP_LINK} WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/3rdlib)
execute_process(COMMAND basename ${LIBSTDCPP} OUTPUT_VARIABLE BN_STDCPP_LINK OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND basename ${STDCPP_REAL_FILE} OUTPUT_VARIABLE BN_STDCPP_REAL OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ln -s ${BN_STDCPP_REAL} ${BN_STDCPP_LINK} WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/3rdlib)
execute_process(COMMAND basename ${LIBGCCS} OUTPUT_VARIABLE BN_GCCS_LINK OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND basename ${GCCS_REAL_FILE} OUTPUT_VARIABLE BN_GCCS_REAL OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ln -s ${BN_GCCS_REAL} ${BN_GCCS_LINK} WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/3rdlib)
endif ()
# output dir
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
# source
if (WIN32)
set(SOURCE_FILES_SYSHELP
${PROJECT_SOURCE_DIR}/src/syshelp_win32.cpp
)
else ()
set(SOURCE_FILES_SYSHELP
${PROJECT_SOURCE_DIR}/src/syshelp.cpp
)
endif ()
set(SOURCE_FILES_GREDEMO
${PROJECT_SOURCE_DIR}/tools/gredemo.cpp
)
set(SOURCE_FILES_GREDUMP
${PROJECT_SOURCE_DIR}/tools/gredump.cpp
)
set(SOURCE_FILES_VXLANDUMP
${PROJECT_SOURCE_DIR}/tools/vxlandump.cpp
)
set(SOURCE_FILES_PCAPCOMPARE
${PROJECT_SOURCE_DIR}/tools/pcapcompare.cpp
)
if (WIN32)
set(SOURCE_FILES_PKTMINERG_BASE
${SOURCE_FILES_SYSHELP}
${PROJECT_SOURCE_DIR}/src/agent_control_plane.cpp
${PROJECT_SOURCE_DIR}/src/socketgre.cpp
${PROJECT_SOURCE_DIR}/src/socketzmq.cpp.
${PROJECT_SOURCE_DIR}/src/socketvxlan.cpp
${PROJECT_SOURCE_DIR}/src/agent_status.cpp
${PROJECT_SOURCE_DIR}/src/pcaphandler.cpp
${PROJECT_SOURCE_DIR}/src/statislog.cpp
${PROJECT_SOURCE_DIR}/src/logfilecontext.cpp
)
else ()
set(SOURCE_FILES_PKTMINERG_BASE
${SOURCE_FILES_SYSHELP}
${PROJECT_SOURCE_DIR}/src/socketgre.cpp
${PROJECT_SOURCE_DIR}/src/socketvxlan.cpp
${PROJECT_SOURCE_DIR}/src/socketzmq.cpp
${PROJECT_SOURCE_DIR}/src/pcaphandler.cpp
${PROJECT_SOURCE_DIR}/src/statislog.cpp
${PROJECT_SOURCE_DIR}/src/agent_status.cpp
${PROJECT_SOURCE_DIR}/src/agent_control_plane.cpp
${PROJECT_SOURCE_DIR}/src/logfilecontext.cpp
)
endif ()
set(SOURCE_FILES_PKTMINERG
${SOURCE_FILES_PKTMINERG_BASE}
${PROJECT_SOURCE_DIR}/src/pktminerg.cpp
)
set(SOURCE_FILES_DAEMON_BASE
${PROJECT_SOURCE_DIR}/src/daemonManager.cpp
${PROJECT_SOURCE_DIR}/src/timer_tasks.cpp
${PROJECT_SOURCE_DIR}/src/logfilecontext.cpp
${PROJECT_SOURCE_DIR}/src/restful/model/Daemon.cpp
${PROJECT_SOURCE_DIR}/src/restful/model/Agent.cpp
${PROJECT_SOURCE_DIR}/src/restful/model/Error.cpp
${PROJECT_SOURCE_DIR}/src/restful/model/ModelBase.cpp
${PROJECT_SOURCE_DIR}/src/restful/model/NetworkInterface.cpp
${PROJECT_SOURCE_DIR}/src/restful/model/PacketAgentData.cpp
${PROJECT_SOURCE_DIR}/src/restful/model/PacketChannelMetrics.cpp
${PROJECT_SOURCE_DIR}/src/restful/model/PacketAgentLogs.cpp
${PROJECT_SOURCE_DIR}/src/restful/model/Label.cpp
${PROJECT_SOURCE_DIR}/src/restful/model/Report.cpp
)
set(SOURCE_FILES_DAEMON
${SOURCE_FILES_DAEMON_BASE}
${PROJECT_SOURCE_DIR}/src/agentdaemon.cpp
)
# about install
set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}/netis)
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH "/opt/netis/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
if (UNIX)
set(PCAP_LIB pcap)
set(BOOST_LIB boost_program_options.a boost_system.a boost_filesystem.a boost_date_time.a)
set(ZMQ_LIB cppzmq-static)
else ()
set(PCAP_LIB wpcap Packet)
set(SOCKET_LIB ws2_32 Iphlpapi)
set(LOG4CPP_LIB log4cppLIB)
if (${CMAKE_BUILD_TYPE} MATCHES "[Dd][Ee][Bb][Uu][Gg]")
set(ZMQ_LIB libzmq-v${MSVC_TOOLSET_VERSION}-mt-sgd-4_3_4)
else ()
set(ZMQ_LIB libzmq-v${MSVC_TOOLSET_VERSION}-mt-s-4_3_4)
endif ()
endif ()
# bin -- gredemo
add_executable(gredemo ${SOURCE_FILES_GREDEMO})
if (WIN32)
set_target_properties(gredemo PROPERTIES LINK_FLAGS "/MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\"")
target_link_libraries(gredemo ${BOOST_LIB} ${SOCKET_LIB})
endif ()
if (UNIX)
target_link_libraries(gredemo ${BOOST_LIB} ${DEP_ROOT}/lib/libpcap.a ${SOCKET_LIB})
target_include_directories(gredemo PRIVATE
${DEP_ROOT}/include)
endif ()
# bin -- gredump
add_executable(gredump ${SOURCE_FILES_GREDUMP})
if (WIN32)
set_target_properties(gredump PROPERTIES LINK_FLAGS "/MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\"")
target_link_libraries(gredump ${BOOST_LIB} ${PCAP_LIB} ${SOCKET_LIB})
endif ()
if (UNIX)
target_link_libraries(gredump ${BOOST_LIB} ${DEP_ROOT}/lib/libpcap.a ${SOCKET_LIB})
target_include_directories(gredump PRIVATE
${DEP_ROOT}/include)
endif ()
# bin --udpvxlandump
add_executable(vxlandump ${SOURCE_FILES_VXLANDUMP})
if (WIN32)
set_target_properties(vxlandump PROPERTIES LINK_FLAGS "/MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\"")
target_link_libraries(vxlandump ${BOOST_LIB} ${PCAP_LIB} ${SOCKET_LIB})
endif ()
if (UNIX)
target_link_libraries(vxlandump ${BOOST_LIB} ${DEP_ROOT}/lib/libpcap.a ${SOCKET_LIB})
target_include_directories(vxlandump PRIVATE
${DEP_ROOT}/include)
endif ()
# bin -- pcapcompare
add_executable(pcapcompare ${SOURCE_FILES_PCAPCOMPARE})
if(WIN32)
target_link_libraries(pcapcompare ${BOOST_LIB} ${PCAP_LIB} ${SOCKET_LIB})
endif()
if(UNIX)
target_link_libraries(pcapcompare ${BOOST_LIB} ${DEP_ROOT}/lib/libpcap.a ${SOCKET_LIB})
target_include_directories(pcapcompare PRIVATE
${DEP_ROOT}/include)
endif()
# bin -- pktminerg
add_executable(pktminerg ${SOURCE_FILES_PKTMINERG})
if (WIN32)
target_compile_definitions(pktminerg PRIVATE -D_CRT_SECURE_NO_WARNINGS)
set_target_properties(pktminerg PROPERTIES LINK_FLAGS "/MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\"")
endif ()
if(UNIX)
target_link_libraries(pktminerg ${BOOST_LIB} ${DEP_ROOT}/lib/libpcap.a ${DEP_ROOT}/lib/liblog4cpp.a ${SOCKET_LIB} ${ZMQ_LIB})
target_include_directories(pktminerg PRIVATE
${DEP_ROOT}/include)
else ()
target_link_libraries(pktminerg ${BOOST_LIB} ${PCAP_LIB} ${LOG4CPP_LIB} ${SOCKET_LIB} ${ZMQ_LIB})
endif()
# bin -- probedaemon
include_directories(
${PROJECT_SOURCE_DIR}/src/restful/api
${PROJECT_SOURCE_DIR}/src/restful/model
)
if(UNIX)
add_executable(probedaemon ${SOURCE_FILES_DAEMON})
target_link_libraries(probedaemon
-lz
${BOOST_LIB}
${DEP_ROOT}/lib/libcurl.a
${DEP_ROOT}/lib/libglog.a
${DEP_ROOT}/lib/libssl.a
${DEP_ROOT}/lib/libcrypto.a
${DEP_ROOT}/lib/liblog4cpp.a
pthread
-ldl
${ZMQ_LIB})
target_include_directories(probedaemon PRIVATE
${DEP_ROOT}/include)
endif()
if (UNIX AND NOT APPLE)
# test
include_directories(${PROJECT_SOURCE_DIR}/test)
set(TEST_DIR ${PROJECT_SOURCE_DIR}/test)
# unit test
set(SOURCE_FILES_UNITTEST ${TEST_DIR}/unit_test.cpp
${TEST_DIR}/src/gtest.cc
${TEST_DIR}/src/gtest-death-test.cc
${TEST_DIR}/src/gtest-filepath.cc
${TEST_DIR}/src/gtest_main.cc
${TEST_DIR}/src/gtest-port.cc
${TEST_DIR}/src/gtest-printers.cc
${TEST_DIR}/src/gtest-test-part.cc
${TEST_DIR}/src/gtest-typed-test.cc)
add_executable(unittest ${SOURCE_FILES_UNITTEST} ${SOURCE_FILES_PKTMINERG_BASE} ${SOURCE_FILES_DAEMON_BASE})
target_include_directories(unittest PRIVATE
${DEP_ROOT}/include)
target_link_libraries(unittest
${BOOST_LIB}
pthread
${DEP_ROOT}/lib/libpcap.a
${ZMQ_LIB}
${DEP_ROOT}/lib/libcurl.a
${DEP_ROOT}/lib/libglog.a
${DEP_ROOT}/lib/libssl.a
${DEP_ROOT}/lib/libcrypto.a
${DEP_ROOT}/lib/liblog4cpp.a
-ldl)
set_target_properties(unittest PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/test/bin")
endif ()
# cpack
if (WIN32)
install(FILES
"${PROJECT_SOURCE_DIR}/README.md" "${PROJECT_SOURCE_DIR}/README-zh-Hans.md"
"${PROJECT_SOURCE_DIR}/USAGE.md" "${PROJECT_SOURCE_DIR}/BUILD.md"
"${PROJECT_SOURCE_DIR}/CHANGES.md" "${PROJECT_SOURCE_DIR}/INSTALL.md"
"${PROJECT_SOURCE_DIR}/LICENSE.md"
DESTINATION doc COMPONENT pktminerg)
install(FILES
"${DEP_ROOT}/pak/WinPcap_4_1_3.exe"
"${DEP_ROOT}/pak/winpcap-nmap-4.13.exe"
"${DEP_ROOT}/pak/npcap-1.71.exe"
"${DEP_ROOT}/pak/install.bat"
"${DEP_ROOT}/pak/VC_redist.${MSVC_TOOLSET_VERSION}.x64.exe"
DESTINATION pak COMPONENT pktminerg)
install(TARGETS pktminerg gredump pcapcompare gredemo DESTINATION bin COMPONENT pktminerg)
install(FILES "${ASSETS_ROOT}/pktminerg.windows.properties" DESTINATION bin RENAME pktminerg.properties COMPONENT pktminerg)
set(CPACK_PACKAGE_NAME "netis-cloud-probe")
set(CPACK_PACKAGE_VENDOR "netis")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Netis cloud probe tools")
set(CPACK_PACKAGE_VERSION ${PKTMINERG_VERSION_STRING})
set(CPACK_GENERATOR "ZIP")
set(CPACK_OUTPUT_FILE_PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.Windows.${CMAKE_SYSTEM_PROCESSOR})
else ()
install(FILES
DESTINATION lib COMPONENT pktminerg)
install(FILES "${PROJECT_SOURCE_DIR}/scripts/cloud-probe.service" DESTINATION /usr/lib/systemd/system COMPONENT pktminerg)
install(FILES "${PROJECT_SOURCE_DIR}/scripts/pktgd.sh" DESTINATION etc COMPONENT pktminerg)
install(FILES "${PROJECT_SOURCE_DIR}/scripts/limit_cpu_mem_pid.sh" DESTINATION bin COMPONENT pktminerg)
install(FILES "${PROJECT_SOURCE_DIR}/scripts/get_pid_with_container.sh" DESTINATION bin COMPONENT pktminerg)
install(FILES "${PROJECT_SOURCE_DIR}/scripts/get_if_with_name.sh" DESTINATION bin COMPONENT pktminerg)
install(FILES "${PROJECT_SOURCE_DIR}/scripts/get_mac_with_name.sh" DESTINATION bin COMPONENT pktminerg)
install(FILES "${PROJECT_SOURCE_DIR}/scripts/get_name_of_instance.sh" DESTINATION bin COMPONENT pktminerg)
install(FILES "${PROJECT_SOURCE_DIR}/scripts/probe-daemon.service" DESTINATION /usr/lib/systemd/system COMPONENT pktminerg)
install(FILES "${PROJECT_SOURCE_DIR}/scripts/probe-daemon.conf" DESTINATION etc COMPONENT pktminerg)
install(FILES "${PROJECT_SOURCE_DIR}/scripts/probe-daemon.sh" DESTINATION etc COMPONENT pktminerg)
install(TARGETS pktminerg gredump pcapcompare probedaemon DESTINATION bin COMPONENT pktminerg)
install(FILES
"${ASSETS_ROOT}/probedaemon.properties"
"${ASSETS_ROOT}/pktminerg.properties"
DESTINATION bin COMPONENT pktminerg)
set(CPACK_PACKAGE_CONTACT "netis")
set(CPACK_PACKAGE_NAME "netis-cloud-probe")
set(CPACK_PACKAGE_VENDOR "netis")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Netis cloud probe tools")
set(CPACK_PACKAGE_VERSION ${PKTMINERG_VERSION_STRING})
set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local")
set(CPACK_OUTPUT_FILE_PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/installer)
if (DEBIAN)
set(CPACK_GENERATOR "DEB")
set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}_amd64)
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${PROJECT_SOURCE_DIR}/scripts/postinst")
else ()
set(CPACK_GENERATOR "RPM")
set(CPACK_RPM_COMPONENT_INSTALL ON)
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.${CMAKE_SYSTEM_PROCESSOR})
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${PROJECT_SOURCE_DIR}/scripts/postinst_rpm.sh")
endif ()
#set(CPACK_COMPONENTS_ALL pktminerg)
endif ()
include(CPack)