mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-25 02:36:10 +03:00
Refactor CMake build scripts
1. Use FeatureSummary module to show configuration results. 2. Invert option()/find_package() relationship: instead of calling find_package(... REQUIRED) when option is set, rely on optional find package call and PackageName_FOUND variable. 3. Refactor handling options that result in simple preprocessor defines (actually copy the snippet from libtorrent) so that everything is done in a single function call. 4. Populate target properties in order to get rid of include_directories() calls.
This commit is contained in:
parent
658702dcbb
commit
fa770871e9
20 changed files with 313 additions and 353 deletions
|
@ -166,7 +166,10 @@ script:
|
|||
if [ "$build_system" = "cmake" ]; then
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DGUI=${gui} -DCMAKE_INSTALL_PREFIX="$qbt_path" "$MY_CMAKE_OPENSSL_HINT" \
|
||||
if [ "$gui" = "false" ]; then
|
||||
DISABLE_GUI_OPTION="-DCMAKE_DISABLE_FIND_PACKAGE_Qt5Widgets=ON"
|
||||
fi
|
||||
cmake $DISABLE_GUI_OPTION -DCMAKE_INSTALL_PREFIX="$qbt_path" "$MY_CMAKE_OPENSSL_HINT" \
|
||||
-G "Ninja" -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE ..
|
||||
BUILD_TOOL="ninja"
|
||||
fi
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
cmake_minimum_required(VERSION 3.5)
|
||||
cmake_policy(VERSION 3.5)
|
||||
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
|
||||
|
||||
message(WARNING "No official support for cmake build system. If it is broken, please submit patches!")
|
||||
|
||||
|
@ -27,32 +26,29 @@ add_definitions(-DQBT_VERSION_BUILD=${VER_BUILD})
|
|||
add_definitions(-DQBT_VERSION="v${PROJECT_VERSION}")
|
||||
add_definitions(-DQBT_VERSION_2="${PROJECT_VERSION}")
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
include(GNUInstallDirs)
|
||||
endif (UNIX AND NOT APPLE)
|
||||
include(GNUInstallDirs)
|
||||
include(FeatureSummary)
|
||||
|
||||
# version requirements
|
||||
set(requiredBoostVersion 1.35)
|
||||
set(requiredQtVersion 5.5.1)
|
||||
|
||||
if(WIN32)
|
||||
include(winconf)
|
||||
endif(WIN32)
|
||||
|
||||
# we need options here, because they are used not only in "src" subdir, but in the "dist" dir too
|
||||
include(CMakeDependentOption)
|
||||
|
||||
option(SYSTEM_QTSINGLEAPPLICATION
|
||||
"Use the system qtsingleapplication library or shipped one otherwise")
|
||||
|
||||
option(GUI "Allows to disable GUI for headless running. Disables QtDBus and the GeoIP Database" ON)
|
||||
|
||||
option(WEBUI "Allows to disable the WebUI." ON)
|
||||
|
||||
option(STACKTRACE "Enable stacktrace feature" ON)
|
||||
|
||||
if (UNIX)
|
||||
cmake_dependent_option(SYSTEMD "Install the systemd service file (headless only)" OFF
|
||||
"NOT GUI" OFF)
|
||||
cmake_dependent_option(DBUS "Enable use of QtDBus (GUI only)" ON "GUI" OFF)
|
||||
endif(UNIX)
|
||||
# we need options here, at the top level, because they are used not only in "src" subdir, but in the "dist" dir too
|
||||
include(CompileFeature)
|
||||
|
||||
optional_compile_definitions(COUNTRIES_RESOLUTION FEATURE DESCRIPTION "Enable resolving peers IP addresses to countries"
|
||||
DEFAULT ON DISABLED DISABLE_COUNTRIES_RESOLUTION)
|
||||
optional_compile_definitions(STACKTRACE FEATURE DESCRIPTION "Enable stacktraces"
|
||||
DEFAULT ON ENABLED STACKTRACE)
|
||||
optional_compile_definitions(WEBUI FEATURE DESCRIPTION "Enables built-in HTTP server for headless use"
|
||||
DEFAULT ON DISABLED DISABLE_WEBUI)
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(dist)
|
||||
|
||||
feature_summary(DESCRIPTION "\nConfiguration results:" WHAT ALL)
|
||||
|
|
22
cmake/Modules/CompileFeature.cmake
Normal file
22
cmake/Modules/CompileFeature.cmake
Normal file
|
@ -0,0 +1,22 @@
|
|||
# Helper function for coupling add_feature_info(), option(), and add_definitions()
|
||||
|
||||
function(optional_compile_definitions _name)
|
||||
set(options FEATURE)
|
||||
set(oneValueArgs DESCRIPTION DEFAULT)
|
||||
set(multiValueArgs ENABLED DISABLED)
|
||||
cmake_parse_arguments(OCD "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
option(${_name} "${OCD_DESCRIPTION}" ${OCD_DEFAULT})
|
||||
if (${${_name}})
|
||||
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND PROPERTY COMPILE_DEFINITIONS ${OCD_ENABLED})
|
||||
else()
|
||||
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND PROPERTY COMPILE_DEFINITIONS ${OCD_DISABLED})
|
||||
endif()
|
||||
if(${OCD_FEATURE})
|
||||
add_feature_info(${_name} ${_name} "${OCD_DESCRIPTION}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
macro(feature_option _name _description _default)
|
||||
option(${_name} "${_description}" ${_default})
|
||||
add_feature_info(${_name} ${_name} "${_description}")
|
||||
endmacro()
|
|
@ -99,6 +99,7 @@ list(FIND LibtorrentRasterbar_DEFINITIONS -DTORRENT_USE_OPENSSL LibtorrentRaster
|
|||
if(LibtorrentRasterbar_ENCRYPTION_INDEX GREATER -1)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
set(LibtorrentRasterbar_LIBRARIES ${LibtorrentRasterbar_LIBRARIES} OpenSSL::SSL OpenSSL::Crypto)
|
||||
list(APPEND LibtorrentRasterbar_INCLUDE_DIRS "${OPENSSL_INCLUDE_DIR}")
|
||||
set(LibtorrentRasterbar_OPENSSL_ENABLED ON)
|
||||
endif()
|
||||
|
||||
|
@ -113,10 +114,10 @@ mark_as_advanced(LibtorrentRasterbar_INCLUDE_DIR LibtorrentRasterbar_LIBRARY
|
|||
LibtorrentRasterbar_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES
|
||||
LibtorrentRasterbar_ENCRYPTION_INDEX)
|
||||
|
||||
if (LibtorrentRasterbar_FOUND AND NOT TARGET LibtorrentRasterbar::LibTorrent)
|
||||
add_library(LibtorrentRasterbar::LibTorrent UNKNOWN IMPORTED)
|
||||
if (LibtorrentRasterbar_FOUND AND NOT TARGET LibtorrentRasterbar::torrent-rasterbar)
|
||||
add_library(LibtorrentRasterbar::torrent-rasterbar UNKNOWN IMPORTED)
|
||||
|
||||
set_target_properties(LibtorrentRasterbar::LibTorrent PROPERTIES
|
||||
set_target_properties(LibtorrentRasterbar::torrent-rasterbar PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
||||
IMPORTED_LOCATION "${LibtorrentRasterbar_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${LibtorrentRasterbar_INCLUDE_DIRS}"
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
# - Try to find the QtSingleApplication includes and library
|
||||
# which defines
|
||||
#
|
||||
# QTSINGLEAPPLICATION_FOUND - system has QtSingleApplication
|
||||
# QTSINGLEAPPLICATION_INCLUDE_DIR - where to find header QtSingleApplication
|
||||
# QTSINGLEAPPLICATION_LIBRARIES - the libraries to link against to use QtSingleApplication
|
||||
# QTSINGLEAPPLICATION_LIBRARY - where to find the QtSingleApplication library (not for general use)
|
||||
# QtSingleApplication_FOUND - system has QtSingleApplication
|
||||
# QtSingleApplication_INCLUDE_DIR - where to find header QtSingleApplication
|
||||
# QtSingleApplication_LIBRARIES - the libraries to link against to use QtSingleApplication
|
||||
# QtSingleApplication_LIBRARY - where to find the QtSingleApplication library (not for general use)
|
||||
|
||||
# copyright (c) 2013 TI_Eugene ti.eugene@gmail.com
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the FreeBSD license.
|
||||
|
||||
SET(QTSINGLEAPPLICATION_FOUND FALSE)
|
||||
SET(QtSingleApplication_FOUND FALSE)
|
||||
|
||||
IF(QT4_FOUND)
|
||||
message(STATUS "Looking for Qt4 single application library")
|
||||
FIND_PATH(QTSINGLEAPPLICATION_INCLUDE_DIR QtSingleApplication
|
||||
FIND_PATH(QtSingleApplication_INCLUDE_DIR QtSingleApplication
|
||||
# standard locations
|
||||
/usr/include
|
||||
/usr/include/QtSolutions
|
||||
|
@ -24,71 +24,71 @@ IF(QT4_FOUND)
|
|||
${FRAMEWORK_INCLUDE_DIR}/QtSolutions
|
||||
)
|
||||
|
||||
SET(QTSINGLEAPPLICATION_NAMES ${QTSINGLEAPPLICATION_NAMES}
|
||||
SET(QtSingleApplication_NAMES ${QtSingleApplication_NAMES}
|
||||
QtSolutions_SingleApplication-2.6 libQtSolutions_SingleApplication-2.6)
|
||||
FIND_LIBRARY(QTSINGLEAPPLICATION_LIBRARY
|
||||
NAMES ${QTSINGLEAPPLICATION_NAMES}
|
||||
FIND_LIBRARY(QtSingleApplication_LIBRARY
|
||||
NAMES ${QtSingleApplication_NAMES}
|
||||
PATHS ${QT_LIBRARY_DIR}
|
||||
)
|
||||
ELSEIF(Qt5Core_FOUND)
|
||||
message(STATUS "Looking for Qt5 single application library")
|
||||
FOREACH(TOP_INCLUDE_PATH in ${Qt5Core_INCLUDE_DIRS} ${FRAMEWORK_INCLUDE_DIR})
|
||||
FIND_PATH(QTSINGLEAPPLICATION_INCLUDE_DIR QtSingleApplication ${TOP_INCLUDE_PATH}/QtSolutions)
|
||||
FIND_PATH(QtSingleApplication_INCLUDE_DIR QtSingleApplication ${TOP_INCLUDE_PATH}/QtSolutions)
|
||||
|
||||
IF(QTSINGLEAPPLICATION_INCLUDE_DIR)
|
||||
IF(QtSingleApplication_INCLUDE_DIR)
|
||||
BREAK()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
|
||||
SET(QTSINGLEAPPLICATION_NAMES ${QTSINGLEAPPLICATION_NAMES}
|
||||
SET(QtSingleApplication_NAMES ${QtSingleApplication_NAMES}
|
||||
Qt5Solutions_SingleApplication-2.6 libQt5Solutions_SingleApplication-2.6
|
||||
QtSolutions_SingleApplication-2.6 libQtSolutions_SingleApplication-2.6)
|
||||
GET_TARGET_PROPERTY(_QT5_CORELIBRARY Qt5::Core LOCATION)
|
||||
GET_FILENAME_COMPONENT(_QT5_CORELIBRARYPATH ${_QT5_CORELIBRARY} PATH)
|
||||
|
||||
FIND_LIBRARY(QTSINGLEAPPLICATION_LIBRARY
|
||||
NAMES ${QTSINGLEAPPLICATION_NAMES}
|
||||
FIND_LIBRARY(QtSingleApplication_LIBRARY
|
||||
NAMES ${QtSingleApplication_NAMES}
|
||||
PATHS ${_QT5_CORELIBRARYPATH}
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
IF (QTSINGLEAPPLICATION_LIBRARY AND QTSINGLEAPPLICATION_INCLUDE_DIR)
|
||||
IF (QtSingleApplication_LIBRARY AND QtSingleApplication_INCLUDE_DIR)
|
||||
|
||||
SET(QTSINGLEAPPLICATION_LIBRARIES ${QTSINGLEAPPLICATION_LIBRARY})
|
||||
SET(QTSINGLEAPPLICATION_FOUND TRUE)
|
||||
SET(QtSingleApplication_LIBRARIES ${QtSingleApplication_LIBRARY})
|
||||
SET(QtSingleApplication_FOUND TRUE)
|
||||
|
||||
IF (CYGWIN)
|
||||
IF(BUILD_SHARED_LIBS)
|
||||
# No need to define QTSINGLEAPPLICATION_USE_DLL here, because it's default for Cygwin.
|
||||
# No need to define QtSingleApplication_USE_DLL here, because it's default for Cygwin.
|
||||
ELSE(BUILD_SHARED_LIBS)
|
||||
SET (QTSINGLEAPPLICATION_DEFINITIONS -DQTSINGLEAPPLICATION_STATIC)
|
||||
SET (QtSingleApplication_DEFINITIONS -DQTSINGLEAPPLICATION_STATIC)
|
||||
ENDIF(BUILD_SHARED_LIBS)
|
||||
ENDIF (CYGWIN)
|
||||
|
||||
ENDIF (QTSINGLEAPPLICATION_LIBRARY AND QTSINGLEAPPLICATION_INCLUDE_DIR)
|
||||
ENDIF (QtSingleApplication_LIBRARY AND QtSingleApplication_INCLUDE_DIR)
|
||||
|
||||
IF (QTSINGLEAPPLICATION_FOUND)
|
||||
IF (QtSingleApplication_FOUND)
|
||||
IF (NOT QtSingleApplication_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found QtSingleApplication: ${QTSINGLEAPPLICATION_LIBRARY}")
|
||||
MESSAGE(STATUS " includes: ${QTSINGLEAPPLICATION_INCLUDE_DIR}")
|
||||
MESSAGE(STATUS "Found QtSingleApplication: ${QtSingleApplication_LIBRARY}")
|
||||
MESSAGE(STATUS " includes: ${QtSingleApplication_INCLUDE_DIR}")
|
||||
ENDIF (NOT QtSingleApplication_FIND_QUIETLY)
|
||||
ELSE (QTSINGLEAPPLICATION_FOUND)
|
||||
if(NOT TARGET QtSingleApplication::QtSingleApplication)
|
||||
add_library(QtSingleApplication::QtSingleApplication UNKNOWN IMPORTED)
|
||||
set_target_properties(QtSingleApplication::QtSingleApplication PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${QtSingleApplication_INCLUDE_DIR}"
|
||||
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${QtSingleApplication_INCLUDE_DIR}"
|
||||
)
|
||||
if(EXISTS "${QtSingleApplication_LIBRARY}")
|
||||
set_target_properties(QtSingleApplication::QtSingleApplication PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
||||
IMPORTED_LOCATION "${QtSingleApplication_LIBRARY}")
|
||||
endif()
|
||||
endif(NOT TARGET QtSingleApplication::QtSingleApplication)
|
||||
|
||||
ELSE (QtSingleApplication_FOUND)
|
||||
IF (QtSingleApplication_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find QtSingleApplication library")
|
||||
ENDIF (QtSingleApplication_FIND_REQUIRED)
|
||||
ENDIF (QTSINGLEAPPLICATION_FOUND)
|
||||
ENDIF (QtSingleApplication_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(QTSINGLEAPPLICATION_INCLUDE_DIR QTSINGLEAPPLICATION_LIBRARY)
|
||||
|
||||
if(NOT TARGET QtSingleApplication::QtSingleApplication)
|
||||
add_library(QtSingleApplication::QtSingleApplication UNKNOWN IMPORTED)
|
||||
set_target_properties(QtSingleApplication::QtSingleApplication PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${QTSINGLEAPPLICATION_INCLUDE_DIR}"
|
||||
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${QTSINGLEAPPLICATION_INCLUDE_DIR}"
|
||||
)
|
||||
if(EXISTS "${QTSINGLEAPPLICATION_LIBRARY}")
|
||||
set_target_properties(QtSingleApplication::QtSingleApplication PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
||||
IMPORTED_LOCATION "${QTSINGLEAPPLICATION_LIBRARY}")
|
||||
endif()
|
||||
endif(NOT TARGET QtSingleApplication::QtSingleApplication)
|
||||
MARK_AS_ADVANCED(QtSingleApplication_INCLUDE_DIR QtSingleApplication_LIBRARY)
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
# a helper function which appends source to the main qBt target
|
||||
# sources file names are relative to the the ${qBittorrent_SOURCE_DIR}
|
||||
# a helper function which appends source to the target
|
||||
# sources file names are relative to the the target source dir
|
||||
|
||||
function (qbt_target_sources)
|
||||
set (_sources_rel "")
|
||||
foreach (_source IN ITEMS ${ARGN})
|
||||
if (IS_ABSOLUTE "${_source}")
|
||||
set(source_abs "${_source}")
|
||||
function (qbt_target_sources _target _scope)
|
||||
get_target_property(targetSourceDir ${_target} SOURCE_DIR)
|
||||
set(sourcesRelative "")
|
||||
foreach(source IN ITEMS ${ARGN})
|
||||
if(IS_ABSOLUTE "${source}")
|
||||
set(sourceAbsolutePath "${source}")
|
||||
else()
|
||||
get_filename_component(_source_abs "${_source}" ABSOLUTE)
|
||||
get_filename_component(sourceAbsolutePath "${source}" ABSOLUTE)
|
||||
endif()
|
||||
file (RELATIVE_PATH _source_rel "${qbt_executable_SOURCE_DIR}" "${_source_abs}")
|
||||
list (APPEND _sources_rel "${_source_rel}")
|
||||
file(RELATIVE_PATH sourceRelativePath "${targetSourceDir}" "${sourceAbsolutePath}")
|
||||
list(APPEND sourcesRelative "${sourceRelativePath}")
|
||||
endforeach()
|
||||
target_sources (qBittorrent PRIVATE "${_sources_rel}")
|
||||
endfunction (qbt_target_sources)
|
||||
target_sources(${_target} ${_scope} "${sourcesRelative}")
|
||||
endfunction(qbt_target_sources)
|
||||
|
|
2
dist/CMakeLists.txt
vendored
2
dist/CMakeLists.txt
vendored
|
@ -1,3 +1,5 @@
|
|||
find_package(Qt5Widgets ${requiredQtVersion}) # to conditionally install desktop-related files
|
||||
|
||||
if (APPLE)
|
||||
add_subdirectory(mac)
|
||||
else (APPLE)
|
||||
|
|
26
dist/unix/CMakeLists.txt
vendored
26
dist/unix/CMakeLists.txt
vendored
|
@ -1,26 +1,32 @@
|
|||
if (SYSTEMD)
|
||||
if (NOT Qt5Widgets_FOUND)
|
||||
feature_option(SYSTEMD "Install systemd service file (headless only)" OFF)
|
||||
if (SYSTEMD)
|
||||
if (NOT Systemd_SERVICES_INSTALL_DIR)
|
||||
find_package(Systemd)
|
||||
if (SYSTEMD_FOUND)
|
||||
if (NOT Systemd_FOUND)
|
||||
message(FATAL_ERROR "Could not locate systemd services install dir."
|
||||
" Either pass -DSystemd_SERVICES_INSTALL_DIR=/path/to/systemd/services option or install systemd pkg-config")
|
||||
endif(NOT Systemd_FOUND)
|
||||
endif(NOT Systemd_SERVICES_INSTALL_DIR)
|
||||
set(EXPAND_BINDIR ${CMAKE_INSTALL_FULL_BINDIR})
|
||||
configure_file(systemd/qbittorrent-nox@.service.in ${CMAKE_CURRENT_BINARY_DIR}/qbittorrent-nox@.service @ONLY)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qbittorrent-nox@.service
|
||||
DESTINATION ${SYSTEMD_SERVICES_INSTALL_DIR}
|
||||
DESTINATION ${Systemd_SERVICES_INSTALL_DIR}
|
||||
COMPONENT data)
|
||||
endif(SYSTEMD_FOUND)
|
||||
endif(SYSTEMD)
|
||||
endif(SYSTEMD)
|
||||
endif()
|
||||
|
||||
|
||||
if (GUI)
|
||||
if (Qt5Widgets_FOUND)
|
||||
list(APPEND MAN_FILES ${qBittorrent_SOURCE_DIR}/doc/qbittorrent.1)
|
||||
else (GUI)
|
||||
else (Qt5Widgets_FOUND)
|
||||
list(APPEND MAN_FILES ${qBittorrent_SOURCE_DIR}/doc/qbittorrent-nox.1)
|
||||
endif (GUI)
|
||||
endif (Qt5Widgets_FOUND)
|
||||
|
||||
install(FILES ${MAN_FILES}
|
||||
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
|
||||
COMPONENT doc)
|
||||
|
||||
if (GUI)
|
||||
if (Qt5Widgets_FOUND)
|
||||
install(DIRECTORY menuicons/
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor
|
||||
FILES_MATCHING PATTERN "*.png")
|
||||
|
|
|
@ -1,40 +1,45 @@
|
|||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
set(CMAKE_CXX_STANDARD "11")
|
||||
add_definitions(-DBOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
|
||||
include(MacroQbtCompilerSettings)
|
||||
qbt_set_compiler_options()
|
||||
|
||||
include(MacroLinkQtComponents)
|
||||
include(QbtTargetSources)
|
||||
|
||||
find_package(Boost ${requiredBoostVersion} REQUIRED)
|
||||
find_package(LibtorrentRasterbar REQUIRED)
|
||||
|
||||
# Qt
|
||||
list(APPEND QBT_QT_COMPONENTS Core Network Xml)
|
||||
if (GUI)
|
||||
list (APPEND QBT_QT_COMPONENTS Gui Svg Widgets)
|
||||
if (WIN32)
|
||||
list (APPEND QBT_QT_COMPONENTS WinExtras)
|
||||
endif(WIN32)
|
||||
if (APPLE)
|
||||
list (APPEND QBT_GUI_OPTIONAL_LINK_LIBRARIES objc)
|
||||
list (APPEND QBT_QT_COMPONENTS MacExtras)
|
||||
endif (APPLE)
|
||||
endif (GUI)
|
||||
if (DBUS)
|
||||
list (APPEND QBT_QT_COMPONENTS DBus)
|
||||
endif (DBUS)
|
||||
find_package(Qt5 5.5.1 COMPONENTS ${QBT_QT_COMPONENTS} REQUIRED)
|
||||
if (Boost_VERSION VERSION_LESS 106000)
|
||||
add_definitions(-DBOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
endif()
|
||||
|
||||
if (GUI AND APPLE)
|
||||
# Fix MOC inability to detect macOS. This seems to only affect cmake.
|
||||
# Relevant issue: https://bugreports.qt.io/browse/QTBUG-58325
|
||||
set(CMAKE_AUTOMOC_MOC_OPTIONS ${CMAKE_AUTOMOC_MOC_OPTIONS} -DQ_OS_MAC)
|
||||
endif ()
|
||||
find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS Core Network Xml)
|
||||
find_package(Qt5Widgets ${requiredQtVersion})
|
||||
if (Qt5Widgets_FOUND)
|
||||
find_package(Qt5DBus ${requiredQtVersion})
|
||||
else()
|
||||
add_definitions(-DDISABLE_GUI)
|
||||
endif()
|
||||
|
||||
set_package_properties(Qt5Widgets PROPERTIES
|
||||
DESCRIPTION "Set of components for creating classic desktop-style UIs for the Qt5 framework"
|
||||
PURPOSE "Enables qBittorrent GUI. Unneeded for headless configuration."
|
||||
TYPE OPTIONAL
|
||||
)
|
||||
|
||||
set_package_properties(Qt5DBus PROPERTIES
|
||||
DESCRIPTION "Qt5 module for inter-process communication over the D-Bus protocol"
|
||||
PURPOSE "Enables communication with other system components (e.g. notification service) via D-Bus. "
|
||||
TYPE RECOMMENDED
|
||||
)
|
||||
|
||||
set(CMAKE_AUTOMOC True)
|
||||
list(APPEND CMAKE_AUTORCC_OPTIONS -compress 9 -threshold 5)
|
||||
if (APPLE)
|
||||
# Workaround CMake bug (autogen does not pass required parameters to moc)
|
||||
# Relevant issue: https://gitlab.kitware.com/cmake/cmake/issues/18041
|
||||
list(APPEND CMAKE_AUTOMOC_MOC_OPTIONS -DQ_OS_MAC -DQ_OS_DARWIN)
|
||||
endif ()
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
|
@ -43,56 +48,34 @@ add_definitions(-DQT_NO_CAST_TO_ASCII)
|
|||
# Efficient construction for QString & QByteArray (Qt >= 4.8)
|
||||
add_definitions(-DQT_USE_QSTRINGBUILDER)
|
||||
|
||||
if (NOT GUI)
|
||||
add_definitions(-DDISABLE_GUI -DDISABLE_COUNTRIES_RESOLUTION)
|
||||
endif (NOT GUI)
|
||||
|
||||
if (NOT WEBUI)
|
||||
add_definitions(-DDISABLE_WEBUI)
|
||||
endif (NOT WEBUI)
|
||||
|
||||
if (STACKTRACE)
|
||||
add_definitions(-DSTACKTRACE)
|
||||
endif(STACKTRACE)
|
||||
# nogui {
|
||||
# TARGET = qbittorrent-nox
|
||||
# } else {
|
||||
# CONFIG(static) {
|
||||
# DEFINES += QBT_STATIC_QT
|
||||
# QTPLUGIN += qico
|
||||
# }
|
||||
# TARGET = qbittorrent
|
||||
# }
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
add_compile_options(-Wformat -Wformat-security)
|
||||
endif ()
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
if (CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||
message(STATUS "Project is built in DEBUG mode.")
|
||||
else (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
else()
|
||||
message(STATUS "Project is built in RELEASE mode.")
|
||||
message(STATUS "Disabling debug output.")
|
||||
add_definitions(-DQT_NO_DEBUG_OUTPUT)
|
||||
endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
|
||||
set(QBT_USE_GUI ${GUI})
|
||||
set(QBT_USE_WEBUI ${WEBUI})
|
||||
endif()
|
||||
|
||||
configure_file(config.h.cmakein ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||
|
||||
if (SYSTEM_QTSINGLEAPPLICATION)
|
||||
find_package(QtSingleApplication REQUIRED)
|
||||
else (SYSTEM_QTSINGLEAPPLICATION)
|
||||
find_package(QtSingleApplication)
|
||||
set_package_properties(QtSingleApplication PROPERTIES
|
||||
URL "https://code.qt.io/cgit/qt-solutions/qt-solutions.git/"
|
||||
DESCRIPTION "Qt library to start applications only once per user"
|
||||
TYPE RECOMMENDED
|
||||
PURPOSE "Use the system qtsingleapplication library or shipped one otherwise"
|
||||
)
|
||||
|
||||
if (NOT QtSingleApplication_FOUND)
|
||||
add_subdirectory(app/qtsingleapplication)
|
||||
endif (SYSTEM_QTSINGLEAPPLICATION)
|
||||
endif ()
|
||||
|
||||
add_subdirectory(app)
|
||||
add_subdirectory(base)
|
||||
|
||||
if (GUI)
|
||||
if (Qt5Widgets_FOUND)
|
||||
add_subdirectory(gui)
|
||||
endif (GUI)
|
||||
endif ()
|
||||
|
||||
if (WEBUI)
|
||||
add_subdirectory(webui)
|
||||
|
|
|
@ -1,19 +1,27 @@
|
|||
project(qbt_executable)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
set(QBT_APP_HEADERS
|
||||
add_executable(qBittorrent
|
||||
application.h
|
||||
cmdoptions.h
|
||||
filelogger.h
|
||||
)
|
||||
|
||||
set(QBT_APP_SOURCES
|
||||
upgrade.h
|
||||
application.cpp
|
||||
cmdoptions.cpp
|
||||
filelogger.cpp
|
||||
main.cpp
|
||||
)
|
||||
|
||||
target_include_directories(qBittorrent PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
target_link_libraries(qBittorrent
|
||||
PRIVATE
|
||||
qbt_base
|
||||
)
|
||||
|
||||
set_target_properties(qBittorrent
|
||||
PROPERTIES
|
||||
AUTOUIC True
|
||||
AUTORCC True
|
||||
MACOSX_BUNDLE True
|
||||
)
|
||||
|
||||
# translations
|
||||
file(GLOB QBT_TS_FILES ../lang/*.ts)
|
||||
get_filename_component(QBT_QM_FILES_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/../lang" ABSOLUTE)
|
||||
|
@ -46,51 +54,41 @@ qt5_add_resources(QBT_APP_RESOURCE_SOURCE ${QBT_APP_RESOURCES})
|
|||
|
||||
if (WIN32)
|
||||
if (MINGW)
|
||||
list (APPEND QBT_APP_SOURCES ../qbittorrent_mingw.rc)
|
||||
target_sources(qBittorrent PRIVATE ../qbittorrent_mingw.rc)
|
||||
else (MINGW)
|
||||
list (APPEND QBT_APP_SOURCES ../qbittorrent.rc)
|
||||
target_sources(qBittorrent PRIVATE ../qbittorrent.rc)
|
||||
endif (MINGW)
|
||||
list(APPEND QBT_APP_SOURCES ../qbittorrent.exe.manifest)
|
||||
target_sources(qBittorrent PRIVATE ../qbittorrent.exe.manifest)
|
||||
endif (WIN32)
|
||||
|
||||
if (STACKTRACE)
|
||||
if (UNIX)
|
||||
list(APPEND QBT_APP_HEADERS stacktrace.h)
|
||||
target_sources(qBittorrent PRIVATE stacktrace.h)
|
||||
else (UNIX)
|
||||
list(APPEND QBT_APP_HEADERS stacktrace_win.h)
|
||||
if (GUI)
|
||||
list(APPEND QBT_APP_HEADERS stacktrace_win_dlg.h)
|
||||
endif (GUI)
|
||||
target_sources(qBittorrent PRIVATE stacktrace_win.h)
|
||||
if (Qt5Widgets_FOUND)
|
||||
target_sources(qBittorrent PRIVATE stacktrace_win_dlg.h)
|
||||
endif (Qt5Widgets_FOUND)
|
||||
endif (UNIX)
|
||||
endif (STACKTRACE)
|
||||
|
||||
# usesystemqtsingleapplication {
|
||||
# nogui {
|
||||
# CONFIG += qtsinglecoreapplication
|
||||
# } else {
|
||||
# CONFIG += qtsingleapplication
|
||||
# }
|
||||
# } else {
|
||||
# nogui {
|
||||
# include(qtsingleapplication/qtsinglecoreapplication.pri)
|
||||
# } else {
|
||||
# include(qtsingleapplication/qtsingleapplication.pri)
|
||||
# }
|
||||
# }
|
||||
|
||||
# upgrade code
|
||||
list(APPEND QBT_APP_HEADERS upgrade.h)
|
||||
list(APPEND QBT_TARGET_LIBRARIES qbt_base)
|
||||
|
||||
if (GUI)
|
||||
list(APPEND QBT_TARGET_LIBRARIES qbt_searchengine qbt_gui)
|
||||
include_directories(../gui
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../gui
|
||||
if (Qt5Widgets_FOUND)
|
||||
target_link_libraries(qBittorrent PRIVATE qbt_searchengine qbt_gui)
|
||||
set_target_properties(qBittorrent
|
||||
PROPERTIES
|
||||
OUTPUT_NAME qbittorrent
|
||||
WIN32_EXECUTABLE True
|
||||
)
|
||||
endif (GUI)
|
||||
else(Qt5Widgets_FOUND)
|
||||
set_target_properties(qBittorrent
|
||||
PROPERTIES
|
||||
OUTPUT_NAME qbittorrent-nox
|
||||
)
|
||||
endif (Qt5Widgets_FOUND)
|
||||
|
||||
if (WEBUI)
|
||||
list(APPEND QBT_TARGET_LIBRARIES qbt_webui)
|
||||
target_link_libraries(qBittorrent PRIVATE qbt_webui)
|
||||
endif (WEBUI)
|
||||
|
||||
# we have to include resources into the bundle
|
||||
|
@ -142,30 +140,11 @@ if (APPLE)
|
|||
PROPERTIES MACOSX_PACKAGE_LOCATION translations)
|
||||
endif (APPLE)
|
||||
|
||||
add_executable(qBittorrent ${QBT_APP_HEADERS} ${QBT_APP_SOURCES} ${QBT_QM_FILES} ${QBT_APP_RESOURCE_SOURCE})
|
||||
if (GUI)
|
||||
set_target_properties(qBittorrent
|
||||
PROPERTIES
|
||||
OUTPUT_NAME qbittorrent
|
||||
WIN32_EXECUTABLE True
|
||||
)
|
||||
else (GUI)
|
||||
set_target_properties(qBittorrent
|
||||
PROPERTIES
|
||||
OUTPUT_NAME qbittorrent-nox
|
||||
)
|
||||
endif (GUI)
|
||||
|
||||
set_target_properties(qBittorrent
|
||||
PROPERTIES
|
||||
AUTOUIC True
|
||||
AUTORCC True
|
||||
MACOSX_BUNDLE True
|
||||
)
|
||||
target_sources(qBittorrent PRIVATE ${QBT_QM_FILES} ${QBT_APP_RESOURCE_SOURCE})
|
||||
|
||||
get_target_property(QBT_EXECUTABLE_NAME qBittorrent OUTPUT_NAME)
|
||||
|
||||
target_link_libraries(qBittorrent ${QBT_TARGET_LIBRARIES} QtSingleApplication::QtSingleApplication)
|
||||
target_link_libraries(qBittorrent PRIVATE ${QBT_TARGET_LIBRARIES} QtSingleApplication::QtSingleApplication)
|
||||
|
||||
if (APPLE)
|
||||
set(qbt_BUNDLE_NAME ${QBT_EXECUTABLE_NAME})
|
||||
|
@ -186,6 +165,7 @@ install(TARGETS qBittorrent
|
|||
BUNDLE DESTINATION .
|
||||
COMPONENT runtime)
|
||||
|
||||
if (GUI AND APPLE)
|
||||
if (Qt5Widgets_FOUND AND APPLE)
|
||||
find_package(Qt5Svg REQUIRED)
|
||||
include(bundle)
|
||||
endif (GUI AND APPLE)
|
||||
endif (Qt5Widgets_FOUND AND APPLE)
|
||||
|
|
|
@ -8,24 +8,24 @@ set(QBT_QTSINGLEAPPLICATION_SOURCES
|
|||
qtlocalpeer.cpp
|
||||
)
|
||||
|
||||
if (GUI)
|
||||
if (Qt5Widgets_FOUND)
|
||||
list(APPEND QBT_QTSINGLEAPPLICATION_HEADERS qtsingleapplication.h)
|
||||
list(APPEND QBT_QTSINGLEAPPLICATION_SOURCES qtsingleapplication.cpp)
|
||||
else (GUI)
|
||||
else (Qt5Widgets_FOUND)
|
||||
list(APPEND QBT_QTSINGLEAPPLICATION_HEADERS qtsinglecoreapplication.h)
|
||||
list(APPEND QBT_QTSINGLEAPPLICATION_SOURCES qtsinglecoreapplication.cpp)
|
||||
endif (GUI)
|
||||
endif (Qt5Widgets_FOUND)
|
||||
|
||||
add_library(qtsingleapplication STATIC ${QBT_QTSINGLEAPPLICATION_HEADERS} ${QBT_QTSINGLEAPPLICATION_SOURCES})
|
||||
target_include_directories(qtsingleapplication INTERFACE "${qtsingleapplication_SOURCE_DIR}")
|
||||
target_link_qt_components(qtsingleapplication Network)
|
||||
target_link_libraries(qtsingleapplication PRIVATE Qt5::Network)
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
target_compile_options(qtsingleapplication PRIVATE "-w") # disable warning for 3rdparty code
|
||||
endif()
|
||||
|
||||
if (GUI)
|
||||
target_link_qt_components(qtsingleapplication Widgets)
|
||||
endif (GUI)
|
||||
if (Qt5Widgets_FOUND)
|
||||
target_link_libraries(qtsingleapplication PRIVATE Qt5::Widgets)
|
||||
endif (Qt5Widgets_FOUND)
|
||||
|
||||
add_library(QtSingleApplication::QtSingleApplication ALIAS qtsingleapplication)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
find_package(ZLIB 1.2.5.2 REQUIRED)
|
||||
|
||||
set(QBT_BASE_HEADERS
|
||||
add_library(qbt_base STATIC
|
||||
bittorrent/addtorrentparams.h
|
||||
bittorrent/cachestatus.h
|
||||
bittorrent/infohash.h
|
||||
|
@ -72,9 +72,6 @@ torrentfilter.h
|
|||
tristatebool.h
|
||||
types.h
|
||||
unicodestrings.h
|
||||
)
|
||||
|
||||
set(QBT_BASE_SOURCES
|
||||
bittorrent/infohash.cpp
|
||||
bittorrent/magneturi.cpp
|
||||
bittorrent/peerinfo.cpp
|
||||
|
@ -137,16 +134,20 @@ torrentfilter.cpp
|
|||
tristatebool.cpp
|
||||
)
|
||||
|
||||
add_library(qbt_base STATIC ${QBT_BASE_HEADERS} ${QBT_BASE_SOURCES})
|
||||
target_link_libraries(qbt_base PRIVATE ZLIB::ZLIB PUBLIC LibtorrentRasterbar::LibTorrent)
|
||||
target_link_qt_components(qbt_base PUBLIC Core Network Xml)
|
||||
target_link_libraries(qbt_base
|
||||
PRIVATE
|
||||
ZLIB::ZLIB
|
||||
PUBLIC
|
||||
LibtorrentRasterbar::torrent-rasterbar
|
||||
Qt5::Core Qt5::Network Qt5::Xml
|
||||
)
|
||||
|
||||
if (GUI)
|
||||
if (Qt5Widgets_FOUND)
|
||||
target_link_libraries(qbt_base PUBLIC Qt5::Gui Qt5::Widgets)
|
||||
endif (GUI)
|
||||
endif (Qt5Widgets_FOUND)
|
||||
|
||||
if (DBUS)
|
||||
target_link_qt_components(qbt_base PRIVATE DBus)
|
||||
if (Qt5DBus_FOUND)
|
||||
target_link_libraries(qbt_base PRIVATE Qt5::DBus)
|
||||
endif ()
|
||||
|
||||
if (APPLE)
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
set(CMAKE_AUTORCC True)
|
||||
set(CMAKE_AUTOUIC True)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
add_library(qbt_gui_headers INTERFACE)
|
||||
target_include_directories(qbt_gui_headers INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
add_subdirectory(lineedit)
|
||||
add_subdirectory(properties)
|
||||
|
@ -9,24 +10,8 @@ add_subdirectory(powermanagement)
|
|||
add_subdirectory(rss)
|
||||
add_subdirectory(search)
|
||||
|
||||
if (UNIX AND NOT APPLE AND DBUS)
|
||||
add_subdirectory(qtnotify)
|
||||
include_directories(qtnotify)
|
||||
list(APPEND QBT_GUI_OPTIONAL_LINK_LIBRARIES qbt_qtnotify)
|
||||
endif (UNIX AND NOT APPLE AND DBUS)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/properties
|
||||
${CMAKE_CURRENT_BINARY_DIR}/rss
|
||||
${CMAKE_CURRENT_BINARY_DIR}/search
|
||||
lineedit/src
|
||||
powermanagement
|
||||
properties
|
||||
rss
|
||||
../app
|
||||
)
|
||||
|
||||
set(QBT_GUI_HEADERS
|
||||
add_library(qbt_gui STATIC
|
||||
# headers
|
||||
about_imp.h
|
||||
addnewtorrentdialog.h
|
||||
advancedsettings.h
|
||||
|
@ -75,9 +60,7 @@ transferlistsortmodel.h
|
|||
transferlistwidget.h
|
||||
updownratiodlg.h
|
||||
utils.h
|
||||
)
|
||||
|
||||
set(QBT_GUI_SOURCES
|
||||
# sources
|
||||
addnewtorrentdialog.cpp
|
||||
advancedsettings.cpp
|
||||
autoexpandabledialog.cpp
|
||||
|
@ -122,19 +105,7 @@ transferlistsortmodel.cpp
|
|||
transferlistwidget.cpp
|
||||
updownratiodlg.cpp
|
||||
utils.cpp
|
||||
)
|
||||
|
||||
if (APPLE)
|
||||
list(APPEND QBT_GUI_HEADERS macutilities.h)
|
||||
list(APPEND QBT_GUI_SOURCES macutilities.mm)
|
||||
endif (APPLE)
|
||||
|
||||
if (WIN32 OR APPLE)
|
||||
list(APPEND QBT_GUI_HEADERS programupdater.h)
|
||||
list(APPEND QBT_GUI_SOURCES programupdater.cpp)
|
||||
endif (WIN32 OR APPLE)
|
||||
|
||||
set(QBT_GUI_FORMS
|
||||
# forms
|
||||
mainwindow.ui
|
||||
about.ui
|
||||
banlistoptions.ui
|
||||
|
@ -156,17 +127,36 @@ torrentcreatordlg.ui
|
|||
shutdownconfirmdlg.ui
|
||||
)
|
||||
|
||||
qbt_target_sources(about.qrc)
|
||||
|
||||
add_library(qbt_gui STATIC ${QBT_GUI_HEADERS} ${QBT_GUI_SOURCES} ${QBT_GUI_FORMS})
|
||||
target_link_libraries(qbt_gui qbt_lineedit qbt_powermanagement qbt_rss qbt_properties qbt_searchengine
|
||||
${QBT_GUI_OPTIONAL_LINK_LIBRARIES} qbt_base
|
||||
target_link_libraries(qbt_gui
|
||||
PRIVATE
|
||||
qbt_lineedit qbt_powermanagement qbt_rss qbt_properties qbt_searchengine
|
||||
qbt_base
|
||||
QtSingleApplication::QtSingleApplication
|
||||
)
|
||||
if(WIN32)
|
||||
target_link_libraries(qbt_gui Qt5::WinExtras)
|
||||
endif(WIN32)
|
||||
|
||||
target_include_directories(qbt_gui
|
||||
PRIVATE ../app
|
||||
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
if (UNIX AND Qt5DBus_FOUND)
|
||||
add_subdirectory(qtnotify)
|
||||
target_link_libraries(qbt_gui PRIVATE qbt_qtnotify)
|
||||
endif (UNIX AND Qt5DBus_FOUND)
|
||||
|
||||
if (APPLE)
|
||||
target_link_libraries(qbt_gui Qt5::MacExtras)
|
||||
endif()
|
||||
target_sources(qbt_gui PRIVATE macutilities.h macutilities.mm)
|
||||
find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS MacExtras)
|
||||
target_link_libraries(qbt_gui PRIVATE Qt5::MacExtras objc)
|
||||
endif (APPLE)
|
||||
|
||||
if (WIN32 OR APPLE)
|
||||
target_sources(qbt_gui PRIVATE programupdater.h programupdater.cpp)
|
||||
endif (WIN32 OR APPLE)
|
||||
|
||||
qbt_target_sources(qBittorrent PRIVATE about.qrc)
|
||||
|
||||
if(WIN32)
|
||||
find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS WinExtras)
|
||||
target_link_libraries(qbt_gui PRIVATE Qt5::WinExtras)
|
||||
endif(WIN32)
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
set(QBT_LINEEDIT_SOURCES
|
||||
add_library(qbt_lineedit STATIC
|
||||
src/lineedit.cpp
|
||||
)
|
||||
|
||||
set(QBT_LINEEDIT_HEADERS
|
||||
src/lineedit.h
|
||||
)
|
||||
|
||||
add_library(qbt_lineedit STATIC ${QBT_LINEEDIT_SOURCES} ${QBT_LINEEDIT_HEADERS})
|
||||
target_link_libraries(qbt_lineedit Qt5::Widgets)
|
||||
target_link_libraries(qbt_lineedit
|
||||
PRIVATE
|
||||
qbt_gui_headers
|
||||
PUBLIC
|
||||
Qt5::Widgets
|
||||
)
|
||||
|
||||
target_include_directories(qbt_lineedit PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
|
|
|
@ -1,25 +1,20 @@
|
|||
set(QBT_POWERMANAGEMENT_HEADERS
|
||||
add_library(qbt_powermanagement STATIC
|
||||
powermanagement.h
|
||||
)
|
||||
|
||||
set(QBT_POWERMANAGEMENT_SOURCES
|
||||
powermanagement.cpp
|
||||
)
|
||||
|
||||
if (UNIX AND DBUS)
|
||||
target_link_libraries(qbt_powermanagement PUBLIC Qt5::Core)
|
||||
set_target_properties(qbt_powermanagement PROPERTIES AUTOUIC False AUTORCC False)
|
||||
target_include_directories(qbt_powermanagement PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
if (UNIX AND Qt5DBus_FOUND)
|
||||
find_package(X11)
|
||||
if (X11_FOUND)
|
||||
list(APPEND QBT_POWERMANAGEMENT_HEADERS powermanagement_x11.h)
|
||||
list(APPEND QBT_POWERMANAGEMENT_SOURCES powermanagement_x11.cpp)
|
||||
target_sources(qbt_powermanagement PRIVATE powermanagement_x11.h powermanagement_x11.cpp)
|
||||
target_link_libraries(qbt_powermanagement PRIVATE Qt5::DBus)
|
||||
endif (X11_FOUND)
|
||||
endif (UNIX AND DBUS)
|
||||
endif (UNIX AND Qt5DBus_FOUND)
|
||||
|
||||
add_library(qbt_powermanagement STATIC ${QBT_POWERMANAGEMENT_SOURCES} ${QBT_POWERMANAGEMENT_HEADERS})
|
||||
set_target_properties(qbt_powermanagement PROPERTIES AUTOUIC False AUTORCC False)
|
||||
target_link_qt_components(qbt_powermanagement Core)
|
||||
if (X11_FOUND)
|
||||
target_link_qt_components(qbt_powermanagement DBus)
|
||||
endif (X11_FOUND)
|
||||
if (WIN32)
|
||||
target_link_libraries(qbt_powermanagement PowrProf)
|
||||
target_link_libraries(qbt_powermanagement PRIVATE PowrProf)
|
||||
endif (WIN32)
|
||||
|
|
|
@ -1,16 +1,7 @@
|
|||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
../lineedit/src/
|
||||
)
|
||||
|
||||
set(QBT_PROPERTIES_FORMS
|
||||
add_library(qbt_properties STATIC
|
||||
propertieswidget.ui
|
||||
trackersadditiondlg.ui
|
||||
peersadditiondlg.ui
|
||||
)
|
||||
|
||||
set(QBT_PROPERTIES_HEADERS
|
||||
propertieswidget.h
|
||||
peerlistwidget.h
|
||||
proplistdelegate.h
|
||||
|
@ -25,9 +16,6 @@ pieceavailabilitybar.h
|
|||
proptabbar.h
|
||||
speedwidget.h
|
||||
speedplotview.h
|
||||
)
|
||||
|
||||
set(QBT_PROPERTIES_SOURCES
|
||||
propertieswidget.cpp
|
||||
proplistdelegate.cpp
|
||||
peerlistwidget.cpp
|
||||
|
@ -42,6 +30,16 @@ speedwidget.cpp
|
|||
speedplotview.cpp
|
||||
)
|
||||
|
||||
add_library(qbt_properties STATIC ${QBT_PROPERTIES_HEADERS} ${QBT_PROPERTIES_SOURCES} ${QBT_PROPERTIES_FORMS})
|
||||
target_link_libraries(qbt_properties qbt_base)
|
||||
target_link_libraries(qbt_properties Qt5::Widgets)
|
||||
target_link_libraries(qbt_properties
|
||||
PRIVATE
|
||||
qbt_gui_headers
|
||||
PUBLIC
|
||||
qbt_base qbt_lineedit Qt5::Widgets
|
||||
)
|
||||
|
||||
target_include_directories(qbt_properties
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
set(QBT_QTNOTIFY_SOURCES
|
||||
add_library(qbt_qtnotify STATIC
|
||||
notifications.cpp
|
||||
)
|
||||
|
||||
set(QBT_QTNOTIFY_HEADERS
|
||||
notifications.h
|
||||
)
|
||||
|
||||
add_library(qbt_qtnotify STATIC ${QBT_QTNOTIFY_SOURCES} ${QBT_QTNOTIFY_HEADERS})
|
||||
set_target_properties(qbt_qtnotify PROPERTIES AUTOUIC False AUTORCC False)
|
||||
target_link_qt_components(qbt_qtnotify DBus)
|
||||
target_link_libraries(qbt_qtnotify PUBLIC Qt5::DBus)
|
||||
target_include_directories(qbt_qtnotify PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
|
|
@ -1,26 +1,22 @@
|
|||
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
set(QBT_RSS_HEADERS
|
||||
add_library(qbt_rss STATIC
|
||||
articlelistwidget.h
|
||||
automatedrssdownloader.h
|
||||
feedlistwidget.h
|
||||
htmlbrowser.h
|
||||
rsswidget.h
|
||||
)
|
||||
|
||||
set(QBT_RSS_SOURCE
|
||||
articlelistwidget.cpp
|
||||
automatedrssdownloader.cpp
|
||||
feedlistwidget.cpp
|
||||
htmlbrowser.cpp
|
||||
rsswidget.cpp
|
||||
)
|
||||
|
||||
set(QBT_RSS_FORMS
|
||||
automatedrssdownloader.ui
|
||||
rsswidget.ui
|
||||
)
|
||||
|
||||
add_library(qbt_rss STATIC ${QBT_RSS_HEADERS} ${QBT_RSS_SOURCE} ${QBT_RSS_FORMS})
|
||||
target_link_libraries(qbt_rss qbt_base)
|
||||
target_link_libraries(qbt_rss Qt5::Gui Qt5::Widgets Qt5::Network)
|
||||
target_include_directories(qbt_rss PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_link_libraries(qbt_rss
|
||||
PRIVATE
|
||||
qbt_gui_headers
|
||||
PUBLIC
|
||||
qbt_base Qt5::Gui Qt5::Widgets Qt5::Network
|
||||
)
|
||||
|
|
|
@ -1,25 +1,13 @@
|
|||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../lineedit/src
|
||||
)
|
||||
|
||||
set(QBT_SEARCHENGINE_FORMS
|
||||
add_library(qbt_searchengine STATIC
|
||||
pluginselectdlg.ui
|
||||
pluginsourcedlg.ui
|
||||
searchwidget.ui
|
||||
)
|
||||
|
||||
set(QBT_SEARCHENGINE_HEADERS
|
||||
pluginselectdlg.h
|
||||
pluginsourcedlg.h
|
||||
searchlistdelegate.h
|
||||
searchsortmodel.h
|
||||
searchtab.h
|
||||
searchwidget.h
|
||||
)
|
||||
|
||||
set(QBT_SEARCHENGINE_SOURCES
|
||||
pluginselectdlg.cpp
|
||||
pluginsourcedlg.cpp
|
||||
searchlistdelegate.cpp
|
||||
|
@ -32,6 +20,9 @@ set(QBT_SEARCHENGINE_RESOURCES
|
|||
# search.qrc
|
||||
)
|
||||
|
||||
add_library(qbt_searchengine STATIC ${QBT_SEARCHENGINE_HEADERS} ${QBT_SEARCHENGINE_SOURCES} ${QBT_SEARCHENGINE_RESOURCES} ${QBT_SEARCHENGINE_FORMS})
|
||||
target_link_libraries(qbt_searchengine qbt_base)
|
||||
|
||||
target_link_libraries(qbt_searchengine
|
||||
PUBLIC
|
||||
qbt_base
|
||||
PRIVATE
|
||||
qbt_lineedit qbt_gui_headers
|
||||
)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
set(QBT_WEBUI_HEADERS
|
||||
add_library(qbt_webui STATIC
|
||||
api/apicontroller.h
|
||||
api/apierror.h
|
||||
api/appcontroller.h
|
||||
|
@ -13,9 +13,6 @@ api/serialize/serialize_torrent.h
|
|||
extra_translations.h
|
||||
webapplication.h
|
||||
webui.h
|
||||
)
|
||||
|
||||
set(QBT_WEBUI_SOURCES
|
||||
api/apicontroller.cpp
|
||||
api/apierror.cpp
|
||||
api/appcontroller.cpp
|
||||
|
@ -30,8 +27,6 @@ webapplication.cpp
|
|||
webui.cpp
|
||||
)
|
||||
|
||||
qbt_target_sources(webui.qrc)
|
||||
|
||||
add_library(qbt_webui STATIC ${QBT_WEBUI_HEADERS} ${QBT_WEBUI_SOURCES})
|
||||
target_link_libraries(qbt_webui qbt_base)
|
||||
qbt_target_sources(qBittorrent PRIVATE webui.qrc)
|
||||
|
||||
target_link_libraries(qbt_webui PUBLIC qbt_base)
|
||||
|
|
Loading…
Reference in a new issue