1
1
project (botui )
2
2
3
- option (qt5 "Use Qt5 instead of Qt4" OFF )
4
- option (wallaby "Use the Wallaby controller" ON )
3
+ option (wombat "Use the Wombat controller" ON )
4
+ option (DEBUG "Enable debug mode" OFF )
5
+ option (RELEASE "Enable release mode" OFF )
6
+ option (docker_cross "Cross compile option for docker container" OFF )
7
+
8
+ cmake_minimum_required (VERSION 2.8.11 )
9
+
10
+ #if (wallaby)
11
+ # add_definitions(-DWALLABY)
12
+ #set(DEVICE_DIR ${CMAKE_SOURCE_DIR}/devices/wallaby)
13
+ #find_package(OpenCV REQUIRED)
14
+ #else()
15
+ # set(DEVICE_DIR ${CMAKE_SOURCE_DIR}/devices/kovan)
16
+
17
+ #endif()
18
+
19
+ set (LIBKAR_ROOT ${CMAKE_SOURCE_DIR} /../libkar )
20
+ set (PCOMPILER_ROOT ${CMAKE_SOURCE_DIR} /../pcompiler )
21
+ set (LIBKIPR_ROOT ${CMAKE_SOURCE_DIR} /../libwallaby )
22
+ set (CREATE3_ROOT ${CMAKE_SOURCE_DIR} /../create3 )
23
+
24
+ include_directories (/usr/local/include )
5
25
6
- if (NOT qt5 )
7
- cmake_minimum_required (VERSION 2.6.0 )
8
- else ()
9
- cmake_minimum_required (VERSION 2.8.11 )
26
+ if (wombat )
27
+ add_definitions (-DWOMBAT )
28
+ set (DEVICE_DIR ${CMAKE_SOURCE_DIR} /devices/wombat )
10
29
endif ()
11
30
12
- if ( wallaby )
13
- add_definitions ( -DWALLABY )
14
- set ( DEVICE_DIR ${CMAKE_SOURCE_DIR} /devices/wallaby )
15
- else ( )
16
- set ( DEVICE_DIR ${CMAKE_SOURCE_DIR} /devices/kovan )
31
+ if ( docker_cross )
32
+ link_directories ( " ${LIBKAR_ROOT} /lib" )
33
+ link_directories ( " ${PCOMPILER_ROOT} /lib" )
34
+ link_directories ( " ${LIBKIPR_ROOT} /build" )
35
+ include_directories ( /usr/local/include )
17
36
endif ()
18
37
19
38
set (EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR} /deploy )
20
-
39
+ set (CMAKE_THREAD_LIBS_INIT "-lpthread" )
40
+ set (CMAKE_HAVE_THREADS_LIBRARY 1 )
41
+ set (CMAKE_USE_WIN32_THREADS_INIT 0 )
42
+ set (CMAKE_USE_PTHREADS_INIT 1 )
43
+ set (THREADS_PREFER_PTHREAD_FLAG ON )
21
44
set (INCLUDE ${CMAKE_SOURCE_DIR} /include/botui )
45
+ set (WOMBAT ${DEVICES} /kipr )
22
46
set (RC ${CMAKE_SOURCE_DIR} /rc )
23
47
set (SRC ${CMAKE_SOURCE_DIR} /src )
24
48
set (UI ${CMAKE_SOURCE_DIR} /ui )
25
49
set (TS ${CMAKE_SOURCE_DIR} /ts )
26
50
27
- set (DBUS ${CMAKE_SOURCE_DIR} /dbus )
28
-
29
51
include_directories (
30
52
${CMAKE_SOURCE_DIR}
31
53
${CMAKE_SOURCE_DIR} /src
@@ -35,29 +57,19 @@ include_directories(
35
57
${INCLUDE}
36
58
)
37
59
38
- if (NOT qt5 )
39
- cmake_minimum_required (VERSION 2.6.0 )
40
- find_package (Qt4 REQUIRED )
41
- find_package ( PythonInterp 2.7 REQUIRED )
42
- find_package ( PythonLibs 2.7 REQUIRED )
43
- set (QT_USE_QTDECLARATIVE TRUE )
44
- set (QT_USE_QTNETWORK TRUE )
45
- set (QT_USE_QTDBUS TRUE )
46
-
47
- include (${QT_USE_FILE} )
48
- else ()
60
+
49
61
50
- find_package (Qt5Widgets REQUIRED )
51
- find_package (Qt5Declarative REQUIRED )
52
- find_package (Qt5Network REQUIRED )
53
- endif ()
62
+ find_package (Qt6 REQUIRED COMPONENTS Core Gui Widgets Network Quick QuickWidgets QuickControls2 )
63
+
64
+
54
65
55
66
find_package (OpenSSL REQUIRED )
56
67
57
68
file (GLOB INCLUDES ${INCLUDE} /*.h ${DEVICE_DIR} /include/*.h )
58
69
file (GLOB SOURCES ${SRC} /*.cpp ${DEVICE_DIR} /src/*.cpp )
59
70
file (GLOB UIS ${UI} /* )
60
71
file (GLOB TS_FILES ${TS} /*.ts )
72
+ file (GLOB DBUS_INTERFACES ${DBUS} /*.xml )
61
73
62
74
set (UI ${UIS} )
63
75
@@ -69,75 +81,63 @@ set(QRC_FILES
69
81
${RC} /target.qrc
70
82
)
71
83
72
- if (NOT qt5 )
73
- file (GLOB DBUS_INCLUDES ${DBUS} /include/*.h )
74
- file (GLOB DBUS_SOURCES ${DBUS} /src/*.cpp )
75
- set (INCLUDES ${INCLUDES} ${DBUS_INCLUDES} )
76
- set (SOURCES ${SOURCES} ${DBUS_SOURCES} )
77
-
78
- set (MOC_SRCS ${INCLUDES} )
79
- set (SRCS_CXX ${SOURCES} )
84
+
80
85
81
- QT4_WRAP_CPP (SRCS_CXX ${MOC_SRCS} OPTIONS -DQT_VERSION=0x040000 )
82
- QT4_WRAP_UI (SRCS_CXX ${UI} )
83
- QT4_ADD_RESOURCES (SRCS_CXX ${QRC_FILES} )
84
- QT4_ADD_TRANSLATION (QM_FILES ${TS_FILES} )
85
- else ()
86
- # set(CMAKE_AUTOMOC ON)
87
- set (MOC_SRCS ${INCLUDES} )
88
- set (SRCS_CXX ${SOURCES} )
89
- qt5_wrap_cpp (SRCS_CXX ${MOC_SRCS} OPTIONS -DQT_VERSION=0x050000 -UQT_DBUS_LIB )
90
- qt5_wrap_ui (SRCS_CXX ${UI} )
91
- qt5_add_resources (SRCS_CXX ${QRC_FILES} )
92
- qt5_add_translation (QM_FILES ${TS_FILES} )
93
- endif ()
86
+
87
+
88
+ set (CMAKE_AUTOMOC ON )
89
+ set (CMAKE_INCLUDE_CURRENT_DIR ON )
90
+ set (MOC_SRCS ${INCLUDES} )
91
+ set (SRCS_CXX ${SOURCES} )
92
+ qt6_wrap_cpp (SRCS_CXX ${MOC_SRCS} OPTIONS -DQT_VERSION=0x060000 -UQT_DBUS_LIB )
93
+ qt6_wrap_ui (SRCS_CXX ${UI} )
94
+ qt6_add_resources (SRCS_CXX ${QRC_FILES} )
95
+
94
96
95
97
add_definitions (-Wall )
96
98
97
- # C++11
98
- # http://www.guyrutenberg.com/2014/01/05/enabling-c11-c0x-in-cmake/
99
- include (CheckCXXCompilerFlag )
100
- CHECK_CXX_COMPILER_FLAG ("-std=c++11" COMPILER_SUPPORTS_CXX11 )
101
- CHECK_CXX_COMPILER_FLAG ("-std=c++0x" COMPILER_SUPPORTS_CXX0X )
102
- if (COMPILER_SUPPORTS_CXX11 )
103
- add_definitions (--std=c++11 )
104
- elseif (COMPILER_SUPPORTS_CXX0X )
105
- add_definitions (--std=c++0x )
106
- else ()
107
- message (STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler." )
108
- endif ()
99
+ set (CMAKE_CXX_STANDARD 11 )
100
+ set (CMAKE_CXX_STANDARD_REQUIRED ON )
109
101
110
- IF (APPLE )
111
- add_definitions (-g )
112
- link_directories (/Library/Frameworks/ /usr/local/lib )
113
- include_directories (/usr/local/include )
114
- ELSEIF (WIN32 )
115
- set (CMAKE_CXX_FLAGS "-Wl,--enable-auto-import" )
116
- ENDIF ()
102
+ add_executable (botui ${SRCS_CXX} ${QM_FILES} ${DBUS_INTERFACE_SOURCES} )
117
103
118
- if (WIN32 )
119
- add_executable (botui WIN32 ${SRCS_CXX} ${QM_FILES} )
120
- else ()
121
- add_executable (botui ${SRCS_CXX} ${QM_FILES} )
104
+ if (DEBUG )
105
+ add_definitions (-g )
122
106
endif ()
123
107
124
- add_definitions (-O3 )
108
+ if (RELEASE )
109
+ add_definitions (-O3 )
110
+ endif ()
111
+
112
+ add_subdirectory (dbus )
113
+
114
+ target_link_libraries (botui
115
+ Qt6::Core
116
+ Qt6::Gui
117
+ Qt6::Quick
118
+ Qt6::QuickWidgets
119
+ Qt6::Widgets
120
+ Qt6::QuickControls2
121
+ network_manager_dbus
122
+ pcompiler
123
+ z
124
+ ${OPENSSL_LIBRARIES}
125
+ create3_client
126
+ )
125
127
126
- target_link_libraries (botui pcompiler z opencv_core opencv_highgui opencv_imgproc ${OPENSSL_LIBRARIES} )
127
- IF (wallaby )
128
- target_link_libraries (botui wallaby )
129
- ELSEIF (wombat )
128
+ IF (wombat )
130
129
target_link_libraries (botui kipr )
131
- ELSE ()
132
- target_link_libraries (botui kovan )
133
130
ENDIF ()
134
131
135
- if (NOT qt5 )
136
- target_link_libraries (botui ${QT_LIBRARIES} )
137
- else ()
138
- qt5_use_modules (botui Widgets Declarative Network )
139
- endif ()
132
+ target_link_libraries (botui ${QT_LIBRARIES} )
140
133
141
134
142
135
install (TARGETS botui DESTINATION bin )
143
136
install (FILES ${QM_FILES} DESTINATION "/etc/botui/locale" )
137
+
138
+ set (CPACK_PACKAGE_NAME botui )
139
+ set (CPACK_GENERATOR "DEB" )
140
+ set (CPACK_DEBIAN_PACKAGE_ARCHITECTURE arm64 )
141
+ set (CPACK_DEBIAN_PACKAGE_MAINTAINER "KISS Institute for Practical Robotics" )
142
+ set (CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} )
143
+ include (CPack )
0 commit comments