2022-05-29 00:29:45 +03:00
|
|
|
file(GLOB QBT_TS_FILES "${qBittorrent_SOURCE_DIR}/src/lang/*.ts")
|
|
|
|
# Custom target to update .ts files and include new strings from source files
|
|
|
|
# Depends on Qt's LinguistTools
|
|
|
|
get_target_property(QT_LUPDATE_EXECUTABLE Qt::lupdate IMPORTED_LOCATION)
|
|
|
|
add_custom_target(qbt_update_translations
|
|
|
|
COMMAND ${QT_LUPDATE_EXECUTABLE} -extensions ui,c,c++,cc,cpp,cxx,ch,h,h++,hh,hpp,hxx
|
|
|
|
${qBittorrent_SOURCE_DIR}
|
|
|
|
-ts ${QBT_TS_FILES}
|
|
|
|
WORKING_DIRECTORY "${qBittorrent_SOURCE_DIR}"
|
|
|
|
VERBATIM
|
|
|
|
COMMAND_EXPAND_LISTS)
|
|
|
|
|
2020-05-03 21:28:07 +03:00
|
|
|
# Generate and configure translation files
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Based on https://gist.github.com/giraldeau/546ba5512a74dfe9d8ea0862d66db412
|
|
|
|
set_source_files_properties(${QBT_TS_FILES} PROPERTIES OUTPUT_LOCATION "${qBittorrent_BINARY_DIR}/src/lang")
|
2021-03-01 08:38:51 +03:00
|
|
|
qt_add_translation(QBT_QM_FILES ${QBT_TS_FILES} OPTIONS -silent)
|
2020-05-03 21:28:07 +03:00
|
|
|
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")
|
2021-03-01 08:38:51 +03:00
|
|
|
qt_add_translation(QBT_WEBUI_QM_FILES ${QBT_WEBUI_TS_FILES} OPTIONS -silent)
|
2020-05-03 21:28:07 +03:00
|
|
|
configure_file("${qBittorrent_SOURCE_DIR}/src/webui/www/translations/webui_translations.qrc"
|
|
|
|
"${qBittorrent_BINARY_DIR}/src/webui/www/translations/webui_translations.qrc" COPYONLY)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Executable target configuration
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
add_executable(qbt_app)
|
|
|
|
|
|
|
|
target_sources(qbt_app PRIVATE
|
2020-04-30 11:34:41 +03:00
|
|
|
# headers
|
|
|
|
application.h
|
|
|
|
applicationinstancemanager.h
|
|
|
|
cmdoptions.h
|
|
|
|
filelogger.h
|
|
|
|
qtlocalpeer/qtlocalpeer.h
|
2022-05-01 07:32:51 +03:00
|
|
|
signalhandler.h
|
2020-04-30 11:34:41 +03:00
|
|
|
upgrade.h
|
|
|
|
|
|
|
|
# sources
|
|
|
|
application.cpp
|
|
|
|
applicationinstancemanager.cpp
|
|
|
|
cmdoptions.cpp
|
|
|
|
filelogger.cpp
|
|
|
|
main.cpp
|
|
|
|
qtlocalpeer/qtlocalpeer.cpp
|
2022-05-01 07:32:51 +03:00
|
|
|
signalhandler.cpp
|
2020-04-30 11:34:41 +03:00
|
|
|
upgrade.cpp
|
2018-06-05 04:03:38 +03:00
|
|
|
|
2020-05-03 21:28:07 +03:00
|
|
|
# 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"
|
2018-06-05 04:03:38 +03:00
|
|
|
)
|
|
|
|
|
2020-05-03 21:28:07 +03:00
|
|
|
target_link_libraries(qbt_app PRIVATE
|
|
|
|
qbt_base
|
|
|
|
)
|
2015-11-06 21:03:18 +03:00
|
|
|
|
2020-05-03 21:28:07 +03:00
|
|
|
set_target_properties(qbt_app PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
|
2020-09-27 22:17:50 +03:00
|
|
|
if (GUI)
|
|
|
|
set_target_properties(qbt_app PROPERTIES OUTPUT_NAME qbittorrent)
|
|
|
|
else()
|
|
|
|
set_target_properties(qbt_app PROPERTIES OUTPUT_NAME qbittorrent-nox)
|
|
|
|
endif()
|
2015-11-06 21:03:18 +03:00
|
|
|
|
2020-05-03 21:28:07 +03:00
|
|
|
# Additional platform specific configuration
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
2022-03-25 19:20:48 +03:00
|
|
|
include(FindQtTranslations)
|
|
|
|
qbt_get_qt_translations(QT_TRANSLATIONS)
|
|
|
|
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
|
|
|
|
)
|
2021-04-23 02:24:00 +03:00
|
|
|
# provide variables for substitution in dist/mac/Info.plist
|
|
|
|
get_target_property(EXECUTABLE_NAME qbt_app OUTPUT_NAME)
|
|
|
|
# This variable name should be changed once qmake is no longer used. Refer to the discussion in PR #14813
|
|
|
|
set(MACOSX_DEPLOYMENT_TARGET ${CMAKE_OSX_DEPLOYMENT_TARGET})
|
2020-05-03 21:28:07 +03:00
|
|
|
set_target_properties(qbt_app PROPERTIES
|
|
|
|
MACOSX_BUNDLE ON
|
2021-04-18 12:06:12 +03:00
|
|
|
MACOSX_BUNDLE_BUNDLE_NAME "qBittorrent"
|
2021-04-23 02:24:00 +03:00
|
|
|
MACOSX_BUNDLE_INFO_PLIST ${qBittorrent_SOURCE_DIR}/dist/mac/Info.plist
|
2020-05-03 21:28:07 +03:00
|
|
|
)
|
|
|
|
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)
|
2015-11-06 21:03:18 +03:00
|
|
|
if (MINGW)
|
2020-05-03 21:28:07 +03:00
|
|
|
target_sources(qbt_app PRIVATE ${qBittorrent_SOURCE_DIR}/src/qbittorrent_mingw.rc)
|
2020-04-30 11:34:41 +03:00
|
|
|
else()
|
2020-05-03 21:28:07 +03:00
|
|
|
target_sources(qbt_app PRIVATE ${qBittorrent_SOURCE_DIR}/src/qbittorrent.rc)
|
2020-04-30 11:34:41 +03:00
|
|
|
endif()
|
2020-05-03 21:28:07 +03:00
|
|
|
target_sources(qbt_app PRIVATE ${qBittorrent_SOURCE_DIR}/src/qbittorrent.exe.manifest)
|
2020-04-30 11:34:41 +03:00
|
|
|
endif()
|
2015-11-06 21:03:18 +03:00
|
|
|
|
2020-05-03 21:28:07 +03:00
|
|
|
# Additional feature dependent configuration
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# -----------------------------------------------------------------------------
|
2022-05-12 06:06:05 +03:00
|
|
|
if (GUI)
|
|
|
|
target_link_libraries(qbt_app PRIVATE qbt_gui)
|
|
|
|
if ((CMAKE_SYSTEM_NAME STREQUAL "Windows") OR (CMAKE_SYSTEM_NAME STREQUAL "Darwin"))
|
|
|
|
qt_import_plugins(qbt_app INCLUDE Qt::QSvgIconPlugin Qt::QSvgPlugin)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2018-04-09 23:30:20 +03:00
|
|
|
if (STACKTRACE)
|
2020-05-03 21:28:07 +03:00
|
|
|
target_compile_definitions(qbt_app PRIVATE STACKTRACE)
|
|
|
|
|
2022-05-12 06:06:05 +03:00
|
|
|
target_sources(qbt_app PRIVATE
|
|
|
|
stacktrace.h
|
|
|
|
stacktrace.cpp
|
|
|
|
)
|
2020-05-03 21:28:07 +03:00
|
|
|
|
2022-05-12 06:06:05 +03:00
|
|
|
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
|
|
|
target_compile_definitions(qbt_app PRIVATE BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED)
|
|
|
|
target_link_options(qbt_app PUBLIC -rdynamic)
|
|
|
|
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
|
|
target_link_libraries(qbt_app PUBLIC ${CMAKE_DL_LIBS})
|
|
|
|
target_link_options(qbt_app PUBLIC -rdynamic)
|
|
|
|
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
2019-08-06 21:50:39 +03:00
|
|
|
if (MSVC)
|
2020-05-03 21:28:07 +03:00
|
|
|
target_compile_options(qbt_app PRIVATE /Zi)
|
2022-05-12 06:06:05 +03:00
|
|
|
target_link_options(qbt_app PUBLIC
|
|
|
|
/DEBUG
|
|
|
|
/PDBALTPATH:$<TARGET_PDB_FILE_NAME:qbt_app>
|
|
|
|
)
|
|
|
|
|
2020-05-03 21:28:07 +03:00
|
|
|
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
2022-05-12 06:06:05 +03:00
|
|
|
target_compile_options(qbt_app PRIVATE /Oy-)
|
2020-04-30 11:34:41 +03:00
|
|
|
endif()
|
|
|
|
else()
|
2022-05-12 06:06:05 +03:00
|
|
|
target_link_options(qbt_app PUBLIC LINKER:--export-dynamic)
|
|
|
|
|
2020-05-03 21:28:07 +03:00
|
|
|
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
|
|
|
target_compile_options(qbt_app PRIVATE -fno-omit-frame-pointer)
|
2020-04-30 11:34:41 +03:00
|
|
|
endif()
|
|
|
|
endif()
|
2020-09-27 22:17:50 +03:00
|
|
|
endif()
|
2020-04-30 11:34:41 +03:00
|
|
|
endif()
|
2015-11-06 21:03:18 +03:00
|
|
|
|
2020-05-02 20:59:26 +03:00
|
|
|
if (WEBUI)
|
2020-05-03 21:28:07 +03:00
|
|
|
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"
|
2016-03-12 05:49:34 +03:00
|
|
|
)
|
2020-05-03 21:28:07 +03:00
|
|
|
target_link_libraries(qbt_app PRIVATE qbt_webui)
|
2020-04-30 11:34:41 +03:00
|
|
|
endif()
|
2016-03-12 05:49:34 +03:00
|
|
|
|
2020-05-03 21:28:07 +03:00
|
|
|
# Installation
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
install(TARGETS qbt_app
|
2016-03-12 05:49:34 +03:00
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
|
|
BUNDLE DESTINATION .
|
2020-04-30 11:34:41 +03:00
|
|
|
COMPONENT runtime
|
|
|
|
)
|
2016-03-12 05:49:34 +03:00
|
|
|
|
2020-05-03 21:28:07 +03:00
|
|
|
if (MSVC)
|
|
|
|
install(FILES $<TARGET_PDB_FILE:qbt_app>
|
|
|
|
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
|
|
OPTIONAL
|
|
|
|
)
|
2020-04-30 11:34:41 +03:00
|
|
|
endif()
|