-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
74 lines (60 loc) · 2.6 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
cmake_minimum_required(VERSION 3.5)
project(open-esc-qt LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt5 COMPONENTS Widgets REQUIRED)
find_package(Qt5 COMPONENTS SerialPort REQUIRED)
find_package(Qt5 COMPONENTS PrintSupport REQUIRED)
set(PINGCPP_SRC ${PROJECT_SOURCE_DIR}/lib/ping-cpp/src)
set(PINGPROTOCOL_SRC ${PROJECT_SOURCE_DIR}/lib/ping-cpp/lib/ping-protocol/src)
include_directories(${PROJECT_SOURCE_DIR}/lib/ping-cpp/src/message)
add_executable(open-esc-qt
com-handle.cpp
com-handle.h
com-parser.cpp
com-parser.h
device.cpp
device.h
main.cpp
mainwindow.cpp
mainwindow.h
mainwindow.ui
port-scanner.cpp
port-scanner.h
qcustomplot.h
qcustomplot.cpp
register-model.cpp
register-model.h
${PINGCPP_SRC}/message/ping-message-openesc.h
)
target_link_libraries(open-esc-qt PRIVATE Qt5::Widgets Qt5::SerialPort Qt5::PrintSupport)
# target_link_libraries(open-esc-qt PRIVATE Qt5::Widgets Qt5::SerialPort Qt5::PrintSupport GL)
# add_definitions(-DQCUSTOMPLOT_USE_OPENGL)
set(PINGCPP_SRC ${PROJECT_SOURCE_DIR}/lib/ping-cpp/src)
add_custom_target(generate
# generate ping-cpp message files
${PINGCPP_SRC}/generate/generate-message.py --output-dir ${PINGCPP_SRC}/message
COMMENT "generating ping-cpp messages"
)
add_dependencies(open-esc-qt generate)
# add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/build/open-esc-qt_autogen/include/ui_mainwindow.h
# COMMAND sed -i 's%../../qcustomplot.h%../../../qcustomplot.h%' ${PROJECT_SOURCE_DIR}/build/open-esc-qt_autogen/include/ui_mainwindow.h
# COMMENT "hacking qcustomplot include path in qt autogenerated mainwindow ui header"
# )
add_custom_target(fix-ui
COMMAND sed -i 's%../../qcustomplot.h%../../../qcustomplot.h%' ${PROJECT_SOURCE_DIR}/build/open-esc-qt_autogen/include/ui_mainwindow.h
COMMENT "hacking qcustomplot include path in qt autogenerated mainwindow ui header"
)
# add_custom_target(fix-ui
# COMMAND sed -i 's%../../qcustomplot.h%../../../qcustomplot.h%' ${PINGCPP_SRC}/build/open-esc-qt_autogen/include/ui_mainwindow.h
# COMMENT "hacking qcustomplot include path in qt autogenerated mainwindow ui header"
# )
add_custom_command(OUTPUT ${PINGCPP_SRC}/message/ping-message-openesc.h
# generate ping-cpp message files
COMMAND ${PINGPROTOCOL_SRC}/generator.py --definition ${PROJECT_SOURCE_DIR}/openesc.json --template ${PINGCPP_SRC}/generate/templates/ping-message-.h.in > ${PINGCPP_SRC}/message/ping-message-openesc.h
COMMENT "generating openesc messages"
)