aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2024-02-10 05:46:13 +0100
committerPřemysl Eric Janouch <p@janouch.name>2024-02-10 05:46:13 +0100
commitfafac22d60c61cbf5bcf4d1ea818fd27ac5dfc67 (patch)
tree3ad497a385694e77ebab6e75823f4cab1f3bb4dc /CMakeLists.txt
parent58f7ba55b31102836b5b37e8b1f2392749398b26 (diff)
downloadtdv-fafac22d60c61cbf5bcf4d1ea818fd27ac5dfc67.tar.gz
tdv-fafac22d60c61cbf5bcf4d1ea818fd27ac5dfc67.tar.xz
tdv-fafac22d60c61cbf5bcf4d1ea818fd27ac5dfc67.zip
Bump liberty
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt40
1 files changed, 7 insertions, 33 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2e3986b..36638ea 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -202,34 +202,6 @@ configure_file (${PROJECT_SOURCE_DIR}/config.h.in
${PROJECT_BINARY_DIR}/config.h)
include_directories (${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR})
-# Icon generation utilities
-if (NOT ${CMAKE_VERSION} VERSION_LESS 3.18.0)
- set (find_program_REQUIRE REQUIRED)
-endif ()
-
-function (icon_to_png svg size output_dir output)
- set (_dimensions ${size}x${size})
- set (_png_path ${output_dir}/hicolor/${_dimensions}/apps)
- set (_png ${_png_path}/${PROJECT_NAME}.png)
- set (${output} ${_png} PARENT_SCOPE)
-
- find_program (rsvg_convert_EXECUTABLE rsvg-convert ${find_program_REQUIRE})
- add_custom_command (OUTPUT ${_png}
- COMMAND ${CMAKE_COMMAND} -E make_directory ${_png_path}
- COMMAND ${rsvg_convert_EXECUTABLE} --output=${_png}
- --width=${size} --height=${size} ${svg}
- DEPENDS ${svg}
- COMMENT "Generating ${_dimensions} application icon" VERBATIM)
-endfunction ()
-
-function (icon_for_win32 pngs ico)
- find_program (icotool_EXECUTABLE icotool ${find_program_REQUIRE})
- add_custom_command (OUTPUT ${ico}
- COMMAND ${icotool_EXECUTABLE} -c -o ${ico} ${pngs}
- DEPENDS ${pngs}
- COMMENT "Generating Windows program icon" VERBATIM)
-endfunction ()
-
# Build the main executable and link it
set (project_libraries
${project_common_libraries})
@@ -240,21 +212,23 @@ set (project_headers
${project_common_headers})
if (WITH_GUI)
- set (icon_svg ${PROJECT_SOURCE_DIR}/${PROJECT_NAME}.svg)
- set (icon_base ${PROJECT_BINARY_DIR}/icons)
+ include (IconUtils)
# The largest size is mainly for an appropriately sized Windows icon
+ set (icon_base ${PROJECT_BINARY_DIR}/icons)
set (icon_png_list)
foreach (icon_size 16 32 48 256)
- icon_to_png (${icon_svg} ${icon_size} ${icon_base} icon_png)
+ icon_to_png (${PROJECT_NAME} ${PROJECT_SOURCE_DIR}/${PROJECT_NAME}.svg
+ ${icon_size} ${icon_base} icon_png)
list (APPEND icon_png_list ${icon_png})
endforeach ()
+
add_custom_target (icons ALL DEPENDS ${icon_png_list})
endif ()
if (WIN32)
set (icon_ico ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.ico)
- icon_for_win32 ("${icon_png_list}" ${icon_ico})
+ icon_for_win32 (${icon_ico} "${icon_png_list}" "")
set (resource_file ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.rc)
list (APPEND project_sources ${resource_file})
@@ -325,7 +299,7 @@ if (NOT WIN32)
if (WITH_GUI)
install (FILES ${PROJECT_NAME}.svg
DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps)
- install (DIRECTORY ${PROJECT_BINARY_DIR}/icons
+ install (DIRECTORY ${icon_base}
DESTINATION ${CMAKE_INSTALL_DATADIR})
install (FILES ${PROJECT_NAME}.desktop
DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)