diff --git a/sources/libraries.cmake b/sources/libraries.cmake index 1330025..1145ac7 100644 --- a/sources/libraries.cmake +++ b/sources/libraries.cmake @@ -1,5 +1,5 @@ # main qt libraries -find_package(Qt5 5.6.0 REQUIRED COMPONENTS Core DBus Sql Test) +find_package(Qt5 5.8.0 REQUIRED COMPONENTS Core DBus Sql Test) add_definitions( ${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS} ${Qt5Sql_DEFINITIONS} ) diff --git a/sources/queued-daemon/CMakeLists.txt b/sources/queued-daemon/CMakeLists.txt index b683ae8..2e464a2 100644 --- a/sources/queued-daemon/CMakeLists.txt +++ b/sources/queued-daemon/CMakeLists.txt @@ -2,6 +2,7 @@ set (SUBPROJECT "queued-daemon") message (STATUS "Subproject ${SUBPROJECT}") +include("adds.cmake") add_subdirectory ("src") # build man file (GLOB SUBPROJECT_MAN_IN "*.1") diff --git a/sources/queued-daemon/QueuedConfig.cmake b/sources/queued-daemon/QueuedConfig.cmake new file mode 100644 index 0000000..db076c8 --- /dev/null +++ b/sources/queued-daemon/QueuedConfig.cmake @@ -0,0 +1,58 @@ +# +# Copyright (c) 2017 Evgeniy Alekseev +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +## +# @file QueuedConfig.cmake +# Additional file of queued library +# @author Evgeniy Alekseev +# @copyright MIT +# @bug https://github.com/arcan1s/queued/issues +## + + +## +# @brief try to find queued libraries +## + +## +# @def QUEUED_DEFINITIONS +# optional cmake definitions +## +set(QUEUED_DEFINITIONS "") +## +# @def QUEUED_INCLUDE_DIRS +# path to root include directory +## +find_path(QUEUEDCORE_INCLUDE_DIR "queued/Queued.h" PATH_SUFFIXES "queued") +set(QUEUED_INCLUDE_DIRS "${QUEUEDCORE_INCLUDE_DIR}") +## +# @def QUEUED_LIBRARIES +# queued library name +## +find_library(QUEUEDCORE_LIBRARY NAMES "queued" "libqueued" + PATH_SUFFIXES "queued") +set(QUEUED_LIBRARIES "${QUEUEDCORE_LIBRARY}") +## +# @def QUEUED_FOUND +# boolean, true if library has been found +## +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Queued DEFAULT_MSG + QUEUED_LIBRARIES QUEUED_INCLUDE_DIRS) + +## +# @brief additional defined macros +## +include("${CMAKE_CURRENT_LIST_DIR}/QueuedPaths.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/QueuedLibraries.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/QueuedMacros.cmake") diff --git a/sources/queued-daemon/QueuedLibraries.cmake b/sources/queued-daemon/QueuedLibraries.cmake new file mode 100644 index 0000000..c33e7ce --- /dev/null +++ b/sources/queued-daemon/QueuedLibraries.cmake @@ -0,0 +1,47 @@ +# +# Copyright (c) 2017 Evgeniy Alekseev +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +## +# @file QueuedLibraries.cmake +# Additional file of queued library +# @author Evgeniy Alekseev +# @copyright MIT +# @bug https://github.com/arcan1s/queued/issues +## + + +## +# @brief Queued common libraries +## + +find_package(Qt5 5.8.0 REQUIRED COMPONENTS Core DBus Sql) +## +# @brief add Qt definitions +## +add_definitions( + ${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS} ${Qt5Sql_DEFINITIONS} +) +## +# @def Qt_INCLUDE +# Qt include paths +## +set(Qt_INCLUDE + ${Qt5Core_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS} ${Qt5Sql_INCLUDE_DIRS} +) +## +# @def Qt_LIBRARIES +# Qt libraries +## +set(Qt_LIBRARIES + ${Qt5Core_LIBRARIES} ${Qt5DBus_LIBRARIES} ${Qt5Sql_LIBRARIES} +) diff --git a/sources/queued-daemon/QueuedMacros.cmake b/sources/queued-daemon/QueuedMacros.cmake new file mode 100644 index 0000000..fca2234 --- /dev/null +++ b/sources/queued-daemon/QueuedMacros.cmake @@ -0,0 +1,60 @@ +# +# Copyright (c) 2017 Evgeniy Alekseev +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +## +# @file QueuedMacros.cmake +# Additional file of queued library +# @author Evgeniy Alekseev +# @copyright MIT +# @bug https://github.com/arcan1s/queued/issues +## + + +## +# @brief additional macros for queued +## + +## +# @fn queued_install_plugin root [name] [libraries] +# @brief build and install plugin +# @param PLUGIN_ROOT plugin root directory +# @param PLUGIN plugin name (optional). Will be assigned from path +# if empty +# @param ADDS_LIBRARIES additional libraries (optional) +# +## +macro(queued_install_plugin PLUGIN_ROOT) + set(PLUGIN "${ARGV1}") + if (NOT PLUGIN) + set(PLUGIN "${PLUGIN_ROOT}") + endif() + set(ADDS_LIBRARIES "${ARGV2}") + message (STATUS "Plugin ${PLUGIN}") + # get sources + file (GLOB_RECURSE ${PLUGIN}_SOURCES "${PLUGIN_ROOT}/*.cpp") + file (GLOB_RECURSE ${PLUGIN}_HEADERS "${PLUGIN_ROOT}/*.h") + qt5_wrap_cpp (${PLUGIN}_MOC_SOURCES "${${PLUGIN}_HEADERS}") + + # include directories + include_directories ("${CMAKE_CURRENT_BINARY_DIR}" + "${Qt_INCLUDE}" + "${QUEUED_INCLUDE_DIRS}") + + # build + add_library ("${PLUGIN}" MODULE "${${PLUGIN}_SOURCES}" "${${PLUGIN}_HEADERS}" + "${${PLUGIN}_MOC_SOURCES}") + target_link_libraries ("${PLUGIN}" "${QUEUED_LIBRARIES}" "${Qt_LIBRARIES}" "${ADDS_LIBRARIES}") + + # install + install (TARGETS "${PLUGIN}" DESTINATION "${QUEUED_PLUGIN_ROOT}") +endmacro() diff --git a/sources/queued-daemon/QueuedPaths.cmake.in b/sources/queued-daemon/QueuedPaths.cmake.in new file mode 100644 index 0000000..4c64e23 --- /dev/null +++ b/sources/queued-daemon/QueuedPaths.cmake.in @@ -0,0 +1,56 @@ +# +# Copyright (c) 2017 Evgeniy Alekseev +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +## +# @file QueuedPaths.cmake +# Additional file of queued library +# @author Evgeniy Alekseev +# @copyright MIT +# @bug https://github.com/arcan1s/queued/issues +## + + +## +# @brief Queued common paths +## + +## +# @def BIN_INSTALL_DIR +# installation directory for executables +## +set(BIN_INSTALL_DIR "@BIN_INSTALL_DIR@") +## +# @def DATA_INSTALL_DIR +# installation directory for data +## +set(DATA_INSTALL_DIR "@DATA_INSTALL_DIR@") +## +# @def INCLUDE_INSTALL_DIR +# installation directory for headers +## +set(INCLUDE_INSTALL_DIR "@INCLUDE_INSTALL_DIR@") +## +# @def LIB_INSTALL_DIR +# installation directory for libraries +## +set(LIB_INSTALL_DIR "@LIB_INSTALL_DIR@") +## +# @def QUEUED_ROOT +# queued root directory +## +set(QUEUED_ROOT "${DATA_INSTALL_DIR}/queued") +## +# @def QUEUED_PLUGIN_ROOT +# queued plugins root directory +## +set(QUEUED_PLUGIN_ROOT "${QUEUED_ROOT}/plugins") diff --git a/sources/queued-daemon/adds.cmake b/sources/queued-daemon/adds.cmake new file mode 100644 index 0000000..fe9c7c0 --- /dev/null +++ b/sources/queued-daemon/adds.cmake @@ -0,0 +1,7 @@ +# configure paths +configure_file ("QueuedPaths.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/QueuedPaths.cmake" @ONLY) +# additional files +install (FILES "QueuedConfig.cmake" DESTINATION "${LIB_INSTALL_DIR}/cmake/Queued") +install (FILES "QueuedLibraries.cmake" DESTINATION "${LIB_INSTALL_DIR}/cmake/Queued") +install (FILES "QueuedMacros.cmake" DESTINATION "${LIB_INSTALL_DIR}/cmake/Queued") +install (FILES "${CMAKE_CURRENT_BINARY_DIR}/QueuedPaths.cmake" DESTINATION "${LIB_INSTALL_DIR}/cmake/Queued") diff --git a/sources/queued/include/queued/QueuedCore.h b/sources/queued/include/queued/QueuedCore.h index 34003aa..d0d94c0 100644 --- a/sources/queued/include/queued/QueuedCore.h +++ b/sources/queued/include/queued/QueuedCore.h @@ -193,8 +193,6 @@ public: * start report date * @param _to * stop report date - * @param _core - * pointer to core object * @param _token * user auth token * @return performance table diff --git a/sources/queued/include/queued/QueuedEnums.h b/sources/queued/include/queued/QueuedEnums.h index 9caf5e2..5fee01e 100644 --- a/sources/queued/include/queued/QueuedEnums.h +++ b/sources/queued/include/queued/QueuedEnums.h @@ -44,8 +44,6 @@ namespace QueuedEnums * administrative permissions * @var Permission::Job * job related permissions - * @var Permission::Web - * web server access * @var Permission::Reports * access to reports */ @@ -54,8 +52,7 @@ enum class Permission { SuperAdmin = 1 << 1, Admin = 1 << 2, Job = 1 << 3, - Web = 1 << 4, - Reports = 1 << 5 + Reports = 1 << 4 }; Q_DECLARE_FLAGS(Permissions, Permission) Q_DECLARE_OPERATORS_FOR_FLAGS(Permissions) @@ -63,7 +60,6 @@ const QHash PermissionMap = { {"superadmin", Permission::SuperAdmin}, {"admin", Permission::Admin}, {"job", Permission::Job}, - {"web", Permission::Web}, {"reports", Permission::Reports}, }; /**