Browse Source

Merge pull request #12734 from glassez/project-cleanup

Cleanup project configuration
adaptive-webui-19844
Vladimir Golovnev 5 years ago committed by GitHub
parent
commit
2d1d1ba26a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      CMakeLists.txt
  2. 14
      cmake/Modules/MacroQbtCompilerSettings.cmake
  3. 8
      src/CMakeLists.txt
  4. 10
      src/app/CMakeLists.txt
  5. 92
      src/gui/CMakeLists.txt
  6. 47
      src/gui/gui.pri
  7. 11
      src/gui/log/CMakeLists.txt
  8. 8
      src/gui/powermanagement/CMakeLists.txt
  9. 7
      src/gui/powermanagement/powermanagement.pri
  10. 38
      src/gui/properties/CMakeLists.txt
  11. 36
      src/gui/properties/properties.pri
  12. 1
      src/gui/qtnotify/CMakeLists.txt
  13. 2
      src/gui/qtnotify/qtnotify.pri
  14. 19
      src/gui/rss/CMakeLists.txt
  15. 22
      src/gui/search/CMakeLists.txt

2
CMakeLists.txt

@ -7,7 +7,7 @@ if (POLICY CMP0074) @@ -7,7 +7,7 @@ if (POLICY CMP0074)
endif()
# TODO: fix the macOS bundle stuff
if(POLICY CMP0080)
if (POLICY CMP0080)
cmake_policy(SET CMP0080 OLD)
endif()

14
cmake/Modules/MacroQbtCompilerSettings.cmake

