blob: cb4b9e87aae6393aa54d2e453cc71ff94b00c3a6 (
plain)
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
|
# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.0)
set(CMAKE_CXX_STANDARD 17)
add_compile_options(-Wno-psabi)
project(inverter-tools VERSION 1.2.0)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX /usr/local/bin)
endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
include(GNUInstallDirs)
# find hidapi
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
find_library(HIDAPI_LIBRARY hidapi-hidraw)
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
find_library(HIDAPI_LIBRARY hidapi)
endif()
find_path(HIDAPI_INCLUDE_DIR hidapi/hidapi.h)
# find libserialport
find_library(LIBSERIALPORT_LIBRARY serialport)
find_path(LIBSERIALPORT_INCLUDE_DIR libserialport.h)
add_executable(inverterctl
src/inverterctl.cc
src/p18/defines.cc
src/p18/client.cc
src/p18/functions.cc
src/p18/response.cc
src/util.cc
src/p18/commands.cc
src/common.cc
src/formatter/formatter.cc
src/voltronic/crc.cc
src/voltronic/usb_device.cc
src/voltronic/device.cc
src/voltronic/time.cc
src/voltronic/serial_device.cc
src/voltronic/pseudo_device.cc)
target_include_directories(inverterctl PRIVATE .)
target_link_libraries(inverterctl m ${HIDAPI_LIBRARY} ${LIBSERIALPORT_LIBRARY})
target_compile_definitions(inverterctl PUBLIC INVERTERCTL)
target_include_directories(inverterctl PRIVATE
${HIDAPI_INCLUDE_DIR}
${LIBSERIALPORT_INCLUDE_DIR}
third_party
third_party/json/single_include)
install(TARGETS inverterctl
RUNTIME DESTINATION bin)
add_executable(inverterd
src/inverterd.cc
src/common.cc
src/util.cc
src/server/server.cc
src/server/connection.cc
src/server/signal.cc
src/p18/commands.cc
src/p18/defines.cc
src/p18/client.cc
src/p18/functions.cc
src/p18/response.cc
src/formatter/formatter.cc
src/voltronic/crc.cc
src/voltronic/usb_device.cc
src/voltronic/device.cc
src/voltronic/time.cc
src/voltronic/serial_device.cc
src/voltronic/pseudo_device.cc)
target_include_directories(inverterd PRIVATE .)
target_compile_definitions(inverterd PUBLIC INVERTERD)
target_link_libraries(inverterd
m pthread
${HIDAPI_LIBRARY}
${LIBSERIALPORT_LIBRARY})
target_include_directories(inverterd PRIVATE
${HIDAPI_INCLUDE_DIR}
${LIBSERIALPORT_INCLUDE_DIR}
third_party
third_party/json/single_include)
install(TARGETS inverterd
RUNTIME DESTINATION bin)
add_executable(testserial src/testserial.cc)
target_include_directories(testserial PRIVATE .)
target_link_libraries(testserial ${LIBSERIALPORT_LIBRARY})
target_include_directories(testserial PRIVATE
${LIBSERIALPORT_INCLUDE_DIR}
third_party/hexdump)
# inverterd
#add_executable(inverterd
# src/inverterd.cc)
#target_link_libraries(inverterd ${HIDAPI_LIBRARY} ${LIBSERIALPORT_LIBRARY} m)
# TODO install
|