更新库安装文件

This commit is contained in:
iaom 2023-02-16 09:28:41 +08:00
parent 57cc6a3324
commit 15f626b7b1
6 changed files with 32 additions and 13 deletions

View File

@ -12,6 +12,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(GNUInstallDirs) include(GNUInstallDirs)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core LinguistTools DBus Network Gui REQUIRED) find_package(QT NAMES Qt6 Qt5 COMPONENTS Core LinguistTools DBus Network Gui REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core LinguistTools DBus Network Gui REQUIRED) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core LinguistTools DBus Network Gui REQUIRED)
set(REQUIRED_QT_VERSION 5.12.8)
add_subdirectory(notification-server) add_subdirectory(notification-server)
add_subdirectory(libukui-notification) add_subdirectory(libukui-notification)

View File

@ -32,24 +32,43 @@ target_link_libraries(ukui-notification
Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Gui
KF5::WindowSystem KF5::WindowSystem
) )
target_compile_definitions(ukui-notification PRIVATE UKUINOTIFICATION_LIBRARY)
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)
set(CMAKECONFIG_INSTALL_DIR "/usr/include/ukui-notification") set(CMAKECONFIG_INSTALL_DIR "/usr/share/cmake/ukui-notification")
set(HEADERS_INSTALL_DIR /usr/include/ukui-notification)
set(PC_INSTALL_DIR "/usr/lib/pkgconfig")
target_include_directories(ukui-notification PUBLIC $<INSTALL_INTERFACE:${HEADERS_INSTALL_DIR}>)
configure_package_config_file( configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/ukui-notification-config.cmake.in" "${CMAKE_CURRENT_SOURCE_DIR}/ukui-notification-config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/ukui-notification-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/ukui-notification-config.cmake"
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}) INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR})
set(PC_INSTALL_DIR "/usr/lib/pkgconfig") write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/ukui-notification-config-version.cmake
VERSION ${UKUI_NOTIFICATION_VERSION}
COMPATIBILITY SameMajorVersion
)
configure_package_config_file( configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/ukui-notification.pc.in" "${CMAKE_CURRENT_SOURCE_DIR}/ukui-notification.pc.in"
"${CMAKE_CURRENT_BINARY_DIR}/ukui-notification.pc" "${CMAKE_CURRENT_BINARY_DIR}/ukui-notification.pc"
INSTALL_DESTINATION ${PC_INSTALL_DIR}) INSTALL_DESTINATION ${PC_INSTALL_DIR})
set_target_properties(ukui-notification PROPERTIES set_target_properties(ukui-notification PROPERTIES
VERSION ${UKUI_NOTIFICATION_VERSION} VERSION ${UKUI_NOTIFICATION_VERSION}
SOVERSION "1" SOVERSION ${VERSION_MAJOR}
OUTPUT_NAME ukui-notification OUTPUT_NAME ukui-notification
) )
install(TARGETS ukui-notification DESTINATION /usr/lib) install(TARGETS ukui-notification
install(FILES ${HEADERS} DESTINATION /usr/include/ukui-notification) EXPORT ukui-notification
PUBLIC_HEADER DESTINATION ${HEADERS_INSTALL_DIR}
LIBRARY DESTINATION /usr/lib
)
install(EXPORT ukui-notification
FILE ukui-notification-targets.cmake
DESTINATION ${CMAKECONFIG_INSTALL_DIR})
install(FILES ${HEADERS} DESTINATION ${HEADERS_INSTALL_DIR})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ukui-notification.pc DESTINATION ${PC_INSTALL_DIR}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ukui-notification.pc DESTINATION ${PC_INSTALL_DIR})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ukui-notification-config.cmake DESTINATION ${CMAKECONFIG_INSTALL_DIR}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ukui-notification-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/ukui-notification-config-version.cmake
DESTINATION ${CMAKECONFIG_INSTALL_DIR})

View File

@ -13,7 +13,7 @@ class NotificationClientPrivate : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit NotificationClientPrivate(NotificationClient *q, QObject *parent = nullptr); explicit NotificationClientPrivate(NotificationClient *q);
~NotificationClientPrivate() override; ~NotificationClientPrivate() override;
bool init(); bool init();
static QString clientServicePath(); static QString clientServicePath();

View File

@ -9,7 +9,7 @@
using namespace UkuiNotification; using namespace UkuiNotification;
NotificationClientPrivate::NotificationClientPrivate(NotificationClient *q, QObject *parent) : QObject(parent), q(q) NotificationClientPrivate::NotificationClientPrivate(NotificationClient *q) : QObject(q), q(q)
{ {
} }

View File

@ -23,7 +23,7 @@ public:
Undefined = 4, //Undefined/reserved reasons. Undefined = 4, //Undefined/reserved reasons.
}; };
Q_ENUM(CloseReason) Q_ENUM(CloseReason)
explicit NotificationClient(QObject *parent); explicit NotificationClient(QObject *parent = nullptr);
~NotificationClient(); ~NotificationClient();
/** /**
* *

View File

@ -1,10 +1,9 @@
@PACKAGE_INIT@ @PACKAGE_INIT@
include(CMakeFindDependencyMacro) include(CMakeFindDependencyMacro)
find_dependency(Qt@QT_MAJOR_VERSION@Core "@REQUIRED_QT_VERSION@") find_dependency(Qt@QT_VERSION_MAJOR@Core "@REQUIRED_QT_VERSION@")
if(TARGET Qt6::Core) if(TARGET Qt6::Core)
find_dependency(Qt6Core5Compat @REQUIRED_QT_VERSION@) find_dependency(Qt6Core5Compat @REQUIRED_QT_VERSION@)
endif() endif()
include("${CMAKE_CURRENT_LIST_DIR}/ukui-notificationTargets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/ukui-notification-targets.cmake")