@ -1,12 +1,12 @@ @@ -1,12 +1,12 @@
# Sets cache variable QBT_ADDITONAL_FLAGS and QBT_ADDITONAL_CXX_FLAGS to list of additional
# compiler flags for C and C++ (QBT_ADDITONAL_FLAGS) and for C++ only (QBT_ADDITONAL_CXX_FLAGS)
# Sets cache variable QBT_ADDITIONAL_FLAGS and QBT_ADDITONAL_CXX_FLAGS to list of additional
# compiler flags for C and C++ (QBT_ADDITIONAL_FLAGS) and for C++ only (QBT_ADDITONAL_CXX_FLAGS)
# and appends them to CMAKE_XXX_FLAGS variables.
# It could use add_compile_options(), but then it is needed to use generator expressions,
# and most interesting of them are not compatible with Visual Studio :(
macro(qbt_set_compiler_options)
# if (NOT QBT_ADDITONAL_FLAGS)
# if (NOT QBT_ADDITIONAL_FLAGS)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
#-Wshadow -Wconversion ?
set(_GCC_COMMON_C_AND_CXX_FLAGS "-Wall -Wextra"
@ -59,11 +59,11 @@ macro(qbt_set_compiler_options) @@ -59,11 +59,11 @@ macro(qbt_set_compiler_options)
endif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(QBT_ADDITONAL_FLAGS "/wd4251 /wd4275 /wd4290 /W4" CACHE STRING "Additional qBittorent compile flags")
set(QBT_ADDITIONAL_FLAGS "/wd4251 /wd4275 /wd4290 /W4" CACHE STRING "Additional qBittorent compile flags")
endif ()
string(APPEND CMAKE_C_FLAGS " ${QBT_ADDITONAL_FLAGS}")
string(APPEND CMAKE_CXX_FLAGS " ${QBT_ADDITONAL_FLAGS}")
string(APPEND CMAKE_C_FLAGS " ${QBT_ADDITIONAL_FLAGS}")
string(APPEND CMAKE_CXX_FLAGS " ${QBT_ADDITIONAL_FLAGS}")
# endif (NOT QBT_ADDITONAL_FLAGS)
# endif (NOT QBT_ADDITIONAL_FLAGS)
endmacro(qbt_set_compiler_options)

8
src/CMakeLists.txt

@ -12,11 +12,9 @@ if (Boost_VERSION VERSION_LESS 106000) @@ -12,11 +12,9 @@ if (Boost_VERSION VERSION_LESS 106000)
endif()
find_package(Qt5 ${requiredQtVersion} REQUIRED COMPONENTS Core Network Xml LinguistTools)
if (NOT DISABLE_GUI)
if (GUI)
find_package(Qt5Widgets ${requiredQtVersion} REQUIRED)
find_package(Qt5DBus ${requiredQtVersion})
else()
add_definitions(-DDISABLE_GUI)
endif()
set_package_properties(Qt5DBus PROPERTIES
@ -54,10 +52,10 @@ configure_file(config.h.cmakein ${CMAKE_CURRENT_BINARY_DIR}/config.h) @@ -54,10 +52,10 @@ configure_file(config.h.cmakein ${CMAKE_CURRENT_BINARY_DIR}/config.h)
add_subdirectory(app)
add_subdirectory(base)
if (NOT DISABLE_GUI)
if (GUI)
add_subdirectory(gui)
endif ()
if (NOT DISABLE_WEBUI)
if (WEBUI)
add_subdirectory(webui)
endif()

10
src/app/CMakeLists.txt

@ -34,7 +34,7 @@ include(QbtTranslations) @@ -34,7 +34,7 @@ include(QbtTranslations)
file(GLOB QBT_TS_FILES ../lang/*.ts)
qbt_add_translations(qBittorrent QRC_FILE "../lang/lang.qrc" TS_FILES ${QBT_TS_FILES})
if (NOT DISABLE_WEBUI)
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()
@ -63,7 +63,7 @@ if (STACKTRACE) @@ -63,7 +63,7 @@ if (STACKTRACE)
target_sources(qBittorrent PRIVATE stacktrace.h)
else()
target_sources(qBittorrent PRIVATE stacktrace_win.h)
if (NOT DISABLE_GUI)
if (GUI)
target_sources(qBittorrent PRIVATE stacktracedialog.cpp stacktracedialog.h)
endif()
@ -85,7 +85,7 @@ if (STACKTRACE) @@ -85,7 +85,7 @@ if (STACKTRACE)
endif()
endif()
if (NOT DISABLE_GUI)
if (GUI)
target_link_libraries(qBittorrent PRIVATE qbt_gui)
set_target_properties(qBittorrent
PROPERTIES
@ -99,7 +99,7 @@ else() @@ -99,7 +99,7 @@ else()
)
endif()
if (NOT DISABLE_WEBUI)
if (WEBUI)
target_link_libraries(qBittorrent PRIVATE qbt_webui)
endif()
@ -156,7 +156,7 @@ install(TARGETS qBittorrent @@ -156,7 +156,7 @@ install(TARGETS qBittorrent
COMPONENT runtime
)
if (NOT DISABLE_GUI AND APPLE)
if (GUI AND APPLE)
find_package(Qt5Svg REQUIRED)
include(bundle)
endif()

92
src/gui/CMakeLists.txt

@ -20,14 +20,43 @@ add_library(qbt_gui STATIC @@ -20,14 +20,43 @@ add_library(qbt_gui STATIC
hidabletabwidget.h
ipsubnetwhitelistoptionsdialog.h
lineedit.h
log/logfiltermodel.h
log/loglistview.h
log/logmodel.h
mainwindow.h
optionsdialog.h
powermanagement/powermanagement.h
previewlistdelegate.h
previewselectdialog.h
private/fspathedit_p.h
private/tristatewidget.h
properties/downloadedpiecesbar.h
properties/peerlistdelegate.h
properties/peerlistsortmodel.h
properties/peerlistwidget.h
properties/peersadditiondialog.h
properties/pieceavailabilitybar.h
properties/piecesbar.h
properties/propertieswidget.h
properties/proplistdelegate.h
properties/proptabbar.h
properties/speedplotview.h
properties/speedwidget.h
properties/trackerlistwidget.h
properties/trackersadditiondialog.h
raisedmessagebox.h
rss/articlelistwidget.h
rss/automatedrssdownloader.h
rss/feedlistwidget.h
rss/htmlbrowser.h
rss/rsswidget.h
scanfoldersdelegate.h
search/pluginselectdialog.h
search/pluginsourcedialog.h
search/searchjobwidget.h
search/searchlistdelegate.h
search/searchsortmodel.h
search/searchwidget.h
shutdownconfirmdialog.h
speedlimitdialog.h
statsdialog.h
@ -72,14 +101,43 @@ add_library(qbt_gui STATIC @@ -72,14 +101,43 @@ add_library(qbt_gui STATIC
hidabletabwidget.cpp
ipsubnetwhitelistoptionsdialog.cpp
lineedit.cpp
log/logfiltermodel.cpp
log/loglistview.cpp
log/logmodel.cpp
mainwindow.cpp
optionsdialog.cpp
powermanagement/powermanagement.cpp
previewlistdelegate.cpp
previewselectdialog.cpp
private/fspathedit_p.cpp
private/tristatewidget.cpp
properties/downloadedpiecesbar.cpp
properties/peerlistdelegate.cpp
properties/peerlistsortmodel.cpp
properties/peerlistwidget.cpp
properties/peersadditiondialog.cpp
properties/pieceavailabilitybar.cpp
properties/piecesbar.cpp
properties/propertieswidget.cpp
properties/proplistdelegate.cpp
properties/proptabbar.cpp
properties/speedplotview.cpp
properties/speedwidget.cpp
properties/trackerlistwidget.cpp
properties/trackersadditiondialog.cpp
raisedmessagebox.cpp
rss/articlelistwidget.cpp
rss/automatedrssdownloader.cpp
rss/feedlistwidget.cpp
rss/htmlbrowser.cpp
rss/rsswidget.cpp
scanfoldersdelegate.cpp
search/pluginselectdialog.cpp
search/pluginsourcedialog.cpp
search/searchjobwidget.cpp
search/searchlistdelegate.cpp
search/searchsortmodel.cpp
search/searchwidget.cpp
shutdownconfirmdialog.cpp
speedlimitdialog.cpp
statsdialog.cpp
@ -119,6 +177,14 @@ add_library(qbt_gui STATIC @@ -119,6 +177,14 @@ add_library(qbt_gui STATIC
mainwindow.ui
optionsdialog.ui
previewselectdialog.ui
properties/peersadditiondialog.ui
properties/propertieswidget.ui
properties/trackersadditiondialog.ui
rss/automatedrssdownloader.ui
rss/rsswidget.ui
search/pluginselectdialog.ui
search/pluginsourcedialog.ui
search/searchwidget.ui
shutdownconfirmdialog.ui
speedlimitdialog.ui
statsdialog.ui
@ -126,7 +192,7 @@ add_library(qbt_gui STATIC @@ -126,7 +192,7 @@ add_library(qbt_gui STATIC
torrentcreatordialog.ui
trackerentriesdialog.ui
updownratiodialog.ui
# resources
about.qrc
)
@ -135,17 +201,25 @@ if (WIN32 OR APPLE) @@ -135,17 +201,25 @@ if (WIN32 OR APPLE)
target_sources(qbt_gui PRIVATE programupdater.h programupdater.cpp)
endif()
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 Qt5::DBus)
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_link_libraries(qbt_gui
PRIVATE
qbt_base

47
src/gui/gui.pri

@ -1,9 +1,5 @@ @@ -1,9 +1,5 @@
INCLUDEPATH += $$PWD
include(powermanagement/powermanagement.pri)
include(properties/properties.pri)
unix:!macx:dbus: include(qtnotify/qtnotify.pri)
HEADERS += \
$$PWD/aboutdialog.h \
$$PWD/addnewtorrentdialog.h \
@ -27,10 +23,25 @@ HEADERS += \ @@ -27,10 +23,25 @@ HEADERS += \
$$PWD/log/logmodel.h \
$$PWD/mainwindow.h \
$$PWD/optionsdialog.h \
$$PWD/powermanagement/powermanagement.h \
$$PWD/previewlistdelegate.h \
$$PWD/previewselectdialog.h \
$$PWD/private/fspathedit_p.h \
$$PWD/private/tristatewidget.h \
$$PWD/properties/downloadedpiecesbar.h \
$$PWD/properties/peerlistdelegate.h \
$$PWD/properties/peerlistsortmodel.h \
$$PWD/properties/peerlistwidget.h \
$$PWD/properties/peersadditiondialog.h \
$$PWD/properties/pieceavailabilitybar.h \
$$PWD/properties/piecesbar.h \
$$PWD/properties/propertieswidget.h \
$$PWD/properties/proplistdelegate.h \
$$PWD/properties/proptabbar.h \
$$PWD/properties/speedplotview.h \
$$PWD/properties/speedwidget.h \
$$PWD/properties/trackerlistwidget.h \
$$PWD/properties/trackersadditiondialog.h \
$$PWD/raisedmessagebox.h \
$$PWD/rss/articlelistwidget.h \
$$PWD/rss/automatedrssdownloader.h \
@ -93,10 +104,25 @@ SOURCES += \ @@ -93,10 +104,25 @@ SOURCES += \
$$PWD/log/logmodel.cpp \
$$PWD/mainwindow.cpp \
$$PWD/optionsdialog.cpp \
$$PWD/powermanagement/powermanagement.cpp \
$$PWD/previewlistdelegate.cpp \
$$PWD/previewselectdialog.cpp \
$$PWD/private/fspathedit_p.cpp \
$$PWD/private/tristatewidget.cpp \
$$PWD/properties/downloadedpiecesbar.cpp \
$$PWD/properties/peerlistdelegate.cpp \
$$PWD/properties/peerlistsortmodel.cpp \
$$PWD/properties/peerlistwidget.cpp \
$$PWD/properties/peersadditiondialog.cpp \
$$PWD/properties/pieceavailabilitybar.cpp \
$$PWD/properties/piecesbar.cpp \
$$PWD/properties/propertieswidget.cpp \
$$PWD/properties/proplistdelegate.cpp \
$$PWD/properties/proptabbar.cpp \
$$PWD/properties/speedplotview.cpp \
$$PWD/properties/speedwidget.cpp \
$$PWD/properties/trackerlistwidget.cpp \
$$PWD/properties/trackersadditiondialog.cpp \
$$PWD/raisedmessagebox.cpp \
$$PWD/rss/articlelistwidget.cpp \
$$PWD/rss/automatedrssdownloader.cpp \
@ -141,6 +167,16 @@ win32|macx { @@ -141,6 +167,16 @@ win32|macx {
SOURCES += $$PWD/programupdater.cpp
}
unix:!macx:dbus {
HEADERS += \
$$PWD/powermanagement/powermanagement_x11.h \
$$PWD/qtnotify/notifications.h
SOURCES += \
$$PWD/powermanagement/powermanagement_x11.cpp \
$$PWD/qtnotify/notifications.cpp
}
macx {
HEADERS += $$PWD/macutilities.h
OBJECTIVE_SOURCES += $$PWD/macutilities.mm
@ -159,6 +195,9 @@ FORMS += \ @@ -159,6 +195,9 @@ FORMS += \
$$PWD/mainwindow.ui \
$$PWD/optionsdialog.ui \
$$PWD/previewselectdialog.ui \
$$PWD/properties/peersadditiondialog.ui \
$$PWD/properties/propertieswidget.ui \
$$PWD/properties/trackersadditiondialog.ui \
$$PWD/rss/automatedrssdownloader.ui \
$$PWD/rss/rsswidget.ui \
$$PWD/search/pluginselectdialog.ui \

11
src/gui/log/CMakeLists.txt

@ -1,11 +0,0 @@ @@ -1,11 +0,0 @@
target_sources(qbt_gui PRIVATE
# headers
logfiltermodel.h
loglistview.h
logmodel.h
#sources
logfiltermodel.cpp
loglistview.cpp
logmodel.cpp
)

8
src/gui/powermanagement/CMakeLists.txt

@ -1,8 +0,0 @@ @@ -1,8 +0,0 @@
target_sources(qbt_gui PRIVATE powermanagement.h powermanagement.cpp)
if (UNIX AND Qt5DBus_FOUND)
find_package(X11)
if (X11_FOUND)
target_sources(qbt_gui PRIVATE powermanagement_x11.h powermanagement_x11.cpp)
endif()
endif()

7
src/gui/powermanagement/powermanagement.pri

@ -1,7 +0,0 @@ @@ -1,7 +0,0 @@
HEADERS += $$PWD/powermanagement.h
SOURCES += $$PWD/powermanagement.cpp
unix:!macx:dbus {
HEADERS += $$PWD/powermanagement_x11.h
SOURCES += $$PWD/powermanagement_x11.cpp
}

38
src/gui/properties/CMakeLists.txt

@ -1,38 +0,0 @@ @@ -1,38 +0,0 @@
target_sources(qbt_gui PRIVATE
# headers
downloadedpiecesbar.h
peerlistdelegate.h
peerlistsortmodel.h
peerlistwidget.h
peersadditiondialog.h
pieceavailabilitybar.h
piecesbar.h
propertieswidget.h
proplistdelegate.h
proptabbar.h
speedplotview.h
speedwidget.h
trackerlistwidget.h
trackersadditiondialog.h
# sources
downloadedpiecesbar.cpp
peerlistdelegate.cpp
peerlistsortmodel.cpp
peerlistwidget.cpp
peersadditiondialog.cpp
pieceavailabilitybar.cpp
piecesbar.cpp
propertieswidget.cpp
proplistdelegate.cpp
proptabbar.cpp
speedplotview.cpp
speedwidget.cpp
trackerlistwidget.cpp
trackersadditiondialog.cpp
# forms
peersadditiondialog.ui
propertieswidget.ui
trackersadditiondialog.ui
)

36
src/gui/properties/properties.pri

@ -1,36 +0,0 @@ @@ -1,36 +0,0 @@
FORMS += \
$$PWD/peersadditiondialog.ui \
$$PWD/propertieswidget.ui \
$$PWD/trackersadditiondialog.ui
HEADERS += \
$$PWD/downloadedpiecesbar.h \
$$PWD/peerlistdelegate.h \
$$PWD/peerlistsortmodel.h \
$$PWD/peerlistwidget.h \
$$PWD/peersadditiondialog.h \
$$PWD/pieceavailabilitybar.h \
$$PWD/piecesbar.h \
$$PWD/propertieswidget.h \
$$PWD/proplistdelegate.h \
$$PWD/proptabbar.h \
$$PWD/speedplotview.h \
$$PWD/speedwidget.h \
$$PWD/trackerlistwidget.h \
$$PWD/trackersadditiondialog.h
SOURCES += \
$$PWD/downloadedpiecesbar.cpp \
$$PWD/peerlistdelegate.cpp \
$$PWD/peerlistsortmodel.cpp \
$$PWD/peerlistwidget.cpp \
$$PWD/peersadditiondialog.cpp \
$$PWD/pieceavailabilitybar.cpp \
$$PWD/piecesbar.cpp \
$$PWD/propertieswidget.cpp \
$$PWD/proplistdelegate.cpp \
$$PWD/proptabbar.cpp \
$$PWD/speedplotview.cpp \
$$PWD/speedwidget.cpp \
$$PWD/trackerlistwidget.cpp \
$$PWD/trackersadditiondialog.cpp

1
src/gui/qtnotify/CMakeLists.txt

@ -1 +0,0 @@ @@ -1 +0,0 @@
target_sources(qbt_gui PRIVATE notifications.h notifications.cpp)

2
src/gui/qtnotify/qtnotify.pri

@ -1,2 +0,0 @@ @@ -1,2 +0,0 @@
HEADERS += $$PWD/notifications.h
SOURCES += $$PWD/notifications.cpp

19
src/gui/rss/CMakeLists.txt

@ -1,19 +0,0 @@ @@ -1,19 +0,0 @@
target_sources(qbt_gui PRIVATE
# headers
articlelistwidget.h
automatedrssdownloader.h
feedlistwidget.h
htmlbrowser.h
rsswidget.h
#sources
articlelistwidget.cpp
automatedrssdownloader.cpp
feedlistwidget.cpp
htmlbrowser.cpp
rsswidget.cpp
# forms
automatedrssdownloader.ui
rsswidget.ui
)

22
src/gui/search/CMakeLists.txt

@ -1,22 +0,0 @@ @@ -1,22 +0,0 @@
target_sources(qbt_gui PRIVATE
# headers
pluginselectdialog.h
pluginsourcedialog.h
searchjobwidget.h
searchlistdelegate.h
searchsortmodel.h
searchwidget.h
# sources
pluginselectdialog.cpp
pluginsourcedialog.cpp
searchjobwidget.cpp
searchlistdelegate.cpp
searchsortmodel.cpp
searchwidget.cpp
# forms
pluginselectdialog.ui
pluginsourcedialog.ui
searchwidget.ui
)
Loading…
Cancel
Save