Skip to content

Commit 60f1bb7

Browse files
ut003640deepin-bot[bot]
authored andcommitted
tests: add service tests
add the debug for service-manager-plugin-network Log: add debug for service-manager
1 parent 870fa7d commit 60f1bb7

17 files changed

+1335
-1470
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ endif()
5858
add_subdirectory("dock-network-plugin")
5959
add_subdirectory("dss-network-plugin")
6060
if (BUILD_EXAMPLE)
61-
# add_subdirectory("example")
61+
add_subdirectory("example")
6262
add_subdirectory("dss_example")
6363
add_subdirectory("dock-example")
6464
endif()

example/CMakeLists.txt

Lines changed: 29 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -3,107 +3,49 @@ cmake_minimum_required(VERSION 3.7)
33
project(example)
44

55
set(CMAKE_CXX_STANDARD 11)
6-
set(CMAKE_PREFIX_PATH $ENV{Qt5_DIR})
6+
set(CMAKE_PREFIX_PATH $ENV{Qt6_DIR})
77
set(CMAKE_AUTOMOC ON)
88
set(CMAKE_AUTORCC ON)
99

10-
find_package(DdeControlCenter REQUIRED)
10+
find_package(Qt6 COMPONENTS Core DBus Widgets Network REQUIRED)
11+
find_package(KF6NetworkManagerQt REQUIRED)
12+
find_package(Dtk6 COMPONENTS Widget REQUIRED)
1113
find_package(PkgConfig REQUIRED)
1214

13-
aux_source_directory(../dcc-network-plugin DCCPLUGINDIR)
14-
aux_source_directory(../dcc-network-plugin/window DCCPLUGINWINDOWDIR)
15-
aux_source_directory(../dcc-network-plugin/sections DCCPLUGINSECTIONS)
16-
aux_source_directory(../dcc-network-plugin/sections/vpn DCCPLUGINSECTIONSVPN)
17-
aux_source_directory(../dcc-network-plugin/settings DCCPLUGINSETTINGS)
18-
aux_source_directory(../dcc-network-plugin/settings/vpn DCCPLUGINVPNSETTINGS)
19-
aux_source_directory(../dcc-network-plugin/themes DCCPLUGINTHEMES)
20-
21-
file(GLOB_RECURSE QRCFILE "./example.qrc"
22-
"../dcc-network-plugin/icons/dcc-network-plugin.qrc"
23-
"../dcc-network-plugin/icons/actions/*.svg"
24-
"../dcc-network-plugin/icons/icons/*.svg")
25-
26-
set(COMPILEFILES
27-
./networkhandler.h
28-
./networkhandler.cpp
29-
./moduledatamodel.h
30-
./moduledatamodel.cpp
31-
./main.cpp
32-
./dccplugintestwidget.h
33-
./dccplugintestwidget.cpp)
34-
35-
file(GLOB_RECURSE DCCPLUGINSRCS
36-
"../dcc-network-plugin/*.h"
37-
"../dcc-network-plugin/*.cpp"
38-
"../dcc-network-plugin/icons/*"
39-
)
40-
#message(${DCCPLUGINDIR})
15+
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
16+
ADD_DEFINITIONS(-DSERVICE_CONFIG_DIR="${CMAKE_BINARY_DIR}/share/")
17+
ADD_DEFINITIONS(-DSERVICE_LIB_DIR="${CMAKE_BINARY_DIR}/network-service-plugin/")
18+
else()
19+
ADD_DEFINITIONS(-DSERVICE_CONFIG_DIR="${CMAKE_INSTALL_PREFIX}/share/deepin-service-manager/")
20+
ADD_DEFINITIONS(-DSERVICE_LIB_DIR="${CMAKE_INSTALL_FULL_LIBDIR}/deepin-service-manager/")
21+
endif()
4122

