qBittorrent/src/app/CMakeLists.txt

163 lines
4.7 KiB
Text
Raw Normal View History

add_executable(qBittorrent
# headers
application.h
applicationinstancemanager.h
cmdoptions.h
filelogger.h
qtlocalpeer/qtlocalpeer.h
upgrade.h
# sources
application.cpp
applicationinstancemanager.cpp
cmdoptions.cpp
filelogger.cpp
main.cpp
qtlocalpeer/qtlocalpeer.cpp
upgrade.cpp
2015-11-06 21:03:18 +03:00
)
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}"
)
2015-11-06 21:03:18 +03:00
# translations
include(QbtTranslations)
2015-11-06 21:03:18 +03:00
file(GLOB QBT_TS_FILES ../lang/*.ts)
qbt_add_translations(qBittorrent QRC_FILE "../lang/lang.qrc" TS_FILES ${QBT_TS_FILES})
2015-11-06 21:03:18 +03:00
if (NOT DISABLE_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()
2015-11-06 21:03:18 +03:00
set(QBT_APP_RESOURCES
../icons/icons.qrc
../searchengine/searchengine.qrc
2015-11-06 21:03:18 +03:00
)
# With AUTORCC rcc is ran by cmake before language files are generated,
# and thus we call rcc explicitly
2017-03-15 16:20:28 +03:00
qt5_add_resources(QBT_APP_RESOURCE_SOURCE ${QBT_APP_RESOURCES})
2015-11-06 21:03:18 +03:00
if (WIN32)
if (MINGW)
target_sources(qBittorrent PRIVATE ../qbittorrent_mingw.rc)
else()
target_sources(qBittorrent PRIVATE ../qbittorrent.rc)
endif()
target_sources(qBittorrent PRIVATE ../qbittorrent.exe.manifest)
endif()
2015-11-06 21:03:18 +03:00
if (STACKTRACE)
if (UNIX)
target_sources(qBittorrent PRIVATE stacktrace.h)
else()
target_sources(qBittorrent PRIVATE stacktrace_win.h)
if (NOT DISABLE_GUI)
2019-07-17 16:57:52 +03:00
target_sources(qBittorrent PRIVATE stacktracedialog.cpp stacktracedialog.h)
endif()
2019-08-06 21:50:39 +03:00
if (MSVC)
if (NOT "${WINXXBITS}" STREQUAL "Win64")
# i686 arch requires frame pointer preservation
add_compile_options(-Oy-)
endif()
2019-08-06 21:50:39 +03:00
add_compile_options(-Zi)
target_link_libraries(qBittorrent PUBLIC dbghelp -DEBUG)
else()
2019-08-06 21:50:39 +03:00
if (NOT "${WINXXBITS}" STREQUAL "Win64")
add_compile_options(-fno-omit-frame-pointer)
endif()
2019-08-06 21:50:39 +03:00
target_link_libraries(qBittorrent PUBLIC dbghelp -Wl,--export-all-symbols)
endif()
endif()
endif()
2015-11-06 21:03:18 +03:00
if (NOT DISABLE_GUI)
target_link_libraries(qBittorrent PRIVATE qbt_gui)
set_target_properties(qBittorrent
PROPERTIES
OUTPUT_NAME qbittorrent
WIN32_EXECUTABLE True
2015-11-06 21:03:18 +03:00
)
else()
set_target_properties(qBittorrent
PROPERTIES
OUTPUT_NAME qbittorrent-nox
)
endif()
2015-11-06 21:03:18 +03:00
if (NOT DISABLE_WEBUI)
target_link_libraries(qBittorrent PRIVATE qbt_webui)
endif()
2015-11-06 21:03:18 +03:00
2016-03-12 05:49:34 +03:00
# 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
2020-03-07 21:02:21 +03:00
${QT_TR_DIR}/qt_fa.qm
2016-03-12 05:49:34 +03:00
${QT_TR_DIR}/qt_gl.qm
${QT_TR_DIR}/qt_lt.qm
${QT_TR_DIR}/qt_pt.qm
2020-03-07 21:02:21 +03:00
${QT_TR_DIR}/qt_sl.qm
2016-03-12 05:49:34 +03:00
${QT_TR_DIR}/qt_sv.qm
${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()
2016-03-12 05:49:34 +03:00
target_sources(qBittorrent PRIVATE ${QBT_QM_FILES} ${QBT_APP_RESOURCE_SOURCE})
2015-11-06 21:03:18 +03:00
get_target_property(QBT_EXECUTABLE_NAME qBittorrent OUTPUT_NAME)
2015-11-06 21:03:18 +03:00
2016-03-12 05:49:34 +03:00
if (APPLE)
set(qbt_BUNDLE_NAME ${QBT_EXECUTABLE_NAME})
2016-12-20 10:03:48 +03:00
# substitute @EXECUTABLE@ in dist/mac/Info.plist
2016-12-20 10:03:48 +03:00
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
2016-03-12 05:49:34 +03:00
MACOSX_BUNDLE_BUNDLE_NAME "${qbt_BUNDLE_NAME}"
2016-12-20 10:03:48 +03:00
MACOSX_BUNDLE_INFO_PLIST ${qBittorrent_BINARY_DIR}/dist/mac/Info.plist
2016-03-12 05:49:34 +03:00
)
endif()
2016-03-12 05:49:34 +03:00
2015-11-06 21:03:18 +03:00
# installation
install(TARGETS qBittorrent
2016-03-12 05:49:34 +03:00
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
BUNDLE DESTINATION .
COMPONENT runtime
)
2016-03-12 05:49:34 +03:00
if (NOT DISABLE_GUI AND APPLE)
find_package(Qt5Svg REQUIRED)
include(bundle)
endif()