moved gmpsend to its own project, fixed build with oldstyle tests
This commit is contained in:
parent
c6ce534297
commit
a65b541ce0
|
@ -15,7 +15,6 @@ include(GenerateExportHeader)
|
|||
option(WITH_FRONTENDS "Build frontends currently only useful if WITH_SNORE_DEAMON=ON" OFF)
|
||||
option(WITH_GROWL_BACKEND "Build the Growl backend" ON)
|
||||
option(WITH_SNORE_DEAMON "Build the Snore deamon, which redirects notifications" OFF)
|
||||
option(WITH_SNORE_SEND "An command line interface for snore" OFF)
|
||||
option(WITH_QT4 "Use Qt4" ON)
|
||||
option(WITH_KDE "Try to build with KDE support if available" ON)
|
||||
option(WITH_FREEDESKTOP_FRONTEND "Build the freedesktop frontend" OFF)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/core)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/core ${CMAKE_CURRENT_BINARY_DIR}/core)
|
||||
|
||||
add_subdirectory(core)
|
||||
add_subdirectory(snore-send)
|
||||
|
||||
if(WITH_SNORE_DEAMON)
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
||||
include(GetGitRevisionDescription)
|
||||
|
||||
get_git_head_revision(GIT_REFSPEC SNORE_REVISION)
|
||||
|
@ -40,22 +39,37 @@ set ( SnoreNotify_HDR ${SnoreNotify_HDR}
|
|||
|
||||
|
||||
add_library( libsnore SHARED ${SnoreNotify_SRCS})
|
||||
set_target_properties( libsnore PROPERTIES OUTPUT_NAME "snore${SNORE_SUFFIX}")
|
||||
set_target_properties( libsnore PROPERTIES
|
||||
OUTPUT_NAME "snore${SNORE_SUFFIX}"
|
||||
VERSION "${SNORE_VERSION_MAJOR}.${SNORE_VERSION_MINOR}.${SNORE_VERSION_PATCH}.${SNORE_VERSION_SUFFIX}"
|
||||
SOVERSION "${SNORE_VERSION_MAJOR}.${SNORE_VERSION_MINOR}"
|
||||
EXPORT_NAME Libsnore)
|
||||
target_link_libraries( libsnore PUBLIC ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTNETWORK_LIBRARY} )
|
||||
|
||||
add_library(Snore::Libsnore ALIAS libsnore)
|
||||
|
||||
|
||||
|
||||
generate_export_header(libsnore
|
||||
EXPORT_FILE_NAME snore_exports.h
|
||||
EXPORT_MACRO_NAME SNORE_EXPORT
|
||||
)
|
||||
|
||||
install(TARGETS libsnore EXPORT Libsnore${SNORE_CamelCase_SUFFIX}Config
|
||||
#TODO: drop /core/
|
||||
target_include_directories(libsnore PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
$<INSTALL_INTERFACE:include/snore/core>)
|
||||
|
||||
install(TARGETS libsnore EXPORT LibsnoreTarget
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
INCLUDES DESTINATION include/snore)
|
||||
ARCHIVE DESTINATION lib)
|
||||
|
||||
install(EXPORT Libsnore${SNORE_CamelCase_SUFFIX}Config DESTINATION lib/cmake/libsnore${SNORE_CamelCase_SUFFIX})
|
||||
install(EXPORT LibsnoreTarget DESTINATION lib/cmake/libsnore${SNORE_CamelCase_SUFFIX} NAMESPACE Snore::)
|
||||
|
||||
install(FILES ${SnoreNotify_HDR} DESTINATION include/snore/core)
|
||||
|
||||
install(FILES LibsnoreConfig.cmake DESTINATION lib/cmake/libsnore${SNORE_CamelCase_SUFFIX} RENAME Libsnore${SNORE_CamelCase_SUFFIX}Config.cmake)
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
include("${CMAKE_CURRENT_LIST_DIR}/LibsnoreTarget.cmake")
|
||||
set(LIBSNORE_FOUND TRUE)
|
||||
set(LIBSNORE_LIBRARIES Snore::Libsnore)
|
|
@ -11,7 +11,7 @@ if(EXISTS ${CMAKE_SOURCE_DIR}/thirdparty/gntp-send/)
|
|||
${CMAKE_SOURCE_DIR}/thirdparty/gntp-send/src/growl.cpp)
|
||||
|
||||
add_library(libsnore_backend_growl MODULE ${GROWL_SRC} )
|
||||
target_link_libraries(libsnore_backend_growl libsnore ${QT_QTCORE_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries(libsnore_backend_growl Snore::Libsnore ${QT_QTCORE_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
|
||||
set_target_properties(libsnore_backend_growl PROPERTIES COMPILE_FLAGS "-DGROWL_DLL -DGROWL_CPP_DLL" )
|
||||
|
||||
if( WIN32 )
|
||||
|
|
|
@ -5,6 +5,6 @@ if(APPLE)
|
|||
osxnotificationcenter.mm
|
||||
)
|
||||
add_library(libsnore_backend_osxnotificationcenter MODULE ${OSXNOTIFICATIONCENTER_SRC})
|
||||
target_link_libraries(libsnore_backend_osxnotificationcenter libsnore /System/Library/Frameworks/Foundation.framework)
|
||||
target_link_libraries(libsnore_backend_osxnotificationcenter Snore::Libsnore /System/Library/Frameworks/Foundation.framework)
|
||||
install(TARGETS libsnore_backend_osxnotificationcenter ${SNORE_PLUGIN_INSTALL_PATH})
|
||||
endif(APPLE)
|
||||
|
|
|
@ -8,7 +8,7 @@ if(WIN32)
|
|||
snarl.cpp
|
||||
)
|
||||
add_library(libsnore_backend_snarl MODULE ${SNARL_SRC} )
|
||||
target_link_libraries(libsnore_backend_snarl libsnore ${QT_QTCORE_LIBRARY} )
|
||||
target_link_libraries(libsnore_backend_snarl Snore::Libsnore ${QT_QTCORE_LIBRARY} )
|
||||
if(MINGW)
|
||||
set_target_properties(libsnore_backend_snarl PROPERTIES COMPILE_FLAGS "-Wno-conversion-null -Wno-unused")
|
||||
endif(MINGW)
|
||||
|
|
|
@ -8,7 +8,7 @@ set( SNORE_SRC
|
|||
|
||||
|
||||
add_library(libsnore_backend_snore MODULE ${SNORE_SRC} )
|
||||
target_link_libraries(libsnore_backend_snore libsnore ${QT_QTCORE_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY})
|
||||
target_link_libraries(libsnore_backend_snore Snore::Libsnore ${QT_QTCORE_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY})
|
||||
|
||||
install(TARGETS libsnore_backend_snore ${SNORE_PLUGIN_INSTALL_PATH})
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ if(WIN32)
|
|||
snoretoast.cpp
|
||||
)
|
||||
add_library(libsnore_backend_snoretoast MODULE ${TOASTER_SRC} )
|
||||
target_link_libraries(libsnore_backend_snoretoast libsnore ${QT_QTCORE_LIBRARY} )
|
||||
target_link_libraries(libsnore_backend_snoretoast Snore::Libsnore ${QT_QTCORE_LIBRARY} )
|
||||
|
||||
install(TARGETS libsnore_backend_snoretoast ${SNORE_PLUGIN_INSTALL_PATH})
|
||||
|
||||
|
|
|
@ -2,6 +2,6 @@ set( trayicon_SRC
|
|||
trayiconnotifer.cpp
|
||||
)
|
||||
add_library(libsnore_backend_trayicon MODULE ${trayicon_SRC} )
|
||||
target_link_libraries(libsnore_backend_trayicon libsnore ${QT_QTCORE_LIBRARY} )
|
||||
target_link_libraries(libsnore_backend_trayicon Snore::Libsnore ${QT_QTCORE_LIBRARY} )
|
||||
|
||||
install(TARGETS libsnore_backend_trayicon ${SNORE_PLUGIN_INSTALL_PATH})
|
||||
|
|
|
@ -10,7 +10,7 @@ if(QT_QTDBUS_FOUND AND WITH_FREEDESKTOP_FRONTEND)
|
|||
qt4_add_dbus_adaptor( FREEDESKTOP_NOTIFICATION_FRONTEND_SRC org.freedesktop.Notifications.xml freedesktopnotificationfrontend.h FreedesktopFrontend)
|
||||
|
||||
add_library(libsnore_frontend_freedesktop MODULE ${FREEDESKTOP_NOTIFICATION_FRONTEND_SRC} )
|
||||
target_link_libraries(libsnore_frontend_freedesktop libsnore ${QT_QTDBUS_LIBRARY} ${QT_QTGUI_LIBRARY} )
|
||||
target_link_libraries(libsnore_frontend_freedesktop Snore::Libsnore ${QT_QTDBUS_LIBRARY} ${QT_QTGUI_LIBRARY} )
|
||||
|
||||
if(KF5_IconThemes_FOUND)
|
||||
target_link_libraries(libsnore_frontend_freedesktop KF5::IconThemes)
|
||||
|
|
|
@ -3,6 +3,6 @@ set( SNARL_NETWORK_SRC
|
|||
parser.cpp
|
||||
)
|
||||
add_library(libsnore_frontend_snarlnetwork MODULE ${SNARL_NETWORK_SRC} )
|
||||
target_link_libraries(libsnore_frontend_snarlnetwork libsnore ${QT_QTNETWORK_LIBRARY} )
|
||||
target_link_libraries(libsnore_frontend_snarlnetwork Snore::Libsnore ${QT_QTNETWORK_LIBRARY} )
|
||||
|
||||
install(TARGETS libsnore_frontend_snarlnetwork ${SNORE_PLUGIN_INSTALL_PATH})
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
if(WITH_SNORE_SEND)
|
||||
if(NOT WITH_QT4)
|
||||
message(STATUS "Building snore-send")
|
||||
add_executable( snore-send main.cpp ${SNORENOTIFY_DEAMON_DEPS})
|
||||
target_link_libraries( snore-send libsnore Qt5::Core )
|
||||
|
||||
if(KDE5_FOUND)
|
||||
target_link_libraries( snore-send KF5::CoreAddons KF5::I18n)
|
||||
endif()
|
||||
|
||||
install(TARGETS snore-send RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
||||
else()
|
||||
message(STATUS "Don't build snore-send, as it depends on Qt5")
|
||||
endif()
|
||||
endif()
|
|
@ -1,96 +0,0 @@
|
|||
|
||||
#include "core/snore.h"
|
||||
#include "core/notification/notification.h"
|
||||
#include "core/log.h"
|
||||
#include "core/version.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCommandLineParser>
|
||||
|
||||
|
||||
#ifdef HAVE_KDE5
|
||||
#include <KAboutData>
|
||||
#include <KI18n/KLocalizedString>
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace Snore;
|
||||
|
||||
|
||||
int main ( int argc, char *argv[] )
|
||||
{
|
||||
QApplication app ( argc, argv );
|
||||
app.setApplicationName("snore-send");
|
||||
app.setOrganizationName("snore-send");
|
||||
app.setApplicationVersion(Snore::Version::version());
|
||||
|
||||
#ifdef HAVE_KDE5
|
||||
KAboutData about("snore-send", "snore-send",Snore::Version::version(),
|
||||
i18n("A command line interface for Snorenotify."),KAboutLicense::LGPL_V3, i18n("Copyright (c) 2014 Patrick von Reth <vonreth@kde.org>"));
|
||||
|
||||
KAboutData::setApplicationData(about);
|
||||
#endif
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription("A command line interface for Snorenotify.");
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
|
||||
QCommandLineOption title(QStringList() << "t" << "title", "Set the notification title.", "title");
|
||||
parser.addOption(title);
|
||||
|
||||
QCommandLineOption message(QStringList() << "m" << "message", "Set the notification body.", "message");
|
||||
parser.addOption(message);
|
||||
|
||||
QCommandLineOption applicationName(QStringList() << "a" << "application", "Set the notification applicattion.", "application", app.applicationName());
|
||||
parser.addOption(applicationName);
|
||||
|
||||
|
||||
QCommandLineOption alertName(QStringList() << "c" << "alert", "Set the notification alert class.","alert", "Default");
|
||||
parser.addOption(alertName);
|
||||
|
||||
QCommandLineOption iconPath(QStringList() << "i" << "icon", "Set the notification icon.","icon", ":/root/snore.png");
|
||||
parser.addOption(iconPath);
|
||||
|
||||
QCommandLineOption backend(QStringList() << "b" << "backend", "Set the notification backend.","backend");
|
||||
parser.addOption(backend);
|
||||
|
||||
|
||||
parser.process(app);
|
||||
snoreDebug( SNORE_DEBUG ) << parser.positionalArguments();
|
||||
if(parser.isSet(title) && parser.isSet(message))
|
||||
{
|
||||
SnoreCore core;
|
||||
|
||||
core.loadPlugins(SnorePlugin::BACKEND);
|
||||
if(parser.isSet(backend)?!core.setPrimaryNotificationBackend(parser.value(backend)):!core.setPrimaryNotificationBackend())
|
||||
{
|
||||
std::cout << "Failed to set backend: " << qPrintable(parser.value(backend)) << " avalible backends: " << qPrintable(core.notificationBackends().join(", ")) << std::endl;
|
||||
return 1;
|
||||
}
|
||||
Icon icon(parser.value(iconPath));
|
||||
Application application(parser.value(applicationName),icon);
|
||||
Alert alert(parser.value(alertName),icon);
|
||||
application.addAlert(alert);
|
||||
|
||||
core.registerApplication(application);
|
||||
|
||||
Notification n(application, alert, parser.value(title), parser.value(message),icon);
|
||||
|
||||
core.broadcastNotification(n);
|
||||
int returnCode = -1;
|
||||
app.connect(&core, &SnoreCore::notificationClosed, [&returnCode](Notification noti){
|
||||
QString reason;
|
||||
QDebug(&reason) << noti.closeReason();
|
||||
std::cout << qPrintable(reason) << std::endl;
|
||||
returnCode = noti.closeReason();
|
||||
});
|
||||
app.connect(&core, &SnoreCore::notificationClosed, &app, &QApplication::quit);
|
||||
app.exec();
|
||||
return returnCode;
|
||||
}
|
||||
parser.showHelp(1);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue