mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-23 16:58:06 -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,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)
|
||||
|
||||
Reference in New Issue
Block a user