-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
90 lines (75 loc) · 1.9 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
cmake_minimum_required(VERSION 3.1.0)
project(kddv VERSION 1.0.0 LANGUAGES CXX)
option(ENABLE_QT "Build with Qt GUI" ON)
option(ENABLE_NCURSES "Build with Ncurses TUI" ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(CMAKE_VERSION VERSION_LESS "3.7.0")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
endif()
find_package(PkgConfig)
pkg_search_module(JSONCPP jsoncpp)
pkg_search_module(LIBTINS libtins)
add_subdirectory(external/SOEM)
include_directories(
include
external/soem
external/soem/osal
external/soem/osal/linux
external/soem/oshw/linux
${JSONCPP_INCLUDE_DIRS}
${LIBTINS_INCLUDE_DIRS}
)
if (ENABLE_QT)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
find_package(Qt5 COMPONENTS Widgets REQUIRED)
add_executable(kddv-gui
src/gui_main.cpp
src/ethercat_data_source.cpp
src/ethercat_master.cpp
src/packet_sniffer.cpp
src/kelo_drive_slave.cpp
src/robile_battery_slave.cpp
src/kelo_bms_slave.cpp
src/zmq_publisher
src/gui.cpp
include/gui.h
)
target_link_libraries(kddv-gui
Qt5::Widgets
soem
zmq
${JSONCPP_LIBRARIES}
${LIBTINS_LIBRARIES}
)
endif(ENABLE_QT)
if (ENABLE_NCURSES)
add_executable(kddv-tui
src/tui_main.cpp
src/ethercat_data_source.cpp
src/ethercat_master.cpp
src/packet_sniffer.cpp
src/kelo_drive_slave.cpp
src/robile_battery_slave.cpp
src/kelo_bms_slave.cpp
src/zmq_publisher
src/tui.cpp
include/tui.h
)
target_link_libraries(kddv-tui
soem
zmq
ncurses
${JSONCPP_LIBRARIES}
${LIBTINS_LIBRARIES}
)
endif(ENABLE_NCURSES)
add_executable(generate_config_file
src/generate_config_file.cpp
)
target_link_libraries(generate_config_file
soem
${JSONCPP_LIBRARIES}
)