project( desq ) cmake_minimum_required( VERSION 3.8 ) set( PROJECT_VERSION 1.0.0 ) set( PROJECT_VERSION_MAJOR 1 ) set( PROJECT_VERSION_MINOR 0 ) set( PROJECT_VERSION_PATCH 0 ) set( PROJECT_VERSION_MAJOR_MINOR ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} ) add_compile_definitions(PROJECT_VERSION="${PROJECT_VERSION}") set( CMAKE_CXX_STANDARD 17 ) set( CMAKE_INCLUDE_CURRENT_DIR ON ) set( CMAKE_BUILD_TYPE Release ) if ( NOT DEFINED PKGCONFPATH ) message( "-- PKGCONFPATH not specified. Using default value /etc/xdg/desq" ) set( PKGCONFPATH "/etc/xdg/desq" ) endif() if ( NOT DEFINED PKGSHAREDPATH ) message( "-- PKGSHAREDPATH not specified. Using default value \${prefix}/share/desq" ) set( PKGSHAREDPATH "${CMAKE_INSTALL_PREFIX}/share/desq" ) endif() if (NOT (PKGSHAREDPATH MATCHES "^/")) set(PKGSHAREDPATH "${CMAKE_INSTALL_PREFIX}/${PKGSHAREDPATH}") endif() if (PKGSHAREDPATH MATCHES "/$") string(REGEX REPLACE "/$" "" PKGSHAREDPATHNEW ${PKGSHAREDPATH}) set(PKGSHAREDPATH ${PKGSHAREDPATHNEW}) endif() if ( NOT DEFINED APPCONFPATH ) set( APPCONFPATH "${PKGSHAREDPATH}/configs/" ) endif() if ( CMAKE_INSTALL_LIBDIR STREQUAL "" OR NOT DEFINED CMAKE_INSTALL_LIBDIR ) message( "-- CMAKE_INSTALL_LIBDIR not set." ) set( CMAKE_INSTALL_LIBDIR "lib/x86_64-linux-gnu" ) message( "-- Using default value: ${CMAKE_INSTALL_LIBDIR}" ) endif() set( CMAKE_AUTOMOC ON ) set( CMAKE_AUTORCC ON ) set( CMAKE_AUTOUIC ON ) find_package( Qt5Core REQUIRED ) find_package( Qt5Gui REQUIRED ) find_package( Qt5Widgets REQUIRED ) find_package( Qt5Network REQUIRED ) find_package( Qt5DBus REQUIRED ) include_directories( Application includes includes/desq ) # Location of config.h needed by DesQSettings include_directories( ${CMAKE_CURRENT_BINARY_DIR}/core/ ) # Location of libdesq-core.so needed ly libdesq-gui.so link_directories( ${CMAKE_CURRENT_BINARY_DIR} ) ## =============== DesQ Core set( Core_HEADERS includes/desq/Battery.hpp includes/desq/DesQCoreApplication.hpp includes/desq/DesQIpcClient.hpp includes/desq/DesQIpcServer.hpp includes/desq/FSWatcher.hpp includes/desq/NetworkInfo.hpp includes/desq/Power.hpp includes/desq/StorageInfo.hpp includes/desq/SysInfo.hpp includes/desq/DesQUtils.hpp includes/desq/DesQXdg.hpp ) set( Core_SOURCES Application/DesQCoreApplication.cpp IPC/DesQIpcClient.cpp IPC/DesQIpcServer.cpp FSWatcher/FSWatcher.cpp System/Battery.cpp System/NetworkInfo.cpp System/Power.cpp System/StorageInfo.cpp System/SysInfo.cpp Utils/DesQUtils.cpp XDG/DesQXdg.cpp ) add_library( desq-core SHARED ${Core_SOURCES} ${Core_HEADERS} XDG/DesQXdgImpl.cpp XDG/DesQXdgImpl.hpp ) set_target_properties( desq-core PROPERTIES VERSION ${PROJECT_VERSION} ) set_target_properties( desq-core PROPERTIES SOVERSION ${PROJECT_VERSION} ) set_target_properties( desq-core PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR_MINOR} ) set_target_properties( desq-core PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR} ) target_link_libraries( desq-core Qt5::Core Qt5::Network Qt5::DBus ) ## =============== DesQ Gui set( Gui_HEADERS includes/desq/DesQGuiApplication.hpp includes/desq/DesQSettings.hpp ) set( Gui_SOURCES Application/DesQGuiApplication.cpp Settings/DesQSettings.cpp ) add_library( desq-gui SHARED ${Gui_SOURCES} ${Gui_HEADERS} ) set_target_properties( desq-gui PROPERTIES VERSION ${PROJECT_VERSION} ) set_target_properties( desq-gui PROPERTIES SOVERSION ${PROJECT_VERSION} ) set_target_properties( desq-gui PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR_MINOR} ) set_target_properties( desq-gui PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR} ) target_link_libraries( desq-gui Qt5::Core Qt5::Gui Qt5::Network Qt5::DBus Qt5::Widgets desq-core ) configure_file( desq-core.pc.in desq-core.pc @ONLY ) configure_file( desq-gui.pc.in desq-gui.pc @ONLY ) configure_file( config.h.in desq-config.h @ONLY ) install( TARGETS desq-core desq-gui EXPORT LIBRARY ) install( FILES ${Core_HEADERS} ${Gui_HEADERS} DesQGlobals.hpp DESTINATION include/desq/ ) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/desq-config.h DESTINATION include/desq ) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/desq-core.pc DESTINATION share/pkgconfig ) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/desq-gui.pc DESTINATION share/pkgconfig )