mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-14 02:27:09 -07:00
CMake: Don't split GUI code into several libraries
This commit is contained in:
parent
4a2d25b03b
commit
642bf7b8a6
13 changed files with 437 additions and 506 deletions
|
@ -47,7 +47,7 @@ set(requiredLibtorrentVersion 1.1.10)
|
|||
|
||||
if (WIN32)
|
||||
include(winconf)
|
||||
endif(WIN32)
|
||||
endif()
|
||||
|
||||
|
||||
# we need options here, at the top level, because they are used not only in "src" subdir, but in the "dist" dir too
|
||||
|
|
9
dist/CMakeLists.txt
vendored
9
dist/CMakeLists.txt
vendored
|
@ -2,11 +2,8 @@ find_package(Qt5Widgets ${requiredQtVersion}) # to conditionally install desktop
|
|||
|
||||
if (APPLE)
|
||||
add_subdirectory(mac)
|
||||
else (APPLE)
|
||||
if (UNIX)
|
||||
elseif (UNIX)
|
||||
add_subdirectory(unix)
|
||||
endif (UNIX)
|
||||
if (WIN32)
|
||||
elseif (WIN32)
|
||||
add_subdirectory(windows)
|
||||
endif (WIN32)
|
||||
endif (APPLE)
|
||||
endif()
|
||||
|
|
|
@ -18,10 +18,7 @@ upgrade.cpp
|
|||
)
|
||||
|
||||
target_include_directories(qBittorrent PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
target_link_libraries(qBittorrent
|
||||
PRIVATE
|
||||
qbt_base
|
||||
)
|
||||
target_link_libraries(qBittorrent PRIVATE qbt_base)
|
||||
|
||||
set_target_properties(qBittorrent
|
||||
PROPERTIES
|
||||
|
@ -53,49 +50,53 @@ qt5_add_resources(QBT_APP_RESOURCE_SOURCE ${QBT_APP_RESOURCES})
|
|||
if (WIN32)
|
||||
if (MINGW)
|
||||
target_sources(qBittorrent PRIVATE ../qbittorrent_mingw.rc)
|
||||
else (MINGW)
|
||||
else()
|
||||
target_sources(qBittorrent PRIVATE ../qbittorrent.rc)
|
||||
endif (MINGW)
|
||||
endif()
|
||||
|
||||
target_sources(qBittorrent PRIVATE ../qbittorrent.exe.manifest)
|
||||
endif (WIN32)
|
||||
endif()
|
||||
|
||||
if (STACKTRACE)
|
||||
if (UNIX)
|
||||
target_sources(qBittorrent PRIVATE stacktrace.h)
|
||||
else (UNIX)
|
||||
else()
|
||||
target_sources(qBittorrent PRIVATE stacktrace_win.h)
|
||||
if (Qt5Widgets_FOUND)
|
||||
target_sources(qBittorrent PRIVATE stacktracedialog.cpp stacktracedialog.h)
|
||||
endif (Qt5Widgets_FOUND)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
if (NOT "${WINXXBITS}" STREQUAL "Win64")
|
||||
# i686 arch requires frame pointer preservation
|
||||
add_compile_options(-Oy-)
|
||||
endif (NOT "${WINXXBITS}" STREQUAL "Win64")
|
||||
endif()
|
||||
|
||||
add_compile_options(-Zi)
|
||||
target_link_libraries(qBittorrent PUBLIC dbghelp -DEBUG)
|
||||
else (MSVC)
|
||||
else()
|
||||
if (NOT "${WINXXBITS}" STREQUAL "Win64")
|
||||
add_compile_options(-fno-omit-frame-pointer)
|
||||
endif (NOT "${WINXXBITS}" STREQUAL "Win64")
|
||||
endif()
|
||||
|
||||
target_link_libraries(qBittorrent PUBLIC dbghelp -Wl,--export-all-symbols)
|
||||
endif (MSVC)
|
||||
endif (UNIX)
|
||||
endif (STACKTRACE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (Qt5Widgets_FOUND)
|
||||
target_link_libraries(qBittorrent PRIVATE qbt_searchengine qbt_gui)
|
||||
target_link_libraries(qBittorrent PRIVATE qbt_gui)
|
||||
set_target_properties(qBittorrent
|
||||
PROPERTIES
|
||||
OUTPUT_NAME qbittorrent
|
||||
WIN32_EXECUTABLE True
|
||||
)
|
||||
else(Qt5Widgets_FOUND)
|
||||
else()
|
||||
set_target_properties(qBittorrent
|
||||
PROPERTIES
|
||||
OUTPUT_NAME qbittorrent-nox
|
||||
)
|
||||
endif (Qt5Widgets_FOUND)
|
||||
endif()
|
||||
|
||||
if (NOT DISABLE_WEBUI)
|
||||
target_link_libraries(qBittorrent PRIVATE qbt_webui)
|
||||
|
@ -127,9 +128,8 @@ if (APPLE)
|
|||
${QT_TR_DIR}/qt_zh_CN.qm
|
||||
)
|
||||
list(APPEND QBT_APP_RESOURCE_SOURCE ${QT_TRANSLATIONS})
|
||||
set_source_files_properties(${QT_TRANSLATIONS}
|
||||
PROPERTIES MACOSX_PACKAGE_LOCATION translations)
|
||||
endif (APPLE)
|
||||
set_source_files_properties(${QT_TRANSLATIONS} PROPERTIES MACOSX_PACKAGE_LOCATION translations)
|
||||
endif()
|
||||
|
||||
target_sources(qBittorrent PRIVATE ${QBT_QM_FILES} ${QBT_APP_RESOURCE_SOURCE})
|
||||
|
||||
|
@ -146,15 +146,16 @@ if (APPLE)
|
|||
MACOSX_BUNDLE_BUNDLE_NAME "${qbt_BUNDLE_NAME}"
|
||||
MACOSX_BUNDLE_INFO_PLIST ${qBittorrent_BINARY_DIR}/dist/mac/Info.plist
|
||||
)
|
||||
endif (APPLE)
|
||||
endif()
|
||||
|
||||
# installation
|
||||
install(TARGETS qBittorrent
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
BUNDLE DESTINATION .
|
||||
COMPONENT runtime)
|
||||
COMPONENT runtime
|
||||
)
|
||||
|
||||
if (Qt5Widgets_FOUND AND APPLE)
|
||||
find_package(Qt5Svg REQUIRED)
|
||||
include(bundle)
|
||||
endif (Qt5Widgets_FOUND AND APPLE)
|
||||
endif()
|
||||
|
|
|
@ -164,10 +164,6 @@ target_link_libraries(qbt_base
|
|||
Qt5::Core Qt5::Network Qt5::Xml
|
||||
)
|
||||
|
||||
if (Qt5Widgets_FOUND)
|
||||
target_link_libraries(qbt_base PUBLIC Qt5::Gui Qt5::Widgets)
|
||||
endif (Qt5Widgets_FOUND)
|
||||
|
||||
if (Qt5DBus_FOUND)
|
||||
target_link_libraries(qbt_base PRIVATE Qt5::DBus)
|
||||
endif()
|
||||
|
@ -177,4 +173,4 @@ if (APPLE)
|
|||
find_library(Carbon_LIBRARY Carbon)
|
||||
find_library(AppKit_LIBRARY AppKit)
|
||||
target_link_libraries(qbt_base PRIVATE ${Carbon_LIBRARY} ${IOKit_LIBRARY} ${AppKit_LIBRARY})
|
||||
endif (APPLE)
|
||||
endif()
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <shlobj.h>
|
||||
#endif
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDateTime>
|
||||
#include <QDir>
|
||||
#include <QLocale>
|
||||
|
@ -47,12 +48,6 @@
|
|||
#include <QTime>
|
||||
#include <QVariant>
|
||||
|
||||
#ifndef DISABLE_GUI
|
||||
#include <QApplication>
|
||||
#else
|
||||
#include <QCoreApplication>
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include <QRegularExpression>
|
||||
#endif
|
||||
|
|
|
@ -1,14 +1,6 @@
|
|||
set(CMAKE_AUTORCC True)
|
||||
set(CMAKE_AUTOUIC True)
|
||||
|
||||
add_library(qbt_gui_headers INTERFACE)
|
||||
target_include_directories(qbt_gui_headers INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
add_subdirectory(properties)
|
||||
add_subdirectory(powermanagement)
|
||||
add_subdirectory(rss)
|
||||
add_subdirectory(search)
|
||||
|
||||
add_library(qbt_gui STATIC
|
||||
# headers
|
||||
aboutdialog.h
|
||||
|
@ -28,9 +20,6 @@ fspathedit.h
|
|||
hidabletabwidget.h
|
||||
ipsubnetwhitelistoptionsdialog.h
|
||||
lineedit.h
|
||||
log/logfiltermodel.h
|
||||
log/loglistview.h
|
||||
log/logmodel.h
|
||||
mainwindow.h
|
||||
optionsdialog.h
|
||||
previewlistdelegate.h
|
||||
|
@ -83,9 +72,6 @@ fspathedit.cpp
|
|||
hidabletabwidget.cpp
|
||||
ipsubnetwhitelistoptionsdialog.cpp
|
||||
lineedit.cpp
|
||||
log/logfiltermodel.cpp
|
||||
log/loglistview.cpp
|
||||
log/logmodel.cpp
|
||||
mainwindow.cpp
|
||||
optionsdialog.cpp
|
||||
previewlistdelegate.cpp
|
||||
|
@ -140,37 +126,40 @@ torrentcategorydialog.ui
|
|||
torrentcreatordialog.ui
|
||||
trackerentriesdialog.ui
|
||||
updownratiodialog.ui
|
||||
|
||||
# resources
|
||||
about.qrc
|
||||
)
|
||||
|
||||
target_link_libraries(qbt_gui
|
||||
PRIVATE
|
||||
qbt_powermanagement qbt_rss qbt_properties qbt_searchengine
|
||||
qbt_base
|
||||
)
|
||||
if (WIN32 OR APPLE)
|
||||
target_sources(qbt_gui PRIVATE programupdater.h programupdater.cpp)
|
||||
endif()
|
||||
|
||||
target_include_directories(qbt_gui
|
||||
PRIVATE ../app
|
||||
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
add_subdirectory(log)
|
||||
add_subdirectory(properties)
|
||||
add_subdirectory(powermanagement)
|
||||
add_subdirectory(rss)
|
||||
add_subdirectory(search)
|
||||
|
||||
if (UNIX AND Qt5DBus_FOUND)
|
||||
add_subdirectory(qtnotify)
|
||||
target_link_libraries(qbt_gui PRIVATE qbt_qtnotify)
|
||||
endif (UNIX AND Qt5DBus_FOUND)
|
||||
target_link_libraries(qbt_gui PRIVATE Qt5::DBus)
|
||||
endif()
|
||||
|
||||
target_link_libraries(qbt_gui
|
||||
PRIVATE
|
||||
qbt_base
|
||||
PUBLIC
|
||||
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)
|
||||
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)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS WinExtras)
|
||||
target_link_libraries(qbt_gui PRIVATE Qt5::WinExtras)
|
||||
endif(WIN32)
|
||||
target_link_libraries(qbt_gui PRIVATE Qt5::WinExtras PowrProf)
|
||||
endif()
|
||||
|
|
11
src/gui/log/CMakeLists.txt
Normal file
11
src/gui/log/CMakeLists.txt
Normal file
|
@ -0,0 +1,11 @@
|
|||
target_sources(qbt_gui PRIVATE
|
||||
# headers
|
||||
logfiltermodel.h
|
||||
loglistview.h
|
||||
logmodel.h
|
||||
|
||||
#sources
|
||||
logfiltermodel.cpp
|
||||
loglistview.cpp
|
||||
logmodel.cpp
|
||||
)
|
|
@ -1,23 +1,8 @@
|
|||
add_library(qbt_powermanagement STATIC
|
||||
# headers
|
||||
powermanagement.h
|
||||
|
||||
# sources
|
||||
powermanagement.cpp
|
||||
)
|
||||
|
||||
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})
|
||||
target_sources(qbt_gui PRIVATE powermanagement.h powermanagement.cpp)
|
||||
|
||||
if (UNIX AND Qt5DBus_FOUND)
|
||||
find_package(X11)
|
||||
if (X11_FOUND)
|
||||
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 Qt5DBus_FOUND)
|
||||
|
||||
if (WIN32)
|
||||
target_link_libraries(qbt_powermanagement PRIVATE PowrProf)
|
||||
endif (WIN32)
|
||||
target_sources(qbt_gui PRIVATE powermanagement_x11.h powermanagement_x11.cpp)
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
add_library(qbt_properties STATIC
|
||||
target_sources(qbt_gui PRIVATE
|
||||
# headers
|
||||
downloadedpiecesbar.h
|
||||
peerlistdelegate.h
|
||||
|
@ -36,17 +36,3 @@ peersadditiondialog.ui
|
|||
propertieswidget.ui
|
||||
trackersadditiondialog.ui
|
||||
)
|
||||
|
||||
target_link_libraries(qbt_properties
|
||||
PRIVATE
|
||||
qbt_gui_headers
|
||||
PUBLIC
|
||||
qbt_base Qt5::Widgets
|
||||
)
|
||||
|
||||
target_include_directories(qbt_properties
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
|
|
@ -1,11 +1 @@
|
|||
add_library(qbt_qtnotify STATIC
|
||||
# headers
|
||||
notifications.h
|
||||
|
||||
# sources
|
||||
notifications.cpp
|
||||
)
|
||||
|
||||
set_target_properties(qbt_qtnotify PROPERTIES AUTOUIC False AUTORCC False)
|
||||
target_link_libraries(qbt_qtnotify PUBLIC Qt5::DBus)
|
||||
target_include_directories(qbt_qtnotify PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_sources(qbt_gui PRIVATE notifications.h notifications.cpp)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
add_library(qbt_rss STATIC
|
||||
target_sources(qbt_gui PRIVATE
|
||||
# headers
|
||||
articlelistwidget.h
|
||||
automatedrssdownloader.h
|
||||
|
@ -17,11 +17,3 @@ rsswidget.cpp
|
|||
automatedrssdownloader.ui
|
||||
rsswidget.ui
|
||||
)
|
||||
|
||||
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,4 +1,4 @@
|
|||
add_library(qbt_searchengine STATIC
|
||||
target_sources(qbt_gui PRIVATE
|
||||
# headers
|
||||
pluginselectdialog.h
|
||||
pluginsourcedialog.h
|
||||
|
@ -20,14 +20,3 @@ pluginselectdialog.ui
|
|||
pluginsourcedialog.ui
|
||||
searchwidget.ui
|
||||
)
|
||||
|
||||
set(QBT_SEARCHENGINE_RESOURCES
|
||||
# search.qrc
|
||||
)
|
||||
|
||||
target_link_libraries(qbt_searchengine
|
||||
PUBLIC
|
||||
qbt_base
|
||||
PRIVATE
|
||||
qbt_gui_headers
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue