2014-12-01 19:55:22 +00:00
|
|
|
project(trgtk)
|
|
|
|
|
2020-08-11 18:11:55 +00:00
|
|
|
add_compile_options(${C_WARNING_FLAGS})
|
|
|
|
|
2014-12-01 19:55:22 +00:00
|
|
|
execute_process(
|
|
|
|
COMMAND
|
|
|
|
${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_resources
|
|
|
|
OUTPUT_VARIABLE
|
|
|
|
GLIB_COMPILE_RESOURCES_EXECUTABLE
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
|
|
|
|
|
|
|
if(NOT GLIB_COMPILE_RESOURCES_EXECUTABLE)
|
|
|
|
message(SEND_ERROR "Unable to find glib-compile-resources executable")
|
|
|
|
endif()
|
|
|
|
|
2022-02-14 15:41:19 +00:00
|
|
|
find_program(APPSTREAM appstreamcli)
|
|
|
|
|
2022-10-08 22:50:03 +00:00
|
|
|
if(GTK_VERSION EQUAL 4)
|
|
|
|
set(UI_SUBDIR ui/gtk4)
|
|
|
|
else()
|
|
|
|
set(UI_SUBDIR ui/gtk3)
|
|
|
|
endif()
|
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
set(${PROJECT_NAME}_UI_FILES
|
2022-10-08 22:50:03 +00:00
|
|
|
${UI_SUBDIR}/AddTrackerDialog.ui
|
|
|
|
${UI_SUBDIR}/DetailsDialog.ui
|
|
|
|
${UI_SUBDIR}/EditTrackersDialog.ui
|
|
|
|
${UI_SUBDIR}/FilterBar.ui
|
|
|
|
${UI_SUBDIR}/MainWindow.ui
|
|
|
|
${UI_SUBDIR}/MakeDialog.ui
|
|
|
|
${UI_SUBDIR}/MakeProgressDialog.ui
|
|
|
|
${UI_SUBDIR}/MessageLogWindow.ui
|
|
|
|
${UI_SUBDIR}/OptionsDialog.ui
|
|
|
|
${UI_SUBDIR}/PrefsDialog.ui
|
|
|
|
${UI_SUBDIR}/RelocateDialog.ui
|
|
|
|
${UI_SUBDIR}/StatsDialog.ui
|
|
|
|
${UI_SUBDIR}/TorrentUrlChooserDialog.ui
|
2022-09-07 22:25:04 +00:00
|
|
|
)
|
|
|
|
|
2022-10-08 22:50:03 +00:00
|
|
|
macro(gtr_compile_resources NAME INPUT_DIR INPUT_FILE OUTPUT_FILE_BASE)
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_FILE_BASE}.c"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_FILE_BASE}.h"
|
|
|
|
COMMAND
|
|
|
|
"${GLIB_COMPILE_RESOURCES_EXECUTABLE}"
|
|
|
|
"--target=${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_FILE_BASE}.c"
|
|
|
|
"--sourcedir=${INPUT_DIR}"
|
|
|
|
--generate-source
|
|
|
|
--c-name "${NAME}"
|
|
|
|
"${INPUT_DIR}/${INPUT_FILE}"
|
|
|
|
COMMAND
|
|
|
|
"${GLIB_COMPILE_RESOURCES_EXECUTABLE}"
|
|
|
|
"--target=${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_FILE_BASE}.h"
|
|
|
|
"--sourcedir=${INPUT_DIR}"
|
|
|
|
--generate-header
|
|
|
|
--c-name "${NAME}"
|
|
|
|
"${INPUT_DIR}/${INPUT_FILE}"
|
|
|
|
DEPENDS
|
|
|
|
"${INPUT_DIR}/${INPUT_FILE}"
|
|
|
|
${ARGN}
|
|
|
|
WORKING_DIRECTORY
|
|
|
|
"${INPUT_DIR}"
|
|
|
|
)
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
gtr_compile_resources(transmission ${CMAKE_CURRENT_SOURCE_DIR} transmission.gresource.xml transmission-resources
|
|
|
|
icons/hicolor_apps_scalable_transmission.svg
|
|
|
|
icons/lock.svg
|
|
|
|
icons/options-symbolic.svg
|
|
|
|
icons/ratio-symbolic.svg
|
|
|
|
icons/turtle-symbolic.svg
|
|
|
|
transmission-ui.css
|
|
|
|
transmission-ui.xml
|
|
|
|
)
|
|
|
|
gtr_compile_resources(transmission_ui ${CMAKE_CURRENT_SOURCE_DIR}/${UI_SUBDIR} transmission-ui.gresource.xml transmission-ui-resources
|
|
|
|
${${PROJECT_NAME}_UI_FILES}
|
2014-12-01 19:55:22 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
if(ENABLE_NLS)
|
|
|
|
set(${PROJECT_NAME}_DESKTOP_FILE "${PROJECT_BINARY_DIR}/${TR_NAME}-gtk.desktop")
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${${PROJECT_NAME}_DESKTOP_FILE}
|
2018-04-18 09:25:13 +00:00
|
|
|
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --desktop -d ${CMAKE_SOURCE_DIR}/po --template ${PROJECT_SOURCE_DIR}/transmission-gtk.desktop.in -o ${${PROJECT_NAME}_DESKTOP_FILE}
|
2014-12-01 19:55:22 +00:00
|
|
|
DEPENDS ${PROJECT_SOURCE_DIR}/transmission-gtk.desktop.in
|
|
|
|
VERBATIM
|
|
|
|
)
|
2017-03-20 15:36:25 +00:00
|
|
|
|
2022-02-14 15:41:19 +00:00
|
|
|
set(${PROJECT_NAME}_METAINFO_FILE "${PROJECT_BINARY_DIR}/${TR_NAME}-gtk.metainfo.xml")
|
2017-03-20 15:36:25 +00:00
|
|
|
add_custom_command(
|
2022-02-14 15:41:19 +00:00
|
|
|
OUTPUT ${${PROJECT_NAME}_METAINFO_FILE}
|
|
|
|
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --xml -d ${CMAKE_SOURCE_DIR}/po --template ${PROJECT_SOURCE_DIR}/transmission-gtk.metainfo.xml.in -o ${${PROJECT_NAME}_METAINFO_FILE}
|
|
|
|
DEPENDS ${PROJECT_SOURCE_DIR}/transmission-gtk.metainfo.xml.in
|
2017-03-20 15:36:25 +00:00
|
|
|
VERBATIM
|
|
|
|
)
|
2014-12-01 19:55:22 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
set(${PROJECT_NAME}_SOURCES
|
2021-11-01 00:11:23 +00:00
|
|
|
Actions.cc
|
|
|
|
Application.cc
|
|
|
|
DetailsDialog.cc
|
|
|
|
Dialogs.cc
|
|
|
|
FaviconCache.cc
|
|
|
|
FileList.cc
|
|
|
|
FilterBar.cc
|
|
|
|
FreeSpaceLabel.cc
|
|
|
|
IconCache.cc
|
2021-09-25 10:47:09 +00:00
|
|
|
main.cc
|
2021-11-01 00:11:23 +00:00
|
|
|
MainWindow.cc
|
|
|
|
MakeDialog.cc
|
|
|
|
MessageLogWindow.cc
|
|
|
|
Notify.cc
|
|
|
|
OptionsDialog.cc
|
2022-10-08 22:50:03 +00:00
|
|
|
PathButton.cc
|
2021-11-01 00:11:23 +00:00
|
|
|
Prefs.cc
|
|
|
|
PrefsDialog.cc
|
|
|
|
RelocateDialog.cc
|
|
|
|
Session.cc
|
|
|
|
StatsDialog.cc
|
|
|
|
SystemTrayIcon.cc
|
|
|
|
TorrentCellRenderer.cc
|
|
|
|
Utils.cc
|
2014-12-01 19:55:22 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/transmission-resources.c
|
2022-10-08 22:50:03 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/transmission-ui-resources.c
|
2014-12-01 19:55:22 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
set(${PROJECT_NAME}_HEADERS
|
2021-11-01 00:11:23 +00:00
|
|
|
Actions.h
|
|
|
|
Application.h
|
|
|
|
DetailsDialog.h
|
|
|
|
Dialogs.h
|
|
|
|
FaviconCache.h
|
|
|
|
FileList.h
|
|
|
|
FilterBar.h
|
|
|
|
FreeSpaceLabel.h
|
|
|
|
HigWorkarea.h
|
|
|
|
IconCache.h
|
|
|
|
MainWindow.h
|
|
|
|
MakeDialog.h
|
|
|
|
MessageLogWindow.h
|
|
|
|
Notify.h
|
|
|
|
OptionsDialog.h
|
2022-10-08 22:50:03 +00:00
|
|
|
PathButton.h
|
2021-11-01 00:11:23 +00:00
|
|
|
Prefs.h
|
|
|
|
PrefsDialog.h
|
|
|
|
RelocateDialog.h
|
|
|
|
Session.h
|
|
|
|
StatsDialog.h
|
|
|
|
SystemTrayIcon.h
|
|
|
|
TorrentCellRenderer.h
|
|
|
|
Utils.h
|
2014-12-01 19:55:22 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/transmission-resources.h
|
2022-10-08 22:50:03 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/transmission-ui-resources.h
|
2014-12-01 19:55:22 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
include_directories(
|
|
|
|
${CMAKE_SOURCE_DIR}
|
|
|
|
${PROJECT_BINARY_DIR}
|
2020-08-11 18:11:55 +00:00
|
|
|
)
|
2022-10-09 09:13:02 +00:00
|
|
|
|
2020-08-11 18:11:55 +00:00
|
|
|
include_directories(
|
|
|
|
SYSTEM
|
2022-10-09 07:29:47 +00:00
|
|
|
${GTK${GTK_VERSION}_INCLUDE_DIRS}
|
2014-12-01 19:55:22 +00:00
|
|
|
${CURL_INCLUDE_DIRS}
|
2015-12-12 18:46:39 +00:00
|
|
|
${EVENT2_INCLUDE_DIRS}
|
2014-12-01 19:55:22 +00:00
|
|
|
)
|
|
|
|
|
2022-10-20 17:15:13 +00:00
|
|
|
if(WITH_APPINDICATOR)
|
|
|
|
include_directories(SYSTEM ${APPINDICATOR_INCLUDE_DIRS})
|
2022-10-09 07:29:47 +00:00
|
|
|
endif()
|
|
|
|
|
2014-12-01 19:55:22 +00:00
|
|
|
link_directories(
|
2022-10-09 07:29:47 +00:00
|
|
|
${GTK${GTK_VERSION}_LIBRARY_DIRS}
|
2014-12-01 19:55:22 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
add_definitions(
|
|
|
|
"-DTRANSMISSIONLOCALEDIR=\"${CMAKE_INSTALL_FULL_LOCALEDIR}\""
|
|
|
|
"-DGETTEXT_PACKAGE=\"${TR_NAME}-gtk\""
|
|
|
|
-DG_DISABLE_DEPRECATED
|
|
|
|
-DGDK_PIXBUF_DISABLE_DEPRECATED
|
|
|
|
-DGDK_DISABLE_DEPRECATED
|
2021-11-12 09:12:50 +00:00
|
|
|
-DGTK_DISABLE_DEPRECATED
|
2014-12-01 19:55:22 +00:00
|
|
|
-DPANGO_DISABLE_DEPRECATED
|
|
|
|
# FIXME: these break libnotify's headers
|
|
|
|
# -DG_DISABLE_SINGLE_INCLUDES
|
|
|
|
# -DGTK_DISABLE_SINGLE_INCLUDES
|
2021-11-12 09:12:50 +00:00
|
|
|
-DGDKMM_DISABLE_DEPRECATED
|
|
|
|
-DGIOMM_DISABLE_DEPRECATED
|
|
|
|
-DGLIBMM_DISABLE_DEPRECATED
|
|
|
|
-DGTKMM_DISABLE_DEPRECATED
|
|
|
|
-DPANGOMM_DISABLE_DEPRECATED
|
|
|
|
-DSIGCXX_DISABLE_DEPRECATED
|
2022-10-09 07:29:47 +00:00
|
|
|
${GTK${GTK_VERSION}_CFLAGS_OTHER}
|
2014-12-01 19:55:22 +00:00
|
|
|
)
|
|
|
|
|
2022-10-20 17:15:13 +00:00
|
|
|
if(WITH_APPINDICATOR)
|
|
|
|
set_property(SOURCE SystemTrayIcon.cc APPEND PROPERTY COMPILE_DEFINITIONS HAVE_APPINDICATOR)
|
|
|
|
if(APPINDICATOR_IS_AYATANA)
|
|
|
|
set_property(SOURCE SystemTrayIcon.cc APPEND PROPERTY COMPILE_DEFINITIONS APPINDICATOR_IS_AYATANA)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2015-04-14 22:46:40 +00:00
|
|
|
tr_win32_app_info(${PROJECT_NAME}_WIN32_RC_FILE
|
|
|
|
"Transmission GTK+ Client"
|
|
|
|
"${TR_NAME}-gtk"
|
|
|
|
"${TR_NAME}-gtk.exe"
|
|
|
|
"${TR_NAME}.ico")
|
|
|
|
|
2015-01-04 10:57:09 +00:00
|
|
|
add_executable(${TR_NAME}-gtk WIN32
|
2014-12-01 19:55:22 +00:00
|
|
|
${${PROJECT_NAME}_SOURCES}
|
|
|
|
${${PROJECT_NAME}_HEADERS}
|
|
|
|
${${PROJECT_NAME}_DESKTOP_FILE}
|
2022-02-14 15:41:19 +00:00
|
|
|
${${PROJECT_NAME}_METAINFO_FILE}
|
2015-04-14 22:46:40 +00:00
|
|
|
${${PROJECT_NAME}_WIN32_RC_FILE}
|
2014-12-01 19:55:22 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries(${TR_NAME}-gtk
|
|
|
|
${TR_NAME}
|
2022-10-09 07:29:47 +00:00
|
|
|
${GTK${GTK_VERSION}_LIBRARIES}
|
2014-12-01 19:55:22 +00:00
|
|
|
${CURL_LIBRARIES}
|
|
|
|
${EVENT2_LIBRARIES}
|
|
|
|
)
|
|
|
|
|
2022-10-20 17:15:13 +00:00
|
|
|
if(WITH_APPINDICATOR)
|
|
|
|
target_link_libraries(${TR_NAME}-gtk ${APPINDICATOR_LIBRARIES})
|
2022-10-09 07:29:47 +00:00
|
|
|
endif()
|
|
|
|
|
2020-07-30 19:45:11 +00:00
|
|
|
if(NOT MSVC)
|
2021-11-14 16:12:29 +00:00
|
|
|
target_compile_options(${TR_NAME}-gtk PRIVATE -Wno-exit-time-destructors)
|
2020-07-30 19:45:11 +00:00
|
|
|
endif()
|
|
|
|
|
2015-01-04 10:57:09 +00:00
|
|
|
if(MSVC)
|
|
|
|
tr_append_target_property(${TR_NAME}-gtk LINK_FLAGS "/ENTRY:mainCRTStartup")
|
|
|
|
endif()
|
|
|
|
|
2014-12-01 19:55:22 +00:00
|
|
|
install(TARGETS ${TR_NAME}-gtk DESTINATION ${CMAKE_INSTALL_BINDIR})
|
|
|
|
|
|
|
|
set(${PROJECT_NAME}_PUBLIC_ICONS
|
|
|
|
hicolor_apps_scalable_transmission.svg
|
2020-04-26 01:01:49 +00:00
|
|
|
hicolor_apps_scalable_transmission-devel.svg
|
2017-11-30 16:41:39 +00:00
|
|
|
hicolor_apps_symbolic_transmission-symbolic.svg
|
2014-12-01 19:55:22 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
set(ICON_NAME_REGEX "^([^_]+)_([^_]+)_([^_]+)_(.+)$")
|
|
|
|
foreach(ICON ${${PROJECT_NAME}_PUBLIC_ICONS})
|
|
|
|
string(REGEX REPLACE ${ICON_NAME_REGEX} "\\1/\\3/\\2" ICON_DIR ${ICON})
|
|
|
|
string(REGEX REPLACE ${ICON_NAME_REGEX} "\\4" ICON_NAME ${ICON})
|
|
|
|
install(FILES icons/${ICON} DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/${ICON_DIR}/ RENAME ${ICON_NAME})
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
if(INSTALL_DOC)
|
|
|
|
install(FILES ${TR_NAME}-gtk.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ENABLE_NLS)
|
|
|
|
install(FILES ${${PROJECT_NAME}_DESKTOP_FILE} DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
|
2022-02-14 15:41:19 +00:00
|
|
|
install(FILES ${${PROJECT_NAME}_METAINFO_FILE} DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo)
|
2014-12-01 19:55:22 +00:00
|
|
|
else()
|
|
|
|
install(FILES transmission-gtk.desktop.in DESTINATION ${CMAKE_INSTALL_DATADIR}/applications RENAME ${TR_NAME}-gtk.desktop)
|
|
|
|
endif()
|