You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.7 KiB
57 lines
1.7 KiB
cmake_minimum_required(VERSION 3.7)
|
|
|
|
set(PLUGIN_NAME "dp4-service")
|
|
|
|
project(${PLUGIN_NAME})
|
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
set(CMAKE_AUTORCC ON)
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
ADD_DEFINITIONS(-DQM_FILES_DIR="${CMAKE_BINARY_DIR}/dp4-service-plugin")
|
|
else()
|
|
ADD_DEFINITIONS(-DQM_FILES_DIR="/usr/share/deepin-service-manager/dp4-service-plugin/translations")
|
|
endif()
|
|
|
|
find_package(Qt5 COMPONENTS Core Widgets DBus Network LinguistTools REQUIRED)
|
|
|
|
file(GLOB TS_FILES "translations/*.ts")
|
|
qt5_add_translation(QM_FILES ${TS_FILES})
|
|
add_custom_target(${PLUGIN_NAME}_language ALL DEPENDS ${QM_FILES})
|
|
|
|
file(GLOB_RECURSE SRCS "*.h" "*.cpp")
|
|
|
|
add_library(${PLUGIN_NAME} MODULE
|
|
${SRCS}
|
|
)
|
|
|
|
target_include_directories(${PLUGIN_NAME} PUBLIC
|
|
Qt5::Core
|
|
Qt5::DBus
|
|
${Qt5Widget_INCLUDE_DIRS}
|
|
${Qt5Network_INCLUDE_DIRS}
|
|
${DtkCore_INCLUDE_DIRS}
|
|
.
|
|
)
|
|
|
|
target_link_libraries(${PLUGIN_NAME} PRIVATE
|
|
Qt5::Core
|
|
Qt5::DBus
|
|
${Qt5Network_LIBRARIES}
|
|
${Qt5Widgets_LIBRARIES}
|
|
)
|
|
|
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
EXECUTE_PROCESS(COMMAND mkdir -p ${CMAKE_BINARY_DIR}/share/system/)
|
|
EXECUTE_PROCESS(COMMAND mkdir -p ${CMAKE_BINARY_DIR}/share/user/)
|
|
EXECUTE_PROCESS(COMMAND cp -f ${CMAKE_CURRENT_SOURCE_DIR}/plugin-dp4-service.json ${CMAKE_BINARY_DIR}/share/user/)
|
|
else()
|
|
# just need this in your project
|
|
install(TARGETS ${PLUGIN_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}/deepin-service-manager/)
|
|
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/plugin-dp4-service.json DESTINATION share/deepin-service-manager/user/)
|
|
endif()
|
|
|
|
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.deepin.service.dp4.conf DESTINATION share/dbus-1/system.d/)
|
|
install(FILES ${QM_FILES} DESTINATION ${CMAKE_INSTALL_DATADIR}/${PLUGIN_NAME}/translations)
|
|
|