mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-08 16:42:30 -06:00
CMake: overhaul and improve scripts
- Bump minimum required version and make use of more modern language features - Rely more on target_...() commands to establish dependency relationships between targets rather than directory property commands - Improve libtorrent package discovery - Enable and handle application features more explicitly - Improve user-facing output - Fix various compilation issues on Windows (MSVC and MinGW) and macOS - Improve handling of translations - Add explanatory comments where relevant - Make CMake scripts fully independent of qmake files/details - Remove old functions/macros
This commit is contained in:
@@ -1,62 +1,75 @@
|
||||
include(MacroQbtCompilerSettings)
|
||||
qbt_set_compiler_options()
|
||||
|
||||
include(QbtTargetSources)
|
||||
|
||||
find_package(Boost ${requiredBoostVersion} REQUIRED)
|
||||
find_package(LibtorrentRasterbar ${requiredLibtorrentVersion} REQUIRED)
|
||||
find_package(OpenSSL ${requiredOpensslVersion} REQUIRED)
|
||||
|
||||
if (Boost_VERSION_STRING VERSION_LESS 1.60.0)
|
||||
add_definitions(-DBOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
if (UNIX AND (NOT APPLE) AND (NOT CYGWIN))
|
||||
find_package(LibtorrentRasterbar QUIET ${requiredLibtorrentVersion} COMPONENTS torrent-rasterbar)
|
||||
if (NOT LibtorrentRasterbar_FOUND)
|
||||
include(FindPkgConfig)
|
||||
pkg_check_modules(LIBTORRENT_RASTERBAR IMPORTED_TARGET GLOBAL "libtorrent-rasterbar>=${requiredLibtorrentVersion}")
|
||||
if (NOT LIBTORRENT_RASTERBAR_FOUND)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Package LibtorrentRasterbar >= ${requiredLibtorrentVersion} not found"
|
||||
" with CMake or pkg-config.\n- Set LibtorrentRasterbar_DIR to a directory containing"
|
||||
" a LibtorrentRasterbarConfig.cmake file or add the installation prefix of LibtorrentRasterbar"
|
||||
" to CMAKE_PREFIX_PATH.\n- Alternatively, make sure there is a valid libtorrent-rasterbar.pc"
|
||||
" file in your system's pkg-config search paths (use the system environment variable PKG_CONFIG_PATH"
|
||||
" to specify additional search paths if needed)."
|
||||
)
|
||||
endif()
|
||||
add_library(LibtorrentRasterbar::torrent-rasterbar ALIAS PkgConfig::LIBTORRENT_RASTERBAR)
|
||||
# force a fake package to show up in the feature summary
|
||||
set_property(GLOBAL APPEND PROPERTY
|
||||
PACKAGES_FOUND
|
||||
"LibtorrentRasterbar via pkg-config (required version >= ${requiredLibtorrentVersion})"
|
||||
)
|
||||
set_package_properties("LibtorrentRasterbar via pkg-config (required version >= ${requiredLibtorrentVersion})"
|
||||
PROPERTIES
|
||||
TYPE REQUIRED
|
||||
)
|
||||
else()
|
||||
set_package_properties(LibtorrentRasterbar PROPERTIES TYPE REQUIRED)
|
||||
endif()
|
||||
else()
|
||||
find_package(LibtorrentRasterbar ${requiredLibtorrentVersion} REQUIRED COMPONENTS torrent-rasterbar)
|
||||
endif()
|
||||
|
||||
# force variable type so that it always shows up in ccmake/cmake-gui frontends
|
||||
set_property(CACHE LibtorrentRasterbar_DIR PROPERTY TYPE PATH)
|
||||
find_package(Boost ${requiredBoostVersion} REQUIRED COMPONENTS system)
|
||||
find_package(OpenSSL ${requiredOpenSSLVersion} REQUIRED)
|
||||
find_package(ZLIB ${requiredZlibVersion} REQUIRED)
|
||||
find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS Core Network Xml LinguistTools)
|
||||
if (GUI)
|
||||
find_package(Qt5Widgets ${requiredQtVersion} REQUIRED)
|
||||
find_package(Qt5DBus ${requiredQtVersion})
|
||||
if (DBUS)
|
||||
find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS DBus)
|
||||
set_package_properties(Qt5DBus PROPERTIES
|
||||
DESCRIPTION "Qt5 module for inter-process communication over the D-Bus protocol"
|
||||
PURPOSE "Required by the DBUS feature"
|
||||
)
|
||||
endif()
|
||||
|
||||
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
|
||||
)
|
||||
# automatically call Qt moc, rcc and uic as needed for all targets by default
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
|
||||
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_MACOS -DQ_OS_DARWIN)
|
||||
endif()
|
||||
# create interface-only target libraries with common compile options/definitions to link to
|
||||
include(MacroQbtCommonConfig)
|
||||
qbt_common_config()
|
||||
|
||||
# include directories - ideally, would be done per target instead of global directory scope
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
# defines
|
||||
add_definitions(-DQT_DEPRECATED_WARNINGS)
|
||||
add_definitions(-DQT_NO_CAST_TO_ASCII)
|
||||
add_definitions(-DQT_NO_CAST_FROM_BYTEARRAY)
|
||||
add_definitions(-DQT_USE_QSTRINGBUILDER)
|
||||
add_definitions(-DQT_STRICT_ITERATORS)
|
||||
|
||||
if (CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||
message(STATUS "Project is built in DEBUG mode.")
|
||||
else()
|
||||
message(STATUS "Project is built in RELEASE mode.")
|
||||
message(STATUS "Disabling debug output.")
|
||||
add_definitions(-DQT_NO_DEBUG_OUTPUT)
|
||||
endif()
|
||||
|
||||
configure_file(config.h.cmakein ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||
|
||||
add_subdirectory(app)
|
||||
add_subdirectory(base)
|
||||
|
||||
if (GUI)
|
||||
find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS Widgets Svg)
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS MacExtras)
|
||||
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS WinExtras)
|
||||
endif()
|
||||
add_subdirectory(gui)
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
if (WEBUI)
|
||||
add_subdirectory(webui)
|
||||
endif()
|
||||
|
||||
add_subdirectory(app)
|
||||
|
||||
@@ -1,4 +1,32 @@
|
||||
add_executable(qBittorrent
|
||||
# Generate and configure translation files
|
||||
# -----------------------------------------------------------------------------
|
||||
# -----------------------------------------------------------------------------
|
||||
# Based on https://gist.github.com/giraldeau/546ba5512a74dfe9d8ea0862d66db412
|
||||
file(GLOB QBT_TS_FILES "${qBittorrent_SOURCE_DIR}/src/lang/*.ts")
|
||||
set_source_files_properties(${QBT_TS_FILES} PROPERTIES OUTPUT_LOCATION "${qBittorrent_BINARY_DIR}/src/lang")
|
||||
qt5_add_translation(QBT_QM_FILES ${QBT_TS_FILES})
|
||||
configure_file("${qBittorrent_SOURCE_DIR}/src/lang/lang.qrc" "${qBittorrent_BINARY_DIR}/src/lang/lang.qrc" COPYONLY)
|
||||
|
||||
if (WEBUI)
|
||||
file(GLOB QBT_WEBUI_TS_FILES "${qBittorrent_SOURCE_DIR}/src/webui/www/translations/*.ts")
|
||||
set_source_files_properties(${QBT_WEBUI_TS_FILES}
|
||||
PROPERTIES OUTPUT_LOCATION "${qBittorrent_BINARY_DIR}/src/webui/www/translations")
|
||||
qt5_add_translation(QBT_WEBUI_QM_FILES ${QBT_WEBUI_TS_FILES})
|
||||
configure_file("${qBittorrent_SOURCE_DIR}/src/webui/www/translations/webui_translations.qrc"
|
||||
"${qBittorrent_BINARY_DIR}/src/webui/www/translations/webui_translations.qrc" COPYONLY)
|
||||
endif()
|
||||
|
||||
FILE(GLOB QT_TRANSLATIONS "${qBittorrent_SOURCE_DIR}/dist/qt-translations/qtbase_*.qm")
|
||||
foreach(EXTRA_TRANSLATION IN ITEMS "fa" "gl" "lt" "pt" "sl" "sv" "zh_CN")
|
||||
list(APPEND QT_TRANSLATIONS "${qBittorrent_SOURCE_DIR}/dist/qt-translations/qt_${EXTRA_TRANSLATION}.qm")
|
||||
endforeach()
|
||||
|
||||
# Executable target configuration
|
||||
# -----------------------------------------------------------------------------
|
||||
# -----------------------------------------------------------------------------
|
||||
add_executable(qbt_app)
|
||||
|
||||
target_sources(qbt_app PRIVATE
|
||||
# headers
|
||||
application.h
|
||||
applicationinstancemanager.h
|
||||
@@ -15,148 +43,135 @@ add_executable(qBittorrent
|
||||
main.cpp
|
||||
qtlocalpeer/qtlocalpeer.cpp
|
||||
upgrade.cpp
|
||||
|
||||
# resources
|
||||
"${qBittorrent_SOURCE_DIR}/src/icons/icons.qrc"
|
||||
"${qBittorrent_SOURCE_DIR}/src/searchengine/searchengine.qrc"
|
||||
${QBT_QM_FILES}
|
||||
"${qBittorrent_BINARY_DIR}/src/lang/lang.qrc" # yes, it's supposed to be "*_BINARY_DIR"
|
||||
)
|
||||
|
||||
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
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
|
||||
target_link_libraries(qbt_app PRIVATE
|
||||
qbt_base
|
||||
qbt_version_definitions
|
||||
)
|
||||
|
||||
# translations
|
||||
include(QbtTranslations)
|
||||
set_target_properties(qbt_app PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
|
||||
|
||||
file(GLOB QBT_TS_FILES ../lang/*.ts)
|
||||
qbt_add_translations(qBittorrent QRC_FILE "../lang/lang.qrc" TS_FILES ${QBT_TS_FILES})
|
||||
|
||||
if (WEBUI)
|
||||
file(GLOB QBT_WEBUI_TS_FILES ../webui/www/translations/*.ts)
|
||||
qbt_add_translations(qBittorrent QRC_FILE "../webui/www/translations/webui_translations.qrc" TS_FILES ${QBT_WEBUI_TS_FILES})
|
||||
endif()
|
||||
|
||||
set(QBT_APP_RESOURCES
|
||||
../icons/icons.qrc
|
||||
../searchengine/searchengine.qrc
|
||||
# Additional platform specific configuration
|
||||
# -----------------------------------------------------------------------------
|
||||
# -----------------------------------------------------------------------------
|
||||
set_source_files_properties(${QT_TRANSLATIONS} PROPERTIES MACOSX_PACKAGE_LOCATION translations)
|
||||
set_source_files_properties(
|
||||
"${qBittorrent_SOURCE_DIR}/dist/mac/qt.conf"
|
||||
"${qBittorrent_SOURCE_DIR}/dist/mac/qBitTorrentDocument.icns"
|
||||
"${qBittorrent_SOURCE_DIR}/dist/mac/qbittorrent_mac.icns"
|
||||
PROPERTIES
|
||||
MACOSX_PACKAGE_LOCATION Resources
|
||||
)
|
||||
|
||||
# With AUTORCC rcc is ran by cmake before language files are generated,
|
||||
# and thus we call rcc explicitly
|
||||
qt5_add_resources(QBT_APP_RESOURCE_SOURCE ${QBT_APP_RESOURCES})
|
||||
|
||||
if (WIN32)
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
# substitute @EXECUTABLE@ in dist/mac/Info.plist
|
||||
get_target_property(EXECUTABLE qbt_app OUTPUT_NAME)
|
||||
configure_file(${qBittorrent_SOURCE_DIR}/dist/mac/Info.plist
|
||||
${qBittorrent_BINARY_DIR}/dist/mac/pregen.plist @ONLY)
|
||||
file(GENERATE
|
||||
OUTPUT ${qBittorrent_BINARY_DIR}/dist/mac/Info.plist
|
||||
INPUT ${qBittorrent_BINARY_DIR}/dist/mac/pregen.plist
|
||||
)
|
||||
set_target_properties(qbt_app PROPERTIES
|
||||
MACOSX_BUNDLE ON
|
||||
MACOSX_BUNDLE_BUNDLE_NAME "${EXECUTABLE}"
|
||||
MACOSX_BUNDLE_INFO_PLIST ${qBittorrent_BINARY_DIR}/dist/mac/Info.plist
|
||||
)
|
||||
target_sources(qbt_app PRIVATE
|
||||
${QT_TRANSLATIONS}
|
||||
${qBittorrent_SOURCE_DIR}/dist/mac/qt.conf
|
||||
${qBittorrent_SOURCE_DIR}/dist/mac/qBitTorrentDocument.icns
|
||||
${qBittorrent_SOURCE_DIR}/dist/mac/qbittorrent_mac.icns
|
||||
)
|
||||
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
set_target_properties(qbt_app PROPERTIES WIN32_EXECUTABLE ON)
|
||||
if (MINGW)
|
||||
target_sources(qBittorrent PRIVATE ../qbittorrent_mingw.rc)
|
||||
target_sources(qbt_app PRIVATE ${qBittorrent_SOURCE_DIR}/src/qbittorrent_mingw.rc)
|
||||
else()
|
||||
target_sources(qBittorrent PRIVATE ../qbittorrent.rc)
|
||||
target_sources(qbt_app PRIVATE ${qBittorrent_SOURCE_DIR}/src/qbittorrent.rc)
|
||||
endif()
|
||||
|
||||
target_sources(qBittorrent PRIVATE ../qbittorrent.exe.manifest)
|
||||
target_sources(qbt_app PRIVATE ${qBittorrent_SOURCE_DIR}/src/qbittorrent.exe.manifest)
|
||||
endif()
|
||||
|
||||
# Additional feature dependent configuration
|
||||
# -----------------------------------------------------------------------------
|
||||
# -----------------------------------------------------------------------------
|
||||
if (STACKTRACE)
|
||||
if (UNIX)
|
||||
target_sources(qBittorrent PRIVATE stacktrace.h)
|
||||
else()
|
||||
target_sources(qBittorrent PRIVATE stacktrace_win.h)
|
||||
target_compile_definitions(qbt_app PRIVATE STACKTRACE)
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
target_sources(qbt_app PRIVATE stacktrace_win.h)
|
||||
|
||||
if (GUI)
|
||||
target_sources(qBittorrent PRIVATE stacktracedialog.cpp stacktracedialog.h)
|
||||
target_sources(qbt_app PRIVATE
|
||||
stacktracedialog.h
|
||||
stacktracedialog.cpp
|
||||
stacktracedialog.ui
|
||||
)
|
||||
endif()
|
||||
|
||||
# i686 arch on Windows requires frame pointer preservation
|
||||
if (MSVC)
|
||||
if (NOT "${WINXXBITS}" STREQUAL "Win64")
|
||||
# i686 arch requires frame pointer preservation
|
||||
add_compile_options(-Oy-)
|
||||
target_compile_options(qbt_app PRIVATE /Zi)
|
||||
target_link_options(qbt_app PUBLIC LINKER:/DEBUG)
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
target_compile_options(qbt_app PRIVATE /Oy)
|
||||
endif()
|
||||
|
||||
add_compile_options(-Zi)
|
||||
target_link_libraries(qBittorrent PUBLIC dbghelp -DEBUG)
|
||||
else()
|
||||
if (NOT "${WINXXBITS}" STREQUAL "Win64")
|
||||
add_compile_options(-fno-omit-frame-pointer)
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
target_compile_options(qbt_app PRIVATE -fno-omit-frame-pointer)
|
||||
endif()
|
||||
|
||||
target_link_libraries(qBittorrent PUBLIC dbghelp -Wl,--export-all-symbols)
|
||||
endif()
|
||||
|
||||
target_link_libraries(qbt_app PUBLIC dbghelp)
|
||||
else()
|
||||
target_sources(qbt_app PRIVATE stacktrace.h)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (GUI)
|
||||
target_link_libraries(qBittorrent PRIVATE qbt_gui)
|
||||
set_target_properties(qBittorrent
|
||||
PROPERTIES
|
||||
OUTPUT_NAME qbittorrent
|
||||
WIN32_EXECUTABLE True
|
||||
)
|
||||
set_target_properties(qbt_app PROPERTIES OUTPUT_NAME qbittorrent)
|
||||
target_link_libraries(qbt_app PRIVATE qbt_gui)
|
||||
else()
|
||||
set_target_properties(qBittorrent
|
||||
PROPERTIES
|
||||
OUTPUT_NAME qbittorrent-nox
|
||||
)
|
||||
set_target_properties(qbt_app PROPERTIES OUTPUT_NAME qbittorrent-nox)
|
||||
endif()
|
||||
|
||||
if (WEBUI)
|
||||
target_link_libraries(qBittorrent PRIVATE qbt_webui)
|
||||
endif()
|
||||
|
||||
# we have to include resources into the bundle
|
||||
if (APPLE)
|
||||
set(OSX_RES_SRC_DIR "${qBittorrent_SOURCE_DIR}/dist/mac")
|
||||
list(APPEND QBT_APP_RESOURCE_SOURCE
|
||||
"${OSX_RES_SRC_DIR}/qt.conf"
|
||||
"${OSX_RES_SRC_DIR}/qBitTorrentDocument.icns"
|
||||
"${OSX_RES_SRC_DIR}/qbittorrent_mac.icns")
|
||||
set_source_files_properties(
|
||||
"${OSX_RES_SRC_DIR}/qt.conf"
|
||||
"${OSX_RES_SRC_DIR}/qBitTorrentDocument.icns"
|
||||
"${OSX_RES_SRC_DIR}/qbittorrent_mac.icns"
|
||||
PROPERTIES
|
||||
MACOSX_PACKAGE_LOCATION Resources)
|
||||
set(QT_TR_DIR "${qBittorrent_SOURCE_DIR}/dist/qt-translations")
|
||||
|
||||
FILE(GLOB QT_TRANSLATIONS "${QT_TR_DIR}/qtbase_*.qm")
|
||||
list(APPEND QT_TRANSLATIONS
|
||||
${QT_TR_DIR}/qt_fa.qm
|
||||
${QT_TR_DIR}/qt_gl.qm
|
||||
${QT_TR_DIR}/qt_lt.qm
|
||||
${QT_TR_DIR}/qt_pt.qm
|
||||
${QT_TR_DIR}/qt_sl.qm
|
||||
${QT_TR_DIR}/qt_sv.qm
|
||||
${QT_TR_DIR}/qt_zh_CN.qm
|
||||
target_sources(qbt_app PRIVATE
|
||||
${QBT_WEBUI_QM_FILES}
|
||||
${qBittorrent_BINARY_DIR}/src/webui/www/translations/webui_translations.qrc # yes, it's supposed to be "*_BINARY_DIR"
|
||||
)
|
||||
list(APPEND QBT_APP_RESOURCE_SOURCE ${QT_TRANSLATIONS})
|
||||
set_source_files_properties(${QT_TRANSLATIONS} PROPERTIES MACOSX_PACKAGE_LOCATION translations)
|
||||
target_link_libraries(qbt_app PRIVATE qbt_webui)
|
||||
endif()
|
||||
|
||||
target_sources(qBittorrent PRIVATE ${QBT_QM_FILES} ${QBT_APP_RESOURCE_SOURCE})
|
||||
|
||||
get_target_property(QBT_EXECUTABLE_NAME qBittorrent OUTPUT_NAME)
|
||||
|
||||
if (APPLE)
|
||||
set(qbt_BUNDLE_NAME ${QBT_EXECUTABLE_NAME})
|
||||
|
||||
# substitute @EXECUTABLE@ in dist/mac/Info.plist
|
||||
set(EXECUTABLE ${qbt_BUNDLE_NAME})
|
||||
configure_file(${qBittorrent_SOURCE_DIR}/dist/mac/Info.plist ${qBittorrent_BINARY_DIR}/dist/mac/Info.plist @ONLY)
|
||||
|
||||
set_target_properties(qBittorrent PROPERTIES
|
||||
MACOSX_BUNDLE_BUNDLE_NAME "${qbt_BUNDLE_NAME}"
|
||||
MACOSX_BUNDLE_INFO_PLIST ${qBittorrent_BINARY_DIR}/dist/mac/Info.plist
|
||||
)
|
||||
if (GUI)
|
||||
if ((CMAKE_SYSTEM_NAME STREQUAL "Windows") OR (CMAKE_SYSTEM_NAME STREQUAL "Darwin"))
|
||||
qt5_import_plugins(qbt_app
|
||||
INCLUDE Qt5::QSvgIconPlugin
|
||||
INCLUDE Qt5::QSvgPlugin
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# installation
|
||||
install(TARGETS qBittorrent
|
||||
# Installation
|
||||
# -----------------------------------------------------------------------------
|
||||
# -----------------------------------------------------------------------------
|
||||
install(TARGETS qbt_app
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
BUNDLE DESTINATION .
|
||||
COMPONENT runtime
|
||||
)
|
||||
|
||||
if (GUI AND APPLE)
|
||||
find_package(Qt5Svg REQUIRED)
|
||||
include(bundle)
|
||||
if (MSVC)
|
||||
install(FILES $<TARGET_PDB_FILE:qbt_app>
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
OPTIONAL
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
find_package(ZLIB 1.2.5.2 REQUIRED)
|
||||
|
||||
add_library(qbt_base STATIC
|
||||
# headers
|
||||
algorithm.h
|
||||
@@ -162,18 +160,35 @@ add_library(qbt_base STATIC
|
||||
target_link_libraries(qbt_base
|
||||
PRIVATE
|
||||
ZLIB::ZLIB
|
||||
qbt_version_definitions
|
||||
PUBLIC
|
||||
LibtorrentRasterbar::torrent-rasterbar
|
||||
Qt5::Core Qt5::Network Qt5::Xml
|
||||
qbt_common_cfg
|
||||
)
|
||||
|
||||
if (Qt5DBus_FOUND)
|
||||
target_link_libraries(qbt_base PRIVATE Qt5::DBus)
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
find_library(IOKit_LIBRARY IOKit)
|
||||
find_library(Carbon_LIBRARY Carbon)
|
||||
find_library(AppKit_LIBRARY AppKit)
|
||||
target_link_libraries(qbt_base PRIVATE ${Carbon_LIBRARY} ${IOKit_LIBRARY} ${AppKit_LIBRARY})
|
||||
|
||||
target_link_libraries(qbt_base PRIVATE
|
||||
${AppKit_LIBRARY}
|
||||
${Carbon_LIBRARY}
|
||||
${IOKit_LIBRARY}
|
||||
)
|
||||
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
target_link_libraries(qbt_base PRIVATE Iphlpapi)
|
||||
endif()
|
||||
|
||||
if (NOT GUI)
|
||||
target_compile_definitions(qbt_base PUBLIC DISABLE_GUI)
|
||||
endif()
|
||||
|
||||
if (NOT WEBUI)
|
||||
target_compile_definitions(qbt_base PUBLIC DISABLE_WEBUI)
|
||||
endif()
|
||||
|
||||
if (DBUS)
|
||||
target_link_libraries(qbt_base PUBLIC Qt5::DBus)
|
||||
endif()
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#cmakedefine QBT_USE_GUI
|
||||
|
||||
#ifndef QBT_USE_GUI
|
||||
#define DISABLE_GUI
|
||||
#endif
|
||||
|
||||
#cmakedefine QBT_USE_WEBUI
|
||||
|
||||
#ifndef QBT_USE_WEBUI
|
||||
#define DISABLE_WEBUI
|
||||
#endif
|
||||
|
||||
#cmakedefine STACKTRACE_WIN
|
||||
@@ -1,6 +1,3 @@
|
||||
set(CMAKE_AUTORCC True)
|
||||
set(CMAKE_AUTOUIC True)
|
||||
|
||||
add_library(qbt_gui STATIC
|
||||
# headers
|
||||
aboutdialog.h
|
||||
@@ -80,7 +77,7 @@ add_library(qbt_gui STATIC
|
||||
uithememanager.h
|
||||
updownratiodialog.h
|
||||
utils.h
|
||||
|
||||
|
||||
# sources
|
||||
aboutdialog.cpp
|
||||
addnewtorrentdialog.cpp
|
||||
@@ -180,6 +177,7 @@ add_library(qbt_gui STATIC
|
||||
rss/rsswidget.ui
|
||||
search/pluginselectdialog.ui
|
||||
search/pluginsourcedialog.ui
|
||||
search/searchjobwidget.ui
|
||||
search/searchwidget.ui
|
||||
shutdownconfirmdialog.ui
|
||||
speedlimitdialog.ui
|
||||
@@ -188,33 +186,9 @@ add_library(qbt_gui STATIC
|
||||
torrentcreatordialog.ui
|
||||
trackerentriesdialog.ui
|
||||
updownratiodialog.ui
|
||||
|
||||
# resources
|
||||
about.qrc
|
||||
)
|
||||
|
||||
if (WIN32 OR APPLE)
|
||||
target_sources(qbt_gui PRIVATE programupdater.h programupdater.cpp)
|
||||
endif()
|
||||
|
||||
if (UNIX AND Qt5DBus_FOUND)
|
||||
target_link_libraries(qbt_gui PRIVATE Qt5::DBus)
|
||||
|
||||
target_sources(qbt_gui PRIVATE
|
||||
qtnotify/notifications.h
|
||||
qtnotify/notifications.cpp
|
||||
)
|
||||
|
||||
find_package(X11)
|
||||
if (X11_FOUND)
|
||||
target_sources(qbt_gui PRIVATE
|
||||
powermanagement/powermanagement_x11.h
|
||||
powermanagement/powermanagement_x11.cpp
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_include_directories(qbt_gui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_sources(qbt_gui INTERFACE about.qrc)
|
||||
|
||||
target_link_libraries(qbt_gui
|
||||
PRIVATE
|
||||
@@ -223,13 +197,36 @@ target_link_libraries(qbt_gui
|
||||
Qt5::Gui Qt5::Widgets
|
||||
)
|
||||
|
||||
if (APPLE)
|
||||
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)
|
||||
if (DBUS)
|
||||
target_sources(qbt_gui PRIVATE
|
||||
qtnotify/notifications.h
|
||||
qtnotify/notifications.cpp
|
||||
powermanagement/powermanagement_x11.h
|
||||
powermanagement/powermanagement_x11.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS WinExtras)
|
||||
target_link_libraries(qbt_gui PRIVATE Qt5::WinExtras PowrProf)
|
||||
if ((CMAKE_SYSTEM_NAME STREQUAL "Windows") OR (CMAKE_SYSTEM_NAME STREQUAL "Darwin"))
|
||||
target_sources(qbt_gui PRIVATE
|
||||
programupdater.h
|
||||
programupdater.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
target_link_libraries(qbt_gui PRIVATE
|
||||
Qt5::WinExtras
|
||||
PowrProf
|
||||
)
|
||||
endif()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
target_sources(qbt_gui PRIVATE
|
||||
macutilities.h
|
||||
macutilities.mm
|
||||
)
|
||||
target_link_libraries(qbt_gui PRIVATE
|
||||
Qt5::MacExtras
|
||||
objc
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "base/global.h"
|
||||
#include "base/rss/rss_article.h"
|
||||
#include "base/rss/rss_item.h"
|
||||
#include "uithememanager.h"
|
||||
#include "gui/uithememanager.h"
|
||||
|
||||
ArticleListWidget::ArticleListWidget(QWidget *parent)
|
||||
: QListWidget(parent)
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
add_library(qbt_webui STATIC
|
||||
# headers
|
||||
api/apicontroller.h
|
||||
api/apierror.h
|
||||
api/appcontroller.h
|
||||
api/authcontroller.h
|
||||
api/freediskspacechecker.h
|
||||
api/isessionmanager.h
|
||||
api/logcontroller.h
|
||||
api/rsscontroller.h
|
||||
api/searchcontroller.h
|
||||
api/synccontroller.h
|
||||
api/torrentscontroller.h
|
||||
api/transfercontroller.h
|
||||
api/serialize/serialize_torrent.h
|
||||
webapplication.h
|
||||
webui.h
|
||||
# headers
|
||||
api/apicontroller.h
|
||||
api/apierror.h
|
||||
api/appcontroller.h
|
||||
api/authcontroller.h
|
||||
api/freediskspacechecker.h
|
||||
api/isessionmanager.h
|
||||
api/logcontroller.h
|
||||
api/rsscontroller.h
|
||||
api/searchcontroller.h
|
||||
api/synccontroller.h
|
||||
api/torrentscontroller.h
|
||||
api/transfercontroller.h
|
||||
api/serialize/serialize_torrent.h
|
||||
webapplication.h
|
||||
webui.h
|
||||
|
||||
# sources
|
||||
api/apicontroller.cpp
|
||||
api/apierror.cpp
|
||||
api/appcontroller.cpp
|
||||
api/authcontroller.cpp
|
||||
api/freediskspacechecker.cpp
|
||||
api/logcontroller.cpp
|
||||
api/rsscontroller.cpp
|
||||
api/searchcontroller.cpp
|
||||
api/synccontroller.cpp
|
||||
api/torrentscontroller.cpp
|
||||
api/transfercontroller.cpp
|
||||
api/serialize/serialize_torrent.cpp
|
||||
webapplication.cpp
|
||||
webui.cpp
|
||||
# sources
|
||||
api/apicontroller.cpp
|
||||
api/apierror.cpp
|
||||
api/appcontroller.cpp
|
||||
api/authcontroller.cpp
|
||||
api/freediskspacechecker.cpp
|
||||
api/logcontroller.cpp
|
||||
api/rsscontroller.cpp
|
||||
api/searchcontroller.cpp
|
||||
api/synccontroller.cpp
|
||||
api/torrentscontroller.cpp
|
||||
api/transfercontroller.cpp
|
||||
api/serialize/serialize_torrent.cpp
|
||||
webapplication.cpp
|
||||
webui.cpp
|
||||
)
|
||||
|
||||
qbt_target_sources(qBittorrent PRIVATE www/webui.qrc)
|
||||
target_sources(qbt_webui INTERFACE www/webui.qrc)
|
||||
|
||||
target_link_libraries(qbt_webui PUBLIC qbt_base)
|
||||
target_link_libraries(qbt_webui PRIVATE qbt_base)
|
||||
|
||||
Reference in New Issue
Block a user