Mercurial > irccd
changeset 256:f04acabfbbe5
CMake: switch to NSIS with various fixes, closes #533
author | David Demelier <markand@malikania.fr> |
---|---|
date | Mon, 12 Sep 2016 17:54:27 +0200 |
parents | 233366c94ddb |
children | 60b94daf4d24 |
files | CMakeLists.txt cmake/IrccdOptions.cmake cmake/IrccdPackage.cmake cmake/function/IrccdDefineExecutable.cmake cmake/internal/sysconfig.hpp.in cmake/packages/FindQtIFW.cmake irccd/CMakeLists.txt irccd/main.cpp irccdctl/CMakeLists.txt irccdctl/main.cpp lib/CMakeLists.txt lib/irccd/config.cpp lib/irccd/dynlib.hpp lib/irccd/logger.cpp lib/irccd/logger.hpp lib/irccd/options.hpp lib/irccd/path.cpp lib/irccd/system.cpp plugins/CMakeLists.txt tests/js-logger/main.cpp tests/js-timer/main.cpp tests/logger/main.cpp tests/path/main.cpp tests/plugin-logger/main.cpp tests/plugin-plugin/main.cpp |
diffstat | 25 files changed, 172 insertions(+), 230 deletions(-) [+] |
line wrap: on
line diff
--- a/CMakeLists.txt Thu Sep 08 13:11:10 2016 +0200 +++ b/CMakeLists.txt Mon Sep 12 17:54:27 2016 +0200 @@ -48,6 +48,11 @@ cmake_minimum_required(VERSION 3.3) project(irccd) +# Helper to set global internal variables. +function(setg var value) + set("${var}" "${value}" CACHE INTERNAL "") +endfunction () + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${irccd_SOURCE_DIR}/cmake/packages) set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) @@ -125,18 +130,5 @@ message("") -# CPack (only for package_source, package_ifw is home made). -#include(cmake/IrccdPackage.cmake) -#include(CPack) - -# Meta release target. -#if (IRCCD_PACKAGE) -# add_custom_target( -# release -# COMMENT "Releasing irccd ${IRCCD_VERSION}" -# COMMAND -# ${CMAKE_MAKE_PROGRAM} package_source -# ) -# -# add_dependencies(release package_ifw) -#endif () +include(cmake/IrccdPackage.cmake) +include(CPack)
--- a/cmake/IrccdOptions.cmake Thu Sep 08 13:11:10 2016 +0200 +++ b/cmake/IrccdOptions.cmake Mon Sep 12 17:54:27 2016 +0200 @@ -212,16 +212,10 @@ # Do not move this section because irccd's CMake functions requires the IRCCD_PACKAGE value. # -find_package(QtIFW) - set(IRCCD_PACKAGE FALSE) if (NOT WITH_HTML) set(IRCCD_PACKAGE_MSG "No (HTML documentation disabled)") -elseif (NOT WIN32) - set(IRCCD_PACKAGE_MSG "No (only for Windows)") -elseif (NOT QtIFW_FOUND) - set(IRCCD_PACKAGE_MSG "No (QtIFW not found)") else () # Now check that a plugin has not been disabled. set(IRCCD_PACKAGE TRUE)
--- a/cmake/IrccdPackage.cmake Thu Sep 08 13:11:10 2016 +0200 +++ b/cmake/IrccdPackage.cmake Mon Sep 12 17:54:27 2016 +0200 @@ -20,91 +20,28 @@ set(CPACK_SOURCE_GENERATOR TXZ ZIP) set(CPACK_SOURCE_IGNORE_FILES "/[.]hg" "/CMakeLists[.]txt[.]user") +set(CPACK_PACKAGE_NAME "irccd") +set(CPACK_PACKAGE_VENDOR "malikania") +set(CPACK_PACKAGE_VERSION_MAJOR ${IRCCD_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${IRCCD_VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH ${IRCCD_VERSION_PATCH}) +set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE.md) + # -# Define the binary package name. +# Installer hierarchy. # ------------------------------------------------------------------- # +# -- Applications (Group: Applications) +# | -- irccd (Component: irccd) +# | -- irccdctl (Component: irccdctl) +# -- Development (Group: Development) +# | -- C++ Headers (Component: headers) +# -- Plugins (Group: Plugins) +# | -- * (Component: *) +# +# Replace * with the appropriate plugin name. +# if (WIN32) - set(PKGSYS "Windows") - set(PKGSUFFIX "exe") - - if (IRCCD_64BITS) - set(PKGTARGETDIR "C:/Program Files/irccd-${IRCCD_VERSION}") - else () - set(PKGTARGETDIR "C:/Program Files (x86)/irccd-${IRCCD_VERSION}") - endif () -endif () - -if (IRCCD_64BITS) - set(PKGARCH "amd64") -else () - set(PKGARCH "x86") + set(CPACK_GENERATOR "NSIS") endif () - -# -# Create the QtIFW hierarchy. -# ------------------------------------------------------------------- -# - -# Custom package_ifw on Windows -if (IRCCD_PACKAGE) - set(CONFDIR ${CMAKE_BINARY_DIR}/installer/config) - set(PKGDIR ${CMAKE_BINARY_DIR}/installer/packages) - set(PKGNAME "irccd-${IRCCD_VERSION}-${PKGSYS}-${PKGARCH}.${PKGSUFFIX}") - - # Configure some QtIFW files and their meta packages. - file(COPY cmake/installer/LICENSE DESTINATION ${PKGDIR}/base/meta) - - # QtIFW configuration file - configure_file(cmake/installer/config/config.xml.in ${CONFDIR}/config.xml) - - # Meta packages - configure_file(cmake/installer/packages/meta-programs.xml.in ${PKGDIR}/base/meta/package.xml) - configure_file(cmake/installer/packages/meta-plugins.xml.in ${PKGDIR}/plugins/meta/package.xml) - - # Irccd, irccdctl and docs - file( - MAKE_DIRECTORY - ${PKGDIR}/base.irccd/data/${WITH_BINDIR} - ${PKGDIR}/base.irccdctl/data/${WITH_BINDIR} - ${PKGDIR}/docs/data/${WITH_DOCDIR} - ) - - configure_file(cmake/installer/packages/irccd.xml.in ${PKGDIR}/base.irccd/meta/package.xml) - configure_file(cmake/installer/packages/irccd.xml.in ${PKGDIR}/base.irccdctl/meta/package.xml) - configure_file(cmake/installer/packages/docs.xml.in ${PKGDIR}/docs/meta/package.xml) - - # Main dependencies. - set(dependencies irccd irccdctl all-docs) - - # Build commands for plugins. - foreach (plugin ${IRCCD_PLUGINS}) - list(APPEND dependencies plugin-${plugin}) - file(MAKE_DIRECTORY ${PKGDIR}/plugins.${plugin}/data/${WITH_PLUGINDIR}) - set(IRCCD_PLUGIN_NAME ${plugin}) - configure_file(cmake/installer/packages/plugin.xml.in ${PKGDIR}/plugins.${plugin}/meta/package.xml) - list( - APPEND - PLUGIN_COMMANDS - COMMAND ${CMAKE_COMMAND} -E copy ${IRCCD_FAKEDIR}/${WITH_PLUGINDIR}/${plugin}.js ${PKGDIR}/plugins.${plugin}/data/${WITH_PLUGINDIR} - ) - endforeach () - - # Target for building the package. - add_custom_target( - package_ifw - ${PLUGIN_COMMANDS} - COMMAND - ${CMAKE_COMMAND} -E copy $<TARGET_FILE:irccd> ${PKGDIR}/base.irccd/data/${WITH_BINDIR} - COMMAND - ${CMAKE_COMMAND} -E copy $<TARGET_FILE:irccdctl> ${PKGDIR}/base.irccdctl/data/${WITH_BINDIR} - COMMAND - ${CMAKE_COMMAND} -E copy_directory ${IRCCD_FAKEDIR}/${WITH_DOCDIR} ${PKGDIR}/docs/data/${WITH_DOCDIR} - COMMAND - ${QtIFW_CREATOR} -c ${CONFDIR}/config.xml -p ${PKGDIR} ${CMAKE_BINARY_DIR}/${PKGNAME} - COMMENT "Generating ${CMAKE_BINARY_DIR}/${PKGNAME}" - DEPENDS ${dependencies} - VERBATIM - ) -endif ()
--- a/cmake/function/IrccdDefineExecutable.cmake Thu Sep 08 13:11:10 2016 +0200 +++ b/cmake/function/IrccdDefineExecutable.cmake Mon Sep 12 17:54:27 2016 +0200 @@ -22,20 +22,19 @@ # # irccd_define_executable( # TARGET target name +# DESCRIPTION short description (Required if installed) # SOURCES src1, src2, srcn # FLAGS (Optional) C/C++ flags (without -D) # LIBRARIES (Optional) libraries to link # INCLUDES (Optional) includes for the target -# INSTALL (Optional) if set, install the executable (default: false) -# PRIVATE (Optional) if set, do not build it into the fake root (default: false) # ) # # Create an executable that can be installed or not. # function(irccd_define_executable) - set(options INSTALL PRIVATE) - set(oneValueArgs TARGET) + set(options "") + set(oneValueArgs DESCRIPTION TARGET) set(multiValueArgs SOURCES FLAGS LIBRARIES INCLUDES) cmake_parse_arguments(EXE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) @@ -46,9 +45,8 @@ if (NOT EXE_SOURCES) message(FATAL_ERROR "Please set SOURCES") endif () - - if (EXE_INSTALL AND EXE_PRIVATE) - message(FATAL_ERROR "INSTALL and PRIVATE are mutually exclusive") + if (NOT EXE_DESCRIPTION) + message(FATAL_ERROR "DESCRIPTION required") endif () add_executable(${EXE_TARGET} ${EXE_SOURCES}) @@ -57,17 +55,25 @@ target_link_libraries(${EXE_TARGET} ${EXE_LIBRARIES}) # use fakeroot for public executables. - if (NOT EXE_PRIVATE) - set_target_properties( - ${EXE_TARGET} - PROPERTIES - RUNTIME_OUTPUT_DIRECTORY ${IRCCD_FAKEROOTDIR}/${WITH_BINDIR} - RUNTIME_OUTPUT_DIRECTORY_DEBUG ${IRCCD_FAKEROOTDIR}/${WITH_BINDIR} - RUNTIME_OUTPUT_DIRECTORY_RELEASE ${IRCCD_FAKEROOTDIR}/${WITH_BINDIR} - RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${IRCCD_FAKEROOTDIR}/${WITH_BINDIR} - RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${IRCCD_FAKEROOTDIR}/${WITH_BINDIR} - ) + set_target_properties( + ${EXE_TARGET} + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${IRCCD_FAKEROOTDIR}/${WITH_BINDIR} + RUNTIME_OUTPUT_DIRECTORY_DEBUG ${IRCCD_FAKEROOTDIR}/${WITH_BINDIR} + RUNTIME_OUTPUT_DIRECTORY_RELEASE ${IRCCD_FAKEROOTDIR}/${WITH_BINDIR} + RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${IRCCD_FAKEROOTDIR}/${WITH_BINDIR} + RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${IRCCD_FAKEROOTDIR}/${WITH_BINDIR} + ) - install(TARGETS ${EXE_TARGET} RUNTIME DESTINATION ${WITH_BINDIR}) - endif () + install( + TARGETS ${EXE_TARGET} + COMPONENT ${EXE_TARGET} + RUNTIME DESTINATION ${WITH_BINDIR} + ) + + # Put the application into a cpack group. + string(TOUPPER ${EXE_TARGET} CMP) + setg(CPACK_COMPONENT_${CMP}_DISPLAY_NAME "${EXE_TARGET} executable") + setg(CPACK_COMPONENT_${CMP}_DESCRIPTION ${EXE_DESCRIPTION}) + setg(CPACK_COMPONENT_${CMP}_GROUP "Applications") endfunction()
--- a/cmake/internal/sysconfig.hpp.in Thu Sep 08 13:11:10 2016 +0200 +++ b/cmake/internal/sysconfig.hpp.in Mon Sep 12 17:54:27 2016 +0200 @@ -19,12 +19,21 @@ #ifndef IRCCD_SYSCONFIG_H #define IRCCD_SYSCONFIG_H + + /* * Fix annoying "Please include winsock2.h before windows.h" */ #if defined(_WIN32) -# include <winsock2.h> -# include <windows.h> +# if !defined(WIN32_MEAN_AND_LEAN) +# define WIN32_MEAN_AND_LEAN +# endif +# if !defined(NOMINMAX) +# define NOMINMAX +# endif + +# include <winsock2.h> +# include <windows.h> #endif /* @@ -100,13 +109,18 @@ * Export stuff. * ------------------------------------------------------------------ */ +#cmakedefine BUILD_SHARED_LIBS #if defined(_WIN32) -# if defined(IRCCD_BUILDING_DLL) -# define IRCCD_EXPORT __declspec(dllexport) -# else -# define IRCCD_EXPORT -# endif +# if defined(BUILD_SHARED_LIBS) +# if defined(IRCCD_BUILDING_DLL) +# define IRCCD_EXPORT __declspec(dllexport) +# else +# define IRCCD_EXPORT __declspec(dllimport) +# endif +# else +# define IRCCD_EXPORT +# endif #else # define IRCCD_EXPORT #endif
--- a/cmake/packages/FindQtIFW.cmake Thu Sep 08 13:11:10 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -# FindQtIFW -# --------- -# -# Find Qt Installer Framework, this module defines: -# -# QtIFW_CREATOR, where to find binarycreator.exe -# QtIFW_FOUND, if the InnoSetup installation was found -# - -find_program( - QtIFW_CREATOR - NAMES binarycreator - DOC "QtIFW binarycreator executable" -) - -include(FindPackageHandleStandardArgs) - -find_package_handle_standard_args( - QtIFW - FOUND_VAR QtIFW_FOUND - REQUIRED_VARS QtIFW_CREATOR -) - -mark_as_advanced(QtIFW_CREATOR) \ No newline at end of file
--- a/irccd/CMakeLists.txt Thu Sep 08 13:11:10 2016 +0200 +++ b/irccd/CMakeLists.txt Mon Sep 12 17:54:27 2016 +0200 @@ -20,7 +20,7 @@ irccd_define_executable( TARGET irccd - INSTALL + DESCRIPTION "The main irccd daemon." SOURCES CMakeLists.txt main.cpp INCLUDES ${irccd_SOURCE_DIR} LIBRARIES libirccd
--- a/irccd/main.cpp Thu Sep 08 13:11:10 2016 +0200 +++ b/irccd/main.cpp Mon Sep 12 17:54:27 2016 +0200 @@ -80,7 +80,6 @@ // Default logging to console. log::setVerbose(false); - log::setInterface(std::make_unique<log::Console>()); // Register some signals. signal(SIGINT, stop);
--- a/irccdctl/CMakeLists.txt Thu Sep 08 13:11:10 2016 +0200 +++ b/irccdctl/CMakeLists.txt Mon Sep 12 17:54:27 2016 +0200 @@ -20,7 +20,7 @@ irccd_define_executable( TARGET irccdctl - INSTALL + DESCRIPTION "Irccd controller." SOURCES CMakeLists.txt main.cpp LIBRARIES libirccd )
--- a/irccdctl/main.cpp Thu Sep 08 13:11:10 2016 +0200 +++ b/irccdctl/main.cpp Mon Sep 12 17:54:27 2016 +0200 @@ -28,7 +28,6 @@ // TODO: move to Application sys::setProgramName("irccdctl"); path::setApplicationPath(argv[0]); - log::setInterface(std::make_unique<log::Console>()); log::setVerbose(false); try {
--- a/lib/CMakeLists.txt Thu Sep 08 13:11:10 2016 +0200 +++ b/lib/CMakeLists.txt Mon Sep 12 17:54:27 2016 +0200 @@ -72,12 +72,26 @@ install( TARGETS libirccd -# EXPORT Irccd2Targets - RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) +# +# Headers. +# ------------------------------------------------------------------- +# + +install( + FILES ${HEADERS} + COMPONENT headers + DESTINATION include/irccd +) + +setg(CPACK_COMPONENT_HEADERS_GROUP "Development") +setg(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers") +setg(CPACK_COMPONENT_HEADERS_DESCRIPTION + "Install the C++ headers if you want to build irccd native plugins.") + # # CMake target exports. # export( # EXPORT Irccd2Targets
--- a/lib/irccd/config.cpp Thu Sep 08 13:11:10 2016 +0200 +++ b/lib/irccd/config.cpp Mon Sep 12 17:54:27 2016 +0200 @@ -100,7 +100,7 @@ return config; } -std::unique_ptr<log::Interface> loadLogFile(const ini::Section &sc) +std::unique_ptr<log::Logger> loadLogFile(const ini::Section &sc) { /* * TODO: improve that with CMake options. @@ -120,13 +120,13 @@ if ((it = sc.find("path-errors")) != sc.end()) errors = it->value(); - return std::make_unique<log::File>(std::move(normal), std::move(errors)); + return std::make_unique<log::FileLogger>(std::move(normal), std::move(errors)); } -std::unique_ptr<log::Interface> loadLogSyslog() +std::unique_ptr<log::Logger> loadLogSyslog() { #if defined(HAVE_SYSLOG) - return std::make_unique<log::Syslog>(); + return std::make_unique<log::SyslogLogger>(); #else throw std::runtime_error("logs: syslog is not available on this platform"); #endif // !HAVE_SYSLOG @@ -474,7 +474,7 @@ ini::Section::const_iterator it; if ((it = sc->find("type")) != sc->end()) { - std::unique_ptr<log::Interface> iface; + std::unique_ptr<log::Logger> iface; // Console is the default, no test case. if (it->value() == "file") @@ -485,7 +485,7 @@ throw std::runtime_error("logs: unknown log type: {}"_format(it->value())); if (iface) - log::setInterface(std::move(iface)); + log::setLogger(std::move(iface)); } }
--- a/lib/irccd/dynlib.hpp Thu Sep 08 13:11:10 2016 +0200 +++ b/lib/irccd/dynlib.hpp Mon Sep 12 17:54:27 2016 +0200 @@ -135,7 +135,7 @@ #include <string> #if defined(_WIN32) -# include <Windows.h> +# include <windows.h> #else # include <dlfcn.h> #endif
--- a/lib/irccd/logger.cpp Thu Sep 08 13:11:10 2016 +0200 +++ b/lib/irccd/logger.cpp Mon Sep 12 17:54:27 2016 +0200 @@ -44,7 +44,7 @@ */ std::atomic<bool> verbose{false}; -std::unique_ptr<Interface> iface{new Console}; +std::unique_ptr<Logger> iface{new ConsoleLogger}; std::unique_ptr<Filter> filter{new Filter}; /* @@ -145,96 +145,96 @@ } // !namespace /* - * Console + * ConsoleLogger * ------------------------------------------------------------------ */ -void Console::info(const std::string &line) +void ConsoleLogger::info(const std::string &line) { std::cout << line << std::endl; } -void Console::warning(const std::string &line) +void ConsoleLogger::warning(const std::string &line) { std::cerr << line << std::endl; } -void Console::debug(const std::string &line) +void ConsoleLogger::debug(const std::string &line) { std::cout << line << std::endl; } /* - * File + * FileLogger * ------------------------------------------------------------------ */ -File::File(std::string normal, std::string errors) +FileLogger::FileLogger(std::string normal, std::string errors) : m_outputNormal(std::move(normal)) , m_outputError(std::move(errors)) { } -void File::info(const std::string &line) +void FileLogger::info(const std::string &line) { std::ofstream(m_outputNormal, std::ofstream::out | std::ofstream::app) << line << std::endl; } -void File::warning(const std::string &line) +void FileLogger::warning(const std::string &line) { std::ofstream(m_outputError, std::ofstream::out | std::ofstream::app) << line << std::endl; } -void File::debug(const std::string &line) +void FileLogger::debug(const std::string &line) { std::ofstream(m_outputNormal, std::ofstream::out | std::ofstream::app) << line << std::endl; } /* - * Silent + * SilentLogger * ------------------------------------------------------------------ */ -void Silent::info(const std::string &) +void SilentLogger::info(const std::string &) { } -void Silent::warning(const std::string &) +void SilentLogger::warning(const std::string &) { } -void Silent::debug(const std::string &) +void SilentLogger::debug(const std::string &) { } /* - * Syslog + * SyslogLogger * ------------------------------------------------------------------ */ #if defined(HAVE_SYSLOG) -Syslog::Syslog() +SyslogLogger::SyslogLogger() { openlog(sys::programName().c_str(), LOG_PID, LOG_DAEMON); } -Syslog::~Syslog() +SyslogLogger::~SyslogLogger() { closelog(); } -void Syslog::info(const std::string &line) +void SyslogLogger::info(const std::string &line) { syslog(LOG_INFO | LOG_USER, "%s", line.c_str()); } -void Syslog::warning(const std::string &line) +void SyslogLogger::warning(const std::string &line) { syslog(LOG_WARNING | LOG_USER, "%s", line.c_str()); } -void Syslog::debug(const std::string &line) +void SyslogLogger::debug(const std::string &line) { syslog(LOG_DEBUG | LOG_USER, "%s", line.c_str()); } @@ -246,7 +246,7 @@ * ------------------------------------------------------------------ */ -void setInterface(std::unique_ptr<Interface> newiface) noexcept +void setLogger(std::unique_ptr<Logger> newiface) noexcept { assert(newiface);
--- a/lib/irccd/logger.hpp Thu Sep 08 13:11:10 2016 +0200 +++ b/lib/irccd/logger.hpp Mon Sep 12 17:54:27 2016 +0200 @@ -35,31 +35,31 @@ namespace log { /* - * Interface -- abstract logging interface + * Logger -- abstract logging interface * ------------------------------------------------------------------ */ /** * \brief Interface to implement new logger mechanisms. * - * Derive from this class and use log::setInterface() to change logging system. + * Derive from this class and use log::setLogger() to change logging system. * * \see File * \see Console * \see Syslog * \see Silent */ -class Interface { +class Logger { public: /** * Default constructor. */ - Interface() = default; + Logger() = default; /** * Virtual destructor defaulted. */ - virtual ~Interface() = default; + virtual ~Logger() = default; /** * Write a debug message. @@ -157,20 +157,22 @@ * \brief Logger implementation for console output using std::cout and * std::cerr. */ -class Console : public Interface { +class ConsoleLogger : public Logger { public: + IRCCD_EXPORT ConsoleLogger() = default; + /** - * \copydoc Interface::debug + * \copydoc Logger::debug */ IRCCD_EXPORT void debug(const std::string &line) override; /** - * \copydoc Interface::info + * \copydoc Logger::info */ IRCCD_EXPORT void info(const std::string &line) override; /** - * \copydoc Interface::warning + * \copydoc Logger::warning */ IRCCD_EXPORT void warning(const std::string &line) override; }; @@ -183,7 +185,7 @@ /** * \brief Output to a files. */ -class File : public Interface { +class FileLogger : public Logger { private: std::string m_outputNormal; std::string m_outputError; @@ -195,20 +197,20 @@ * \param normal the path to the normal logs * \param errors the path to the errors logs */ - IRCCD_EXPORT File(std::string normal, std::string errors); + IRCCD_EXPORT FileLogger(std::string normal, std::string errors); /** - * \copydoc Interface::debug + * \copydoc Logger::debug */ IRCCD_EXPORT void debug(const std::string &line) override; /** - * \copydoc Interface::info + * \copydoc Logger::info */ IRCCD_EXPORT void info(const std::string &line) override; /** - * \copydoc Interface::warning + * \copydoc Logger::warning */ IRCCD_EXPORT void warning(const std::string &line) override; }; @@ -223,20 +225,22 @@ * * Useful for unit tests when some classes may emits log. */ -class Silent : public Interface { +class SilentLogger : public Logger { public: + IRCCD_EXPORT SilentLogger() = default; + /** - * \copydoc Interface::debug + * \copydoc Logger::debug */ IRCCD_EXPORT void debug(const std::string &line) override; /** - * \copydoc Interface::info + * \copydoc Logger::info */ IRCCD_EXPORT void info(const std::string &line) override; /** - * \copydoc Interface::warning + * \copydoc Logger::warning */ IRCCD_EXPORT void warning(const std::string &line) override; }; @@ -251,30 +255,30 @@ /** * \brief Implements logger into syslog. */ -class Syslog : public Interface { +class SyslogLogger : public Logger { public: /** * Open the syslog. */ - IRCCD_EXPORT Syslog(); + IRCCD_EXPORT SyslogLogger(); /** * Close the syslog. */ - IRCCD_EXPORT ~Syslog(); + IRCCD_EXPORT ~SyslogLogger(); /** - * \copydoc Interface::debug + * \copydoc Logger::debug */ IRCCD_EXPORT void debug(const std::string &line) override; /** - * \copydoc Interface::info + * \copydoc Logger::info */ IRCCD_EXPORT void info(const std::string &line) override; /** - * \copydoc Interface::warning + * \copydoc Logger::warning */ IRCCD_EXPORT void warning(const std::string &line) override; }; @@ -292,7 +296,7 @@ * \pre iface must not be null * \param iface the new interface */ -IRCCD_EXPORT void setInterface(std::unique_ptr<Interface> iface) noexcept; +IRCCD_EXPORT void setLogger(std::unique_ptr<Logger> iface) noexcept; /** * Set an optional filter.
--- a/lib/irccd/options.hpp Thu Sep 08 13:11:10 2016 +0200 +++ b/lib/irccd/options.hpp Mon Sep 12 17:54:27 2016 +0200 @@ -30,6 +30,8 @@ #include <utility> #include <vector> +#include "sysconfig.hpp" + namespace irccd { /** @@ -132,7 +134,7 @@ * \throw MissingValue * \throw InvalidOption */ -Result read(std::vector<std::string> &args, const Options &definition); +IRCCD_EXPORT Result read(std::vector<std::string> &args, const Options &definition); /** * Overloaded function for usage with main() arguments. @@ -145,7 +147,7 @@ * \throw MissingValue * \throw InvalidOption */ -Result read(int &argc, char **&argv, const Options &definition); +IRCCD_EXPORT Result read(int &argc, char **&argv, const Options &definition); } // !option
--- a/lib/irccd/path.cpp Thu Sep 08 13:11:10 2016 +0200 +++ b/lib/irccd/path.cpp Mon Sep 12 17:54:27 2016 +0200 @@ -24,8 +24,8 @@ #include "sysconfig.hpp" #if defined(IRCCD_SYSTEM_WINDOWS) -# include <Windows.h> -# include <Shlobj.h> +# include <windows.h> +# include <shlobj.h> #else # if defined(IRCCD_SYSTEM_LINUX) # include <limits.h>
--- a/lib/irccd/system.cpp Thu Sep 08 13:11:10 2016 +0200 +++ b/lib/irccd/system.cpp Mon Sep 12 17:54:27 2016 +0200 @@ -29,8 +29,8 @@ #if defined(IRCCD_SYSTEM_WINDOWS) # include <sys/types.h> # include <sys/timeb.h> -# include <Windows.h> -# include <Shlobj.h> +# include <windows.h> +# include <shlobj.h> #else // All non Windows #if defined(IRCCD_SYSTEM_MAC) # include <sys/sysctl.h>
--- a/plugins/CMakeLists.txt Thu Sep 08 13:11:10 2016 +0200 +++ b/plugins/CMakeLists.txt Mon Sep 12 17:54:27 2016 +0200 @@ -39,9 +39,8 @@ # 2. Build documentation. if (WITH_HTML) set(basedocdir ${IRCCD_FAKEROOTDIR}/${WITH_DOCDIR}) + file(RELATIVE_PATH baseurl ${basedocdir}/plugin ${basedocdir}) - file(RELATIVE_PATH baseurl ${basedocdir}/plugin ${basedocdir}) - pandoc( OUTPUT ${basedocdir}/plugin/${plugin}.html SOURCES ${plugin}/${plugin}.md @@ -54,9 +53,16 @@ FROM markdown TO html5 STANTALONE MAKE_DIRECTORY TOC ) - + list(APPEND outputs ${basedocdir}/plugin/${plugin}.html) - install(FILES ${basedocdir}/plugin/${plugin}.html DESTINATION ${WITH_DOCDIR}/plugin) + install( + FILES ${basedocdir}/plugin/${plugin}.html + COMPONENT ${plugin} + DESTINATION ${WITH_DOCDIR}/plugin + ) + string(TOUPPER ${plugin} CMP) + setg(CPACK_COMPONENT_${CMP}_DESCRIPTION "Install ${plugin}.") + setg(CPACK_COMPONENT_${CMP}_GROUP "Plugins") endif () add_custom_target(
--- a/tests/js-logger/main.cpp Thu Sep 08 13:11:10 2016 +0200 +++ b/tests/js-logger/main.cpp Mon Sep 12 17:54:27 2016 +0200 @@ -36,7 +36,7 @@ } // !namespace -class LoggerIfaceTest : public log::Interface { +class LoggerIfaceTest : public log::Logger { public: void info(const std::string &line) override { @@ -113,7 +113,7 @@ testing::InitGoogleTest(&argc, argv); log::setVerbose(true); - log::setInterface(std::make_unique<LoggerIfaceTest>()); + log::setLogger(std::make_unique<LoggerIfaceTest>()); return RUN_ALL_TESTS(); }
--- a/tests/js-timer/main.cpp Thu Sep 08 13:11:10 2016 +0200 +++ b/tests/js-timer/main.cpp Mon Sep 12 17:54:27 2016 +0200 @@ -95,7 +95,7 @@ // Needed for some components. sys::setProgramName("irccd"); path::setApplicationPath(argv[0]); - log::setInterface(std::make_unique<log::Silent>()); + log::setLogger(std::make_unique<log::SilentLogger>()); log::setVerbose(true); testing::InitGoogleTest(&argc, argv);
--- a/tests/logger/main.cpp Thu Sep 08 13:11:10 2016 +0200 +++ b/tests/logger/main.cpp Mon Sep 12 17:54:27 2016 +0200 @@ -32,7 +32,7 @@ } // !namespace -class MyInterface : public log::Interface { +class MyInterface : public log::Logger { public: void debug(const std::string &line) override { @@ -96,7 +96,7 @@ int main(int argc, char **argv) { log::setVerbose(true); - log::setInterface(std::make_unique<MyInterface>()); + log::setLogger(std::make_unique<MyInterface>()); log::setFilter(std::make_unique<MyFilter>()); testing::InitGoogleTest(&argc, argv);
--- a/tests/path/main.cpp Thu Sep 08 13:11:10 2016 +0200 +++ b/tests/path/main.cpp Mon Sep 12 17:54:27 2016 +0200 @@ -129,7 +129,6 @@ * Just show everything for test purpose. */ path::setApplicationPath(argv[0]); - log::setInterface(std::make_unique<log::Console>()); log::debug() << "System paths:" << std::endl; log::debug() << " config(system): " << path::get(path::PathConfig, path::OwnerSystem) << std::endl; log::debug() << " data(system): " << path::get(path::PathData, path::OwnerSystem) << std::endl;
--- a/tests/plugin-logger/main.cpp Thu Sep 08 13:11:10 2016 +0200 +++ b/tests/plugin-logger/main.cpp Mon Sep 12 17:54:27 2016 +0200 @@ -187,7 +187,7 @@ { path::setApplicationPath(argv[0]); testing::InitGoogleTest(&argc, argv); - log::setInterface(std::make_unique<log::Silent>()); + log::setLogger(std::make_unique<log::SilentLogger>()); return RUN_ALL_TESTS(); }
--- a/tests/plugin-plugin/main.cpp Thu Sep 08 13:11:10 2016 +0200 +++ b/tests/plugin-plugin/main.cpp Mon Sep 12 17:54:27 2016 +0200 @@ -127,7 +127,7 @@ { path::setApplicationPath(argv[0]); testing::InitGoogleTest(&argc, argv); - log::setInterface(std::make_unique<log::Silent>()); + log::setLogger(std::make_unique<log::SilentLogger>()); return RUN_ALL_TESTS(); }