42-
#list(REMOVE_ITEM NETWORKDIR "../dde-network-core/debian")
23+
# 包含example自己的源文件
24+
file(GLOB COMPILEFILES "*.cpp" "*.h" "service/*.cpp" "service/*.h")
25+
file(GLOB_RECURSE QRCFILE "*.qrc")
4326

4427
add_executable(${PROJECT_NAME}
4528
${COMPILEFILES}
46-
${DCCPLUGINSRCS}
47-
${REALIZEDIR}
48-
${QRCFILE})
49-
50-
find_package(Qt5 COMPONENTS Core DBus Concurrent Network REQUIRED)
51-
find_package(Qt5Widgets REQUIRED)
52-
find_package(KF5NetworkManagerQt REQUIRED)
53-
find_package(DtkWidget REQUIRED)
54-
55-
get_target_property(KF5_QT_INCLUDE_DIRS KF5::NetworkManagerQt INTERFACE_INCLUDE_DIRECTORIES)
56-
57-
foreach(LETTER ${TRY_KF5_LIBRARIES})
58-
if (NOT KF5_QT_LIBRARIES)
59-
get_target_property(KF5_QT_LIBRARIES KF5::NetworkManagerQt ${LETTER})
60-
endif()
61-
endforeach()
62-
63-
if (NOT KF5_QT_LIBRARIES)
64-
find_library(KF5_QT_LIBRARIES libKF5NetworkManagerQt.so)
65-
endif()
66-
67-
set(TRY_KF5_LIBRARIES
68-
IMPORTED_LOCATION_DEBIAN
69-
IMPORTED_LOCATION_NOCONFIG
29+
${QRCFILE}
7030
)
7131

7232
target_include_directories(${PROJECT_NAME} PUBLIC
73-
../dcc-network-plugin
74-
../dcc-network-plugin/window
75-
../dcc-network-plugin/operation
76-
${DdeControlCenter_INCLUDE_DIR}
77-
${DtkWidget_INCLUDE_DIRS}
78-
${Qt5Core_INCLUDE_DIRS}
79-
${Qt5DBus_INCLUDE_DIRS}
80-
${Qt5Widget_INCLUDE_DIRS}
81-
Qt5::Concurrent
82-
${QGSettings_INCLUDE_DIRS}
83-
#${LibNM_INCLUDE_DIRS}
84-
${Qt5Network_INCLUDE_DIRS}
85-
${KF5_QT_INCLUDE_DIRS}
33+
.
34+
./service
35+
../src
36+
Dtk6::Widget
37+
Qt6::DBus
38+
Qt6::Network
39+
Qt6::Widgets
40+
KF6::NetworkManagerQt
8641
${DDE-Network-Core_INCLUDE_DIRS}
8742
)
8843

8944
target_link_libraries(${PROJECT_NAME} PRIVATE
90-
${DdeControlCenter_LIBRARIES}
91-
${DCC_INTERFACE_LIBRARIES}
92-
${DCC_WIDGETS_LIBRARIES}
93-
${DtkWidget_LIBRARIES}
94-
${Qt5Core_LIBRARIES}
95-
${Qt5Widgets_LIBRARIES}
96-
Qt5::Concurrent
97-
#${LibNM_LIBRARIES}
98-
${Qt5DBus_LIBRARIES}
99-
${Qt5Network_LIBRARIES}
100-
${QGSettings_LIBRARIES}
101-
${KF5_QT_LIBRARIES}
102-
${DDE-Network-Core_LIBRARIES}
45+
Dtk6::Widget
46+
Qt6::DBus
47+
Qt6::Network
48+
Qt6::Widgets
49+
KF6::NetworkManagerQt
50+
dde-network-core6
10351
)
104-
105-
add_custom_command(
106-
OUTPUT path.pb.cc path.pb.h
107-
COMMAND protoc
108-
ARGS --cpp_out . ${CMAKE_CURRENT_SOURCE_DIR}/path.proto -I ${CMAKE_CURRENT_SOURCE_DIR}
109-
DEPENDS path.proto)

0 commit comments

Comments
 (0)