-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
124 lines (110 loc) · 3.74 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
cmake_minimum_required(VERSION 3.12)
project(homed_exporter)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
find_package(Boost 1.74 REQUIRED COMPONENTS system)
find_package(PahoMqttCpp REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(JSONCPP REQUIRED jsoncpp)
option(CMAKE_BUILD_TYPE "Build type" Release)
message("Configuring as " ${CMAKE_BUILD_TYPE})
if (CMAKE_BUILD_TYPE STREQUAL Debug)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
add_definitions(-DHE_DEBUG)
endif (CMAKE_BUILD_TYPE STREQUAL Debug)
set(PACKAGE_VERSION "0.8.5")
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/src/version.h.in"
"${CMAKE_CURRENT_SOURCE_DIR}/src/version.h"
@ONLY
)
set(HE_HEADERS
src/configuration/ccmdoptions.h
src/configuration/cconfiguration.h
src/defines/class_helpers.h
src/defines/metrics.h
src/http/chttp.h
src/http/types.h
src/log.h
src/main.h
src/model/chomed.h
src/model/device/cdevice.h
src/model/device/cdevices.h
src/model/device/types.h
src/model/metrics/cmetricbulk.h
src/model/metrics/cmetricname.h
src/model/metrics/cmetrics.h
src/model/metrics/cmetricvalue.h
src/model/metrics/types/cmetric.h
src/model/metrics/types/cmetricincremental.h
src/model/metrics/types/cmetricpartial.h
src/model/metrics/types/cmetricstatic.h
src/mqtt/cdevicename.h
src/mqtt/cmqttcallback.h
src/mqtt/cmqttclient.h
src/mqtt/cpayload.h
src/mqtt/ctopic.h
src/st.h
src/tools/singletone/csingletone.h
src/tools/singletone/singletone.h
src/utils/datetime.h
src/utils/string.h
)
set(HE_SOURCES
src/configuration/ccmdoptions.cpp
src/configuration/cconfiguration.cpp
src/http/chttp.cpp
src/main.cpp
src/model/chomed.cpp
src/model/device/cdevice.cpp
src/model/device/cdevices.cpp
src/model/device/types.cpp
src/model/metrics/cmetricbulk.cpp
src/model/metrics/cmetricname.cpp
src/model/metrics/cmetrics.cpp
src/model/metrics/cmetricvalue.cpp
src/model/metrics/types/cmetric.cpp
src/model/metrics/types/cmetricincremental.cpp
src/model/metrics/types/cmetricpartial.cpp
src/model/metrics/types/cmetricstatic.cpp
src/mqtt/cdevicename.cpp
src/mqtt/cmqttcallback.cpp
src/mqtt/cmqttclient.cpp
src/mqtt/cpayload.cpp
src/mqtt/ctopic.cpp
src/tools/singletone/csingletone.cpp
src/utils/datetime.cpp
src/utils/string.cpp
)
include_directories(src)
add_executable(homed_exporter
${HE_HEADERS}
${HE_SOURCES}
)
target_link_libraries(homed_exporter
PahoMqttCpp::paho-mqttpp3
jsoncpp
${Boost_LIBRARIES}
)
install(TARGETS homed_exporter
DESTINATION /usr/bin)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/deploy/homed_exporter.service
DESTINATION /usr/share/homed_exporter)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/homed-exporter.example.json
DESTINATION /usr/share/homed-exporter)
message("Arch is " ${CMAKE_SYSTEM_PROCESSOR})
set(CPACK_PACKAGE_NAME "homed_exporter")
set(CPACK_PACKAGE_VERSION "${PACKAGE_VERSION}")
set(CPACK_PACKAGE_CONTACT "Gorlov Maxim <[email protected]>")
set(CPACK_PACKAGE_DESCRIPTION "HOMEd Exporter is a tool to export HOMEd Zigbee data metrics.")
set(CPACK_PACKAGE_MAINTAINER "Gorlov Maxim <[email protected]>")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libpaho-mqttpp3-1, libboost-system1.74.0, libjsoncpp25")
set(CPACK_DEBIAN_PACKAGE_USER "homed")
set(CPACK_DEBIAN_PACKAGE_GROUP "homed")
set(CPACK_DEBIAN_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${CMAKE_SYSTEM_PROCESSOR}.deb")
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/deploy/debian/control.extra")
set(CPACK_DEBIAN_PACKAGE_POST_INSTALL "${CMAKE_CURRENT_SOURCE_DIR}/deploy/debian//post_install.sh")
include(CPack)