mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-08 22:07:53 +00: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
@ -166,7 +166,10 @@ script:
|
|||||||
if [ "$build_system" = "cmake" ]; then
|
if [ "$build_system" = "cmake" ]; then
|
||||||
mkdir build
|
mkdir build
|
||||||
cd 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 ..
|
-G "Ninja" -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE ..
|
||||||
BUILD_TOOL="ninja"
|
BUILD_TOOL="ninja"
|
||||||
fi
|
fi
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
|
||||||
cmake_policy(VERSION 3.5)
|
|
||||||
|
|
||||||
message(WARNING "No official support for cmake build system. If it is broken, please submit patches!")
|
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="v${PROJECT_VERSION}")
|
||||||
add_definitions(-DQBT_VERSION_2="${PROJECT_VERSION}")
|
add_definitions(-DQBT_VERSION_2="${PROJECT_VERSION}")
|
||||||
|
|
||||||
if (UNIX AND NOT APPLE)
|
include(GNUInstallDirs)
|
||||||
include(GNUInstallDirs)
|
include(FeatureSummary)
|
||||||
endif (UNIX AND NOT APPLE)
|
|
||||||
|
# version requirements
|
||||||
|
set(requiredBoostVersion 1.35)
|
||||||
|
set(requiredQtVersion 5.5.1)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
include(winconf)
|
include(winconf)
|
||||||
endif(WIN32)
|
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
|
# we need options here, at the top level, because they are used not only in "src" subdir, but in the "dist" dir too
|
||||||
"Use the system qtsingleapplication library or shipped one otherwise")
|
include(CompileFeature)
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
|
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(src)
|
||||||
add_subdirectory(dist)
|
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)
|
if(LibtorrentRasterbar_ENCRYPTION_INDEX GREATER -1)
|
||||||
find_package(OpenSSL REQUIRED)
|
find_package(OpenSSL REQUIRED)
|
||||||
set(LibtorrentRasterbar_LIBRARIES ${LibtorrentRasterbar_LIBRARIES} OpenSSL::SSL OpenSSL::Crypto)
|
set(LibtorrentRasterbar_LIBRARIES ${LibtorrentRasterbar_LIBRARIES} OpenSSL::SSL OpenSSL::Crypto)
|
||||||
|
list(APPEND LibtorrentRasterbar_INCLUDE_DIRS "${OPENSSL_INCLUDE_DIR}")
|
||||||
set(LibtorrentRasterbar_OPENSSL_ENABLED ON)
|
set(LibtorrentRasterbar_OPENSSL_ENABLED ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -113,10 +114,10 @@ mark_as_advanced(LibtorrentRasterbar_INCLUDE_DIR LibtorrentRasterbar_LIBRARY
|
|||||||
LibtorrentRasterbar_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES
|
LibtorrentRasterbar_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES
|
||||||
LibtorrentRasterbar_ENCRYPTION_INDEX)
|
LibtorrentRasterbar_ENCRYPTION_INDEX)
|
||||||
|
|
||||||
if (LibtorrentRasterbar_FOUND AND NOT TARGET LibtorrentRasterbar::LibTorrent)
|
if (LibtorrentRasterbar_FOUND AND NOT TARGET LibtorrentRasterbar::torrent-rasterbar)
|
||||||
add_library(LibtorrentRasterbar::LibTorrent UNKNOWN IMPORTED)
|
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_LINK_INTERFACE_LANGUAGES "CXX"
|
||||||
IMPORTED_LOCATION "${LibtorrentRasterbar_LIBRARY}"
|
IMPORTED_LOCATION "${LibtorrentRasterbar_LIBRARY}"
|
||||||
INTERFACE_INCLUDE_DIRECTORIES "${LibtorrentRasterbar_INCLUDE_DIRS}"
|
INTERFACE_INCLUDE_DIRECTORIES "${LibtorrentRasterbar_INCLUDE_DIRS}"
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
# - Try to find the QtSingleApplication includes and library
|
# - Try to find the QtSingleApplication includes and library
|
||||||
# which defines
|
# which defines
|
||||||
#
|
#
|
||||||
# QTSINGLEAPPLICATION_FOUND - system has QtSingleApplication
|
# QtSingleApplication_FOUND - system has QtSingleApplication
|
||||||
# QTSINGLEAPPLICATION_INCLUDE_DIR - where to find header QtSingleApplication
|
# QtSingleApplication_INCLUDE_DIR - where to find header QtSingleApplication
|
||||||
# QTSINGLEAPPLICATION_LIBRARIES - the libraries to link against to use QtSingleApplication
|
# QtSingleApplication_LIBRARIES - the libraries to link against to use QtSingleApplication
|
||||||
# QTSINGLEAPPLICATION_LIBRARY - where to find the QtSingleApplication library (not for general use)
|
# QtSingleApplication_LIBRARY - where to find the QtSingleApplication library (not for general use)
|
||||||
|
|
||||||
# copyright (c) 2013 TI_Eugene ti.eugene@gmail.com
|
# copyright (c) 2013 TI_Eugene ti.eugene@gmail.com
|
||||||
#
|
#
|
||||||
# Redistribution and use is allowed according to the terms of the FreeBSD license.
|
# Redistribution and use is allowed according to the terms of the FreeBSD license.
|
||||||
|
|
||||||
SET(QTSINGLEAPPLICATION_FOUND FALSE)
|
SET(QtSingleApplication_FOUND FALSE)
|
||||||
|
|
||||||
IF(QT4_FOUND)
|
IF(QT4_FOUND)
|
||||||
message(STATUS "Looking for Qt4 single application library")
|
message(STATUS "Looking for Qt4 single application library")
|
||||||
FIND_PATH(QTSINGLEAPPLICATION_INCLUDE_DIR QtSingleApplication
|
FIND_PATH(QtSingleApplication_INCLUDE_DIR QtSingleApplication
|
||||||
# standard locations
|
# standard locations
|
||||||
/usr/include
|
/usr/include
|
||||||
/usr/include/QtSolutions
|
/usr/include/QtSolutions
|
||||||
@ -24,71 +24,71 @@ IF(QT4_FOUND)
|
|||||||
${FRAMEWORK_INCLUDE_DIR}/QtSolutions
|
${FRAMEWORK_INCLUDE_DIR}/QtSolutions
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(QTSINGLEAPPLICATION_NAMES ${QTSINGLEAPPLICATION_NAMES}
|
SET(QtSingleApplication_NAMES ${QtSingleApplication_NAMES}
|
||||||
QtSolutions_SingleApplication-2.6 libQtSolutions_SingleApplication-2.6)
|
QtSolutions_SingleApplication-2.6 libQtSolutions_SingleApplication-2.6)
|
||||||
FIND_LIBRARY(QTSINGLEAPPLICATION_LIBRARY
|
FIND_LIBRARY(QtSingleApplication_LIBRARY
|
||||||
NAMES ${QTSINGLEAPPLICATION_NAMES}
|
NAMES ${QtSingleApplication_NAMES}
|
||||||
PATHS ${QT_LIBRARY_DIR}
|
PATHS ${QT_LIBRARY_DIR}
|
||||||
)
|
)
|
||||||
ELSEIF(Qt5Core_FOUND)
|
ELSEIF(Qt5Core_FOUND)
|
||||||
message(STATUS "Looking for Qt5 single application library")
|
message(STATUS "Looking for Qt5 single application library")
|
||||||
FOREACH(TOP_INCLUDE_PATH in ${Qt5Core_INCLUDE_DIRS} ${FRAMEWORK_INCLUDE_DIR})
|
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()
|
BREAK()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDFOREACH()
|
ENDFOREACH()
|
||||||
|
|
||||||
SET(QTSINGLEAPPLICATION_NAMES ${QTSINGLEAPPLICATION_NAMES}
|
SET(QtSingleApplication_NAMES ${QtSingleApplication_NAMES}
|
||||||
Qt5Solutions_SingleApplication-2.6 libQt5Solutions_SingleApplication-2.6
|
Qt5Solutions_SingleApplication-2.6 libQt5Solutions_SingleApplication-2.6
|
||||||
QtSolutions_SingleApplication-2.6 libQtSolutions_SingleApplication-2.6)
|
QtSolutions_SingleApplication-2.6 libQtSolutions_SingleApplication-2.6)
|
||||||
GET_TARGET_PROPERTY(_QT5_CORELIBRARY Qt5::Core LOCATION)
|
GET_TARGET_PROPERTY(_QT5_CORELIBRARY Qt5::Core LOCATION)
|
||||||
GET_FILENAME_COMPONENT(_QT5_CORELIBRARYPATH ${_QT5_CORELIBRARY} PATH)
|
GET_FILENAME_COMPONENT(_QT5_CORELIBRARYPATH ${_QT5_CORELIBRARY} PATH)
|
||||||
|
|
||||||
FIND_LIBRARY(QTSINGLEAPPLICATION_LIBRARY
|
FIND_LIBRARY(QtSingleApplication_LIBRARY
|
||||||
NAMES ${QTSINGLEAPPLICATION_NAMES}
|
NAMES ${QtSingleApplication_NAMES}
|
||||||
PATHS ${_QT5_CORELIBRARYPATH}
|
PATHS ${_QT5_CORELIBRARYPATH}
|
||||||
)
|
)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF (QTSINGLEAPPLICATION_LIBRARY AND QTSINGLEAPPLICATION_INCLUDE_DIR)
|
IF (QtSingleApplication_LIBRARY AND QtSingleApplication_INCLUDE_DIR)
|
||||||
|
|
||||||
SET(QTSINGLEAPPLICATION_LIBRARIES ${QTSINGLEAPPLICATION_LIBRARY})
|
SET(QtSingleApplication_LIBRARIES ${QtSingleApplication_LIBRARY})
|
||||||
SET(QTSINGLEAPPLICATION_FOUND TRUE)
|
SET(QtSingleApplication_FOUND TRUE)
|
||||||
|
|
||||||
IF (CYGWIN)
|
IF (CYGWIN)
|
||||||
IF(BUILD_SHARED_LIBS)
|
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)
|
ELSE(BUILD_SHARED_LIBS)
|
||||||
SET (QTSINGLEAPPLICATION_DEFINITIONS -DQTSINGLEAPPLICATION_STATIC)
|
SET (QtSingleApplication_DEFINITIONS -DQTSINGLEAPPLICATION_STATIC)
|
||||||
ENDIF(BUILD_SHARED_LIBS)
|
ENDIF(BUILD_SHARED_LIBS)
|
||||||
ENDIF (CYGWIN)
|
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)
|
IF (NOT QtSingleApplication_FIND_QUIETLY)
|
||||||
MESSAGE(STATUS "Found QtSingleApplication: ${QTSINGLEAPPLICATION_LIBRARY}")
|
MESSAGE(STATUS "Found QtSingleApplication: ${QtSingleApplication_LIBRARY}")
|
||||||
MESSAGE(STATUS " includes: ${QTSINGLEAPPLICATION_INCLUDE_DIR}")
|
MESSAGE(STATUS " includes: ${QtSingleApplication_INCLUDE_DIR}")
|
||||||
ENDIF (NOT QtSingleApplication_FIND_QUIETLY)
|
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)
|
IF (QtSingleApplication_FIND_REQUIRED)
|
||||||
MESSAGE(FATAL_ERROR "Could not find QtSingleApplication library")
|
MESSAGE(FATAL_ERROR "Could not find QtSingleApplication library")
|
||||||
ENDIF (QtSingleApplication_FIND_REQUIRED)
|
ENDIF (QtSingleApplication_FIND_REQUIRED)
|
||||||
ENDIF (QTSINGLEAPPLICATION_FOUND)
|
ENDIF (QtSingleApplication_FOUND)
|
||||||
|
|
||||||
MARK_AS_ADVANCED(QTSINGLEAPPLICATION_INCLUDE_DIR QTSINGLEAPPLICATION_LIBRARY)
|
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)
|
|
||||||
|
@ -1,16 +1,17 @@
|
|||||||
# a helper function which appends source to the main qBt target
|
# a helper function which appends source to the target
|
||||||
# sources file names are relative to the the ${qBittorrent_SOURCE_DIR}
|
# sources file names are relative to the the target source dir
|
||||||
|
|
||||||
function (qbt_target_sources)
|
function (qbt_target_sources _target _scope)
|
||||||
set (_sources_rel "")
|
get_target_property(targetSourceDir ${_target} SOURCE_DIR)
|
||||||
foreach (_source IN ITEMS ${ARGN})
|
set(sourcesRelative "")
|
||||||
if (IS_ABSOLUTE "${_source}")
|
foreach(source IN ITEMS ${ARGN})
|
||||||
set(source_abs "${_source}")
|
if(IS_ABSOLUTE "${source}")
|
||||||
|
set(sourceAbsolutePath "${source}")
|
||||||
else()
|
else()
|
||||||
get_filename_component(_source_abs "${_source}" ABSOLUTE)
|
get_filename_component(sourceAbsolutePath "${source}" ABSOLUTE)
|
||||||
endif()
|
endif()
|
||||||
file (RELATIVE_PATH _source_rel "${qbt_executable_SOURCE_DIR}" "${_source_abs}")
|
file(RELATIVE_PATH sourceRelativePath "${targetSourceDir}" "${sourceAbsolutePath}")
|
||||||
list (APPEND _sources_rel "${_source_rel}")
|
list(APPEND sourcesRelative "${sourceRelativePath}")
|
||||||
endforeach()
|
endforeach()
|
||||||
target_sources (qBittorrent PRIVATE "${_sources_rel}")
|
target_sources(${_target} ${_scope} "${sourcesRelative}")
|
||||||
endfunction (qbt_target_sources)
|
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)
|
if (APPLE)
|
||||||
add_subdirectory(mac)
|
add_subdirectory(mac)
|
||||||
else (APPLE)
|
else (APPLE)
|
||||||
|
28
dist/unix/CMakeLists.txt
vendored
28
dist/unix/CMakeLists.txt
vendored
@ -1,26 +1,32 @@
|
|||||||
if (SYSTEMD)
|
if (NOT Qt5Widgets_FOUND)
|
||||||
find_package(Systemd)
|
feature_option(SYSTEMD "Install systemd service file (headless only)" OFF)
|
||||||
if (SYSTEMD_FOUND)
|
if (SYSTEMD)
|
||||||
|
if (NOT Systemd_SERVICES_INSTALL_DIR)
|
||||||
|
find_package(Systemd)
|
||||||
|
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})
|
set(EXPAND_BINDIR ${CMAKE_INSTALL_FULL_BINDIR})
|
||||||
configure_file(systemd/qbittorrent-nox@.service.in ${CMAKE_CURRENT_BINARY_DIR}/qbittorrent-nox@.service @ONLY)
|
configure_file(systemd/qbittorrent-nox@.service.in ${CMAKE_CURRENT_BINARY_DIR}/qbittorrent-nox@.service @ONLY)
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qbittorrent-nox@.service
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qbittorrent-nox@.service
|
||||||
DESTINATION ${SYSTEMD_SERVICES_INSTALL_DIR}
|
DESTINATION ${Systemd_SERVICES_INSTALL_DIR}
|
||||||
COMPONENT data)
|
COMPONENT data)
|
||||||
endif(SYSTEMD_FOUND)
|
endif(SYSTEMD)
|
||||||
endif(SYSTEMD)
|
endif()
|
||||||
|
|
||||||
|
if (Qt5Widgets_FOUND)
|
||||||
if (GUI)
|
|
||||||
list(APPEND MAN_FILES ${qBittorrent_SOURCE_DIR}/doc/qbittorrent.1)
|
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)
|
list(APPEND MAN_FILES ${qBittorrent_SOURCE_DIR}/doc/qbittorrent-nox.1)
|
||||||
endif (GUI)
|
endif (Qt5Widgets_FOUND)
|
||||||
|
|
||||||
install(FILES ${MAN_FILES}
|
install(FILES ${MAN_FILES}
|
||||||
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
|
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
|
||||||
COMPONENT doc)
|
COMPONENT doc)
|
||||||
|
|
||||||
if (GUI)
|
if (Qt5Widgets_FOUND)
|
||||||
install(DIRECTORY menuicons/
|
install(DIRECTORY menuicons/
|
||||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor
|
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor
|
||||||
FILES_MATCHING PATTERN "*.png")
|
FILES_MATCHING PATTERN "*.png")
|
||||||
|
@ -1,40 +1,45 @@
|
|||||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||||
set(CMAKE_CXX_STANDARD "11")
|
set(CMAKE_CXX_STANDARD "11")
|
||||||
add_definitions(-DBOOST_NO_CXX11_RVALUE_REFERENCES)
|
|
||||||
|
|
||||||
include(MacroQbtCompilerSettings)
|
include(MacroQbtCompilerSettings)
|
||||||
qbt_set_compiler_options()
|
qbt_set_compiler_options()
|
||||||
|
|
||||||
include(MacroLinkQtComponents)
|
|
||||||
include(QbtTargetSources)
|
include(QbtTargetSources)
|
||||||
|
|
||||||
|
find_package(Boost ${requiredBoostVersion} REQUIRED)
|
||||||
find_package(LibtorrentRasterbar REQUIRED)
|
find_package(LibtorrentRasterbar REQUIRED)
|
||||||
|
|
||||||
# Qt
|
if (Boost_VERSION VERSION_LESS 106000)
|
||||||
list(APPEND QBT_QT_COMPONENTS Core Network Xml)
|
add_definitions(-DBOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||||
if (GUI)
|
endif()
|
||||||
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 (GUI AND APPLE)
|
find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS Core Network Xml)
|
||||||
# Fix MOC inability to detect macOS. This seems to only affect cmake.
|
find_package(Qt5Widgets ${requiredQtVersion})
|
||||||
# Relevant issue: https://bugreports.qt.io/browse/QTBUG-58325
|
if (Qt5Widgets_FOUND)
|
||||||
set(CMAKE_AUTOMOC_MOC_OPTIONS ${CMAKE_AUTOMOC_MOC_OPTIONS} -DQ_OS_MAC)
|
find_package(Qt5DBus ${requiredQtVersion})
|
||||||
endif ()
|
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)
|
set(CMAKE_AUTOMOC True)
|
||||||
list(APPEND CMAKE_AUTORCC_OPTIONS -compress 9 -threshold 5)
|
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})
|
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)
|
# Efficient construction for QString & QByteArray (Qt >= 4.8)
|
||||||
add_definitions(-DQT_USE_QSTRINGBUILDER)
|
add_definitions(-DQT_USE_QSTRINGBUILDER)
|
||||||
|
|
||||||
if (NOT GUI)
|
if (CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||||
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")
|
|
||||||
message(STATUS "Project is built in DEBUG mode.")
|
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 "Project is built in RELEASE mode.")
|
||||||
message(STATUS "Disabling debug output.")
|
message(STATUS "Disabling debug output.")
|
||||||
add_definitions(-DQT_NO_DEBUG_OUTPUT)
|
add_definitions(-DQT_NO_DEBUG_OUTPUT)
|
||||||
endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
endif()
|
||||||
|
|
||||||
set(QBT_USE_GUI ${GUI})
|
|
||||||
set(QBT_USE_WEBUI ${WEBUI})
|
|
||||||
|
|
||||||
configure_file(config.h.cmakein ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
configure_file(config.h.cmakein ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||||
|
|
||||||
if (SYSTEM_QTSINGLEAPPLICATION)
|
find_package(QtSingleApplication)
|
||||||
find_package(QtSingleApplication REQUIRED)
|
set_package_properties(QtSingleApplication PROPERTIES
|
||||||
else (SYSTEM_QTSINGLEAPPLICATION)
|
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)
|
add_subdirectory(app/qtsingleapplication)
|
||||||
endif (SYSTEM_QTSINGLEAPPLICATION)
|
endif ()
|
||||||
|
|
||||||
add_subdirectory(app)
|
add_subdirectory(app)
|
||||||
add_subdirectory(base)
|
add_subdirectory(base)
|
||||||
|
|
||||||
if (GUI)
|
if (Qt5Widgets_FOUND)
|
||||||
add_subdirectory(gui)
|
add_subdirectory(gui)
|
||||||
endif (GUI)
|
endif ()
|
||||||
|
|
||||||
if (WEBUI)
|
if (WEBUI)
|
||||||
add_subdirectory(webui)
|
add_subdirectory(webui)
|
||||||
|
@ -1,19 +1,27 @@
|
|||||||
project(qbt_executable)
|
add_executable(qBittorrent
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
|
|
||||||
set(QBT_APP_HEADERS
|
|
||||||
application.h
|
application.h
|
||||||
cmdoptions.h
|
cmdoptions.h
|
||||||
filelogger.h
|
filelogger.h
|
||||||
)
|
upgrade.h
|
||||||
|
|
||||||
set(QBT_APP_SOURCES
|
|
||||||
application.cpp
|
application.cpp
|
||||||
cmdoptions.cpp
|
cmdoptions.cpp
|
||||||
filelogger.cpp
|
filelogger.cpp
|
||||||
main.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
|
# translations
|
||||||
file(GLOB QBT_TS_FILES ../lang/*.ts)
|
file(GLOB QBT_TS_FILES ../lang/*.ts)
|
||||||
get_filename_component(QBT_QM_FILES_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/../lang" ABSOLUTE)
|
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 (WIN32)
|
||||||
if (MINGW)
|
if (MINGW)
|
||||||
list (APPEND QBT_APP_SOURCES ../qbittorrent_mingw.rc)
|
target_sources(qBittorrent PRIVATE ../qbittorrent_mingw.rc)
|
||||||
else (MINGW)
|
else (MINGW)
|
||||||
list (APPEND QBT_APP_SOURCES ../qbittorrent.rc)
|
target_sources(qBittorrent PRIVATE ../qbittorrent.rc)
|
||||||
endif (MINGW)
|
endif (MINGW)
|
||||||
list(APPEND QBT_APP_SOURCES ../qbittorrent.exe.manifest)
|
target_sources(qBittorrent PRIVATE ../qbittorrent.exe.manifest)
|
||||||
endif (WIN32)
|
endif (WIN32)
|
||||||
|
|
||||||
if (STACKTRACE)
|
if (STACKTRACE)
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
list(APPEND QBT_APP_HEADERS stacktrace.h)
|
target_sources(qBittorrent PRIVATE stacktrace.h)
|
||||||
else (UNIX)
|
else (UNIX)
|
||||||
list(APPEND QBT_APP_HEADERS stacktrace_win.h)
|
target_sources(qBittorrent PRIVATE stacktrace_win.h)
|
||||||
if (GUI)
|
if (Qt5Widgets_FOUND)
|
||||||
list(APPEND QBT_APP_HEADERS stacktrace_win_dlg.h)
|
target_sources(qBittorrent PRIVATE stacktrace_win_dlg.h)
|
||||||
endif (GUI)
|
endif (Qt5Widgets_FOUND)
|
||||||
endif (UNIX)
|
endif (UNIX)
|
||||||
endif (STACKTRACE)
|
endif (STACKTRACE)
|
||||||
|
|
||||||
# usesystemqtsingleapplication {
|
|
||||||
# nogui {
|
|
||||||
# CONFIG += qtsinglecoreapplication
|
|
||||||
# } else {
|
|
||||||
# CONFIG += qtsingleapplication
|
|
||||||
# }
|
|
||||||
# } else {
|
|
||||||
# nogui {
|
|
||||||
# include(qtsingleapplication/qtsinglecoreapplication.pri)
|
|
||||||
# } else {
|
|
||||||
# include(qtsingleapplication/qtsingleapplication.pri)
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
|
|
||||||
# upgrade code
|
if (Qt5Widgets_FOUND)
|
||||||
list(APPEND QBT_APP_HEADERS upgrade.h)
|
target_link_libraries(qBittorrent PRIVATE qbt_searchengine qbt_gui)
|
||||||
list(APPEND QBT_TARGET_LIBRARIES qbt_base)
|
set_target_properties(qBittorrent
|
||||||
|
PROPERTIES
|
||||||
if (GUI)
|
OUTPUT_NAME qbittorrent
|
||||||
list(APPEND QBT_TARGET_LIBRARIES qbt_searchengine qbt_gui)
|
WIN32_EXECUTABLE True
|
||||||
include_directories(../gui
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/../gui
|
|
||||||
)
|
)
|
||||||
endif (GUI)
|
else(Qt5Widgets_FOUND)
|
||||||
|
set_target_properties(qBittorrent
|
||||||
|
PROPERTIES
|
||||||
|
OUTPUT_NAME qbittorrent-nox
|
||||||
|
)
|
||||||
|
endif (Qt5Widgets_FOUND)
|
||||||
|
|
||||||
if (WEBUI)
|
if (WEBUI)
|
||||||
list(APPEND QBT_TARGET_LIBRARIES qbt_webui)
|
target_link_libraries(qBittorrent PRIVATE qbt_webui)
|
||||||
endif (WEBUI)
|
endif (WEBUI)
|
||||||
|
|
||||||
# we have to include resources into the bundle
|
# we have to include resources into the bundle
|
||||||
@ -142,30 +140,11 @@ if (APPLE)
|
|||||||
PROPERTIES MACOSX_PACKAGE_LOCATION translations)
|
PROPERTIES MACOSX_PACKAGE_LOCATION translations)
|
||||||
endif (APPLE)
|
endif (APPLE)
|
||||||
|
|
||||||
add_executable(qBittorrent ${QBT_APP_HEADERS} ${QBT_APP_SOURCES} ${QBT_QM_FILES} ${QBT_APP_RESOURCE_SOURCE})
|
target_sources(qBittorrent PRIVATE ${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
|
|
||||||
)
|
|
||||||
|
|
||||||
get_target_property(QBT_EXECUTABLE_NAME qBittorrent OUTPUT_NAME)
|
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)
|
if (APPLE)
|
||||||
set(qbt_BUNDLE_NAME ${QBT_EXECUTABLE_NAME})
|
set(qbt_BUNDLE_NAME ${QBT_EXECUTABLE_NAME})
|
||||||
@ -186,6 +165,7 @@ install(TARGETS qBittorrent
|
|||||||
BUNDLE DESTINATION .
|
BUNDLE DESTINATION .
|
||||||
COMPONENT runtime)
|
COMPONENT runtime)
|
||||||
|
|
||||||
if (GUI AND APPLE)
|
if (Qt5Widgets_FOUND AND APPLE)
|
||||||
|
find_package(Qt5Svg REQUIRED)
|
||||||
include(bundle)
|
include(bundle)
|
||||||
endif (GUI AND APPLE)
|
endif (Qt5Widgets_FOUND AND APPLE)
|
||||||
|
@ -8,24 +8,24 @@ set(QBT_QTSINGLEAPPLICATION_SOURCES
|
|||||||
qtlocalpeer.cpp
|
qtlocalpeer.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if (GUI)
|
if (Qt5Widgets_FOUND)
|
||||||
list(APPEND QBT_QTSINGLEAPPLICATION_HEADERS qtsingleapplication.h)
|
list(APPEND QBT_QTSINGLEAPPLICATION_HEADERS qtsingleapplication.h)
|
||||||
list(APPEND QBT_QTSINGLEAPPLICATION_SOURCES qtsingleapplication.cpp)
|
list(APPEND QBT_QTSINGLEAPPLICATION_SOURCES qtsingleapplication.cpp)
|
||||||
else (GUI)
|
else (Qt5Widgets_FOUND)
|
||||||
list(APPEND QBT_QTSINGLEAPPLICATION_HEADERS qtsinglecoreapplication.h)
|
list(APPEND QBT_QTSINGLEAPPLICATION_HEADERS qtsinglecoreapplication.h)
|
||||||
list(APPEND QBT_QTSINGLEAPPLICATION_SOURCES qtsinglecoreapplication.cpp)
|
list(APPEND QBT_QTSINGLEAPPLICATION_SOURCES qtsinglecoreapplication.cpp)
|
||||||
endif (GUI)
|
endif (Qt5Widgets_FOUND)
|
||||||
|
|
||||||
add_library(qtsingleapplication STATIC ${QBT_QTSINGLEAPPLICATION_HEADERS} ${QBT_QTSINGLEAPPLICATION_SOURCES})
|
add_library(qtsingleapplication STATIC ${QBT_QTSINGLEAPPLICATION_HEADERS} ${QBT_QTSINGLEAPPLICATION_SOURCES})
|
||||||
target_include_directories(qtsingleapplication INTERFACE "${qtsingleapplication_SOURCE_DIR}")
|
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")
|
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
|
target_compile_options(qtsingleapplication PRIVATE "-w") # disable warning for 3rdparty code
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (GUI)
|
if (Qt5Widgets_FOUND)
|
||||||
target_link_qt_components(qtsingleapplication Widgets)
|
target_link_libraries(qtsingleapplication PRIVATE Qt5::Widgets)
|
||||||
endif (GUI)
|
endif (Qt5Widgets_FOUND)
|
||||||
|
|
||||||
add_library(QtSingleApplication::QtSingleApplication ALIAS qtsingleapplication)
|
add_library(QtSingleApplication::QtSingleApplication ALIAS qtsingleapplication)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
find_package(ZLIB 1.2.5.2 REQUIRED)
|
find_package(ZLIB 1.2.5.2 REQUIRED)
|
||||||
|
|
||||||
set(QBT_BASE_HEADERS
|
add_library(qbt_base STATIC
|
||||||
bittorrent/addtorrentparams.h
|
bittorrent/addtorrentparams.h
|
||||||
bittorrent/cachestatus.h
|
bittorrent/cachestatus.h
|
||||||
bittorrent/infohash.h
|
bittorrent/infohash.h
|
||||||
@ -72,9 +72,6 @@ torrentfilter.h
|
|||||||
tristatebool.h
|
tristatebool.h
|
||||||
types.h
|
types.h
|
||||||
unicodestrings.h
|
unicodestrings.h
|
||||||
)
|
|
||||||
|
|
||||||
set(QBT_BASE_SOURCES
|
|
||||||
bittorrent/infohash.cpp
|
bittorrent/infohash.cpp
|
||||||
bittorrent/magneturi.cpp
|
bittorrent/magneturi.cpp
|
||||||
bittorrent/peerinfo.cpp
|
bittorrent/peerinfo.cpp
|
||||||
@ -137,16 +134,20 @@ torrentfilter.cpp
|
|||||||
tristatebool.cpp
|
tristatebool.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(qbt_base STATIC ${QBT_BASE_HEADERS} ${QBT_BASE_SOURCES})
|
target_link_libraries(qbt_base
|
||||||
target_link_libraries(qbt_base PRIVATE ZLIB::ZLIB PUBLIC LibtorrentRasterbar::LibTorrent)
|
PRIVATE
|
||||||
target_link_qt_components(qbt_base PUBLIC Core Network Xml)
|
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)
|
target_link_libraries(qbt_base PUBLIC Qt5::Gui Qt5::Widgets)
|
||||||
endif (GUI)
|
endif (Qt5Widgets_FOUND)
|
||||||
|
|
||||||
if (DBUS)
|
if (Qt5DBus_FOUND)
|
||||||
target_link_qt_components(qbt_base PRIVATE DBus)
|
target_link_libraries(qbt_base PRIVATE Qt5::DBus)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
set(CMAKE_AUTORCC True)
|
set(CMAKE_AUTORCC True)
|
||||||
set(CMAKE_AUTOUIC 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(lineedit)
|
||||||
add_subdirectory(properties)
|
add_subdirectory(properties)
|
||||||
@ -9,24 +10,8 @@ add_subdirectory(powermanagement)
|
|||||||
add_subdirectory(rss)
|
add_subdirectory(rss)
|
||||||
add_subdirectory(search)
|
add_subdirectory(search)
|
||||||
|
|
||||||
if (UNIX AND NOT APPLE AND DBUS)
|
add_library(qbt_gui STATIC
|
||||||
add_subdirectory(qtnotify)
|
# headers
|
||||||
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
|
|
||||||
about_imp.h
|
about_imp.h
|
||||||
addnewtorrentdialog.h
|
addnewtorrentdialog.h
|
||||||
advancedsettings.h
|
advancedsettings.h
|
||||||
@ -75,9 +60,7 @@ transferlistsortmodel.h
|
|||||||
transferlistwidget.h
|
transferlistwidget.h
|
||||||
updownratiodlg.h
|
updownratiodlg.h
|
||||||
utils.h
|
utils.h
|
||||||
)
|
# sources
|
||||||
|
|
||||||
set(QBT_GUI_SOURCES
|
|
||||||
addnewtorrentdialog.cpp
|
addnewtorrentdialog.cpp
|
||||||
advancedsettings.cpp
|
advancedsettings.cpp
|
||||||
autoexpandabledialog.cpp
|
autoexpandabledialog.cpp
|
||||||
@ -122,19 +105,7 @@ transferlistsortmodel.cpp
|
|||||||
transferlistwidget.cpp
|
transferlistwidget.cpp
|
||||||
updownratiodlg.cpp
|
updownratiodlg.cpp
|
||||||
utils.cpp
|
utils.cpp
|
||||||
)
|
# forms
|
||||||
|
|
||||||
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
|
|
||||||
mainwindow.ui
|
mainwindow.ui
|
||||||
about.ui
|
about.ui
|
||||||
banlistoptions.ui
|
banlistoptions.ui
|
||||||
@ -156,17 +127,36 @@ torrentcreatordlg.ui
|
|||||||
shutdownconfirmdlg.ui
|
shutdownconfirmdlg.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
qbt_target_sources(about.qrc)
|
target_link_libraries(qbt_gui
|
||||||
|
PRIVATE
|
||||||
add_library(qbt_gui STATIC ${QBT_GUI_HEADERS} ${QBT_GUI_SOURCES} ${QBT_GUI_FORMS})
|
qbt_lineedit qbt_powermanagement qbt_rss qbt_properties qbt_searchengine
|
||||||
target_link_libraries(qbt_gui qbt_lineedit qbt_powermanagement qbt_rss qbt_properties qbt_searchengine
|
qbt_base
|
||||||
${QBT_GUI_OPTIONAL_LINK_LIBRARIES} qbt_base
|
QtSingleApplication::QtSingleApplication
|
||||||
QtSingleApplication::QtSingleApplication
|
|
||||||
)
|
)
|
||||||
if(WIN32)
|
|
||||||
target_link_libraries(qbt_gui Qt5::WinExtras)
|
target_include_directories(qbt_gui
|
||||||
endif(WIN32)
|
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)
|
if (APPLE)
|
||||||
target_link_libraries(qbt_gui Qt5::MacExtras)
|
target_sources(qbt_gui PRIVATE macutilities.h macutilities.mm)
|
||||||
endif()
|
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
|
src/lineedit.cpp
|
||||||
)
|
|
||||||
|
|
||||||
set(QBT_LINEEDIT_HEADERS
|
|
||||||
src/lineedit.h
|
src/lineedit.h
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(qbt_lineedit STATIC ${QBT_LINEEDIT_SOURCES} ${QBT_LINEEDIT_HEADERS})
|
target_link_libraries(qbt_lineedit
|
||||||
target_link_libraries(qbt_lineedit Qt5::Widgets)
|
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
|
powermanagement.h
|
||||||
)
|
|
||||||
|
|
||||||
set(QBT_POWERMANAGEMENT_SOURCES
|
|
||||||
powermanagement.cpp
|
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)
|
find_package(X11)
|
||||||
if (X11_FOUND)
|
if (X11_FOUND)
|
||||||
list(APPEND QBT_POWERMANAGEMENT_HEADERS powermanagement_x11.h)
|
target_sources(qbt_powermanagement PRIVATE powermanagement_x11.h powermanagement_x11.cpp)
|
||||||
list(APPEND QBT_POWERMANAGEMENT_SOURCES powermanagement_x11.cpp)
|
target_link_libraries(qbt_powermanagement PRIVATE Qt5::DBus)
|
||||||
endif (X11_FOUND)
|
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)
|
if (WIN32)
|
||||||
target_link_libraries(qbt_powermanagement PowrProf)
|
target_link_libraries(qbt_powermanagement PRIVATE PowrProf)
|
||||||
endif (WIN32)
|
endif (WIN32)
|
||||||
|
@ -1,16 +1,7 @@
|
|||||||
include_directories(
|
add_library(qbt_properties STATIC
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
../lineedit/src/
|
|
||||||
)
|
|
||||||
|
|
||||||
set(QBT_PROPERTIES_FORMS
|
|
||||||
propertieswidget.ui
|
propertieswidget.ui
|
||||||
trackersadditiondlg.ui
|
trackersadditiondlg.ui
|
||||||
peersadditiondlg.ui
|
peersadditiondlg.ui
|
||||||
)
|
|
||||||
|
|
||||||
set(QBT_PROPERTIES_HEADERS
|
|
||||||
propertieswidget.h
|
propertieswidget.h
|
||||||
peerlistwidget.h
|
peerlistwidget.h
|
||||||
proplistdelegate.h
|
proplistdelegate.h
|
||||||
@ -25,9 +16,6 @@ pieceavailabilitybar.h
|
|||||||
proptabbar.h
|
proptabbar.h
|
||||||
speedwidget.h
|
speedwidget.h
|
||||||
speedplotview.h
|
speedplotview.h
|
||||||
)
|
|
||||||
|
|
||||||
set(QBT_PROPERTIES_SOURCES
|
|
||||||
propertieswidget.cpp
|
propertieswidget.cpp
|
||||||
proplistdelegate.cpp
|
proplistdelegate.cpp
|
||||||
peerlistwidget.cpp
|
peerlistwidget.cpp
|
||||||
@ -42,6 +30,16 @@ speedwidget.cpp
|
|||||||
speedplotview.cpp
|
speedplotview.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(qbt_properties STATIC ${QBT_PROPERTIES_HEADERS} ${QBT_PROPERTIES_SOURCES} ${QBT_PROPERTIES_FORMS})
|
target_link_libraries(qbt_properties
|
||||||
target_link_libraries(qbt_properties qbt_base)
|
PRIVATE
|
||||||
target_link_libraries(qbt_properties Qt5::Widgets)
|
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
|
notifications.cpp
|
||||||
)
|
|
||||||
|
|
||||||
set(QBT_QTNOTIFY_HEADERS
|
|
||||||
notifications.h
|
notifications.h
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(qbt_qtnotify STATIC ${QBT_QTNOTIFY_SOURCES} ${QBT_QTNOTIFY_HEADERS})
|
|
||||||
set_target_properties(qbt_qtnotify PROPERTIES AUTOUIC False AUTORCC False)
|
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})
|
add_library(qbt_rss STATIC
|
||||||
|
|
||||||
set(QBT_RSS_HEADERS
|
|
||||||
articlelistwidget.h
|
articlelistwidget.h
|
||||||
automatedrssdownloader.h
|
automatedrssdownloader.h
|
||||||
feedlistwidget.h
|
feedlistwidget.h
|
||||||
htmlbrowser.h
|
htmlbrowser.h
|
||||||
rsswidget.h
|
rsswidget.h
|
||||||
)
|
|
||||||
|
|
||||||
set(QBT_RSS_SOURCE
|
|
||||||
articlelistwidget.cpp
|
articlelistwidget.cpp
|
||||||
automatedrssdownloader.cpp
|
automatedrssdownloader.cpp
|
||||||
feedlistwidget.cpp
|
feedlistwidget.cpp
|
||||||
htmlbrowser.cpp
|
htmlbrowser.cpp
|
||||||
rsswidget.cpp
|
rsswidget.cpp
|
||||||
)
|
|
||||||
|
|
||||||
set(QBT_RSS_FORMS
|
|
||||||
automatedrssdownloader.ui
|
automatedrssdownloader.ui
|
||||||
rsswidget.ui
|
rsswidget.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(qbt_rss STATIC ${QBT_RSS_HEADERS} ${QBT_RSS_SOURCE} ${QBT_RSS_FORMS})
|
target_include_directories(qbt_rss PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
target_link_libraries(qbt_rss qbt_base)
|
target_link_libraries(qbt_rss
|
||||||
target_link_libraries(qbt_rss Qt5::Gui Qt5::Widgets Qt5::Network)
|
PRIVATE
|
||||||
|
qbt_gui_headers
|
||||||
|
PUBLIC
|
||||||
|
qbt_base Qt5::Gui Qt5::Widgets Qt5::Network
|
||||||
|
)
|
||||||
|
@ -1,25 +1,13 @@
|
|||||||
include_directories(
|
add_library(qbt_searchengine STATIC
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../lineedit/src
|
|
||||||
)
|
|
||||||
|
|
||||||
set(QBT_SEARCHENGINE_FORMS
|
|
||||||
pluginselectdlg.ui
|
pluginselectdlg.ui
|
||||||
pluginsourcedlg.ui
|
pluginsourcedlg.ui
|
||||||
searchwidget.ui
|
searchwidget.ui
|
||||||
)
|
|
||||||
|
|
||||||
set(QBT_SEARCHENGINE_HEADERS
|
|
||||||
pluginselectdlg.h
|
pluginselectdlg.h
|
||||||
pluginsourcedlg.h
|
pluginsourcedlg.h
|
||||||
searchlistdelegate.h
|
searchlistdelegate.h
|
||||||
searchsortmodel.h
|
searchsortmodel.h
|
||||||
searchtab.h
|
searchtab.h
|
||||||
searchwidget.h
|
searchwidget.h
|
||||||
)
|
|
||||||
|
|
||||||
set(QBT_SEARCHENGINE_SOURCES
|
|
||||||
pluginselectdlg.cpp
|
pluginselectdlg.cpp
|
||||||
pluginsourcedlg.cpp
|
pluginsourcedlg.cpp
|
||||||
searchlistdelegate.cpp
|
searchlistdelegate.cpp
|
||||||
@ -32,6 +20,9 @@ set(QBT_SEARCHENGINE_RESOURCES
|
|||||||
# search.qrc
|
# search.qrc
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(qbt_searchengine STATIC ${QBT_SEARCHENGINE_HEADERS} ${QBT_SEARCHENGINE_SOURCES} ${QBT_SEARCHENGINE_RESOURCES} ${QBT_SEARCHENGINE_FORMS})
|
target_link_libraries(qbt_searchengine
|
||||||
target_link_libraries(qbt_searchengine qbt_base)
|
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/apicontroller.h
|
||||||
api/apierror.h
|
api/apierror.h
|
||||||
api/appcontroller.h
|
api/appcontroller.h
|
||||||
@ -13,9 +13,6 @@ api/serialize/serialize_torrent.h
|
|||||||
extra_translations.h
|
extra_translations.h
|
||||||
webapplication.h
|
webapplication.h
|
||||||
webui.h
|
webui.h
|
||||||
)
|
|
||||||
|
|
||||||
set(QBT_WEBUI_SOURCES
|
|
||||||
api/apicontroller.cpp
|
api/apicontroller.cpp
|
||||||
api/apierror.cpp
|
api/apierror.cpp
|
||||||
api/appcontroller.cpp
|
api/appcontroller.cpp
|
||||||
@ -30,8 +27,6 @@ webapplication.cpp
|
|||||||
webui.cpp
|
webui.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
qbt_target_sources(webui.qrc)
|
qbt_target_sources(qBittorrent PRIVATE webui.qrc)
|
||||||
|
|
||||||
add_library(qbt_webui STATIC ${QBT_WEBUI_HEADERS} ${QBT_WEBUI_SOURCES})
|
|
||||||
target_link_libraries(qbt_webui qbt_base)
|
|
||||||
|
|
||||||
|
target_link_libraries(qbt_webui PUBLIC qbt_base)
|
||||||
|
Loading…
Reference in New Issue
Block a user