From 5eb55d71d581eae142b014f864be4eef1f6aeed8 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch Date: Wed, 14 Jun 2023 09:26:23 +0200 Subject: Make xF a first-class citizen --- CMakeLists.txt | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 2263af0..9afcdf4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -176,6 +176,7 @@ add_custom_command (OUTPUT xC-proto.c add_custom_target (xC-proto DEPENDS ${PROJECT_BINARY_DIR}/xC-proto.c) # Build +set (project_binaries xB xC xD) foreach (name xB xC xD) add_executable (${name} ${name}.c ${project_config}) target_link_libraries (${name} ${project_libraries}) @@ -187,12 +188,13 @@ add_dependencies (xC replies xC-proto) target_link_libraries (xC ${xC_libraries}) if (WANT_XF) - pkg_check_modules (x11 REQUIRED x11 xrender xft fontconfig) - include_directories (${x11_INCLUDE_DIRS}) - link_directories (${x11_LIBRARY_DIRS}) + list (APPEND project_binaries xF) + pkg_check_modules (x11 REQUIRED x11 xrender xft fontconfig libpng) add_executable (xF xF.c ${project_config}) add_dependencies (xF xC-proto) + target_include_directories (xF PRIVATE ${x11_INCLUDE_DIRS}) + target_link_directories (xF PRIVATE ${x11_LIBRARY_DIRS}) target_link_libraries (xF ${x11_LIBRARIES} ${project_libraries}) add_threads (xF) endif () @@ -226,13 +228,33 @@ add_custom_target (clang-tidy WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) # Installation -install (TARGETS xB xC xD DESTINATION ${CMAKE_INSTALL_BINDIR}) +install (TARGETS ${project_binaries} DESTINATION ${CMAKE_INSTALL_BINDIR}) install (FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR}) install (DIRECTORY plugins/xB/ DESTINATION ${CMAKE_INSTALL_DATADIR}/xB/plugins USE_SOURCE_PERMISSIONS) install (DIRECTORY plugins/xC/ DESTINATION ${CMAKE_INSTALL_DATADIR}/xC/plugins) +# Rasterize and install SVG icons +if (WANT_XF) + include (IconUtils) + + set (icon_base ${PROJECT_BINARY_DIR}/icons) + set (icon_png_list) + foreach (icon_size 16 32 48) + icon_to_png (xF ${PROJECT_SOURCE_DIR}/xF.svg + ${icon_size} ${icon_base} icon_png) + list (APPEND icon_png_list ${icon_png}) + endforeach () + + add_custom_target (icons ALL DEPENDS ${icon_png_list}) + + install (FILES xF.svg + DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps) + install (DIRECTORY ${icon_base} + DESTINATION ${CMAKE_INSTALL_DATADIR}) +endif () + # Generate documentation from text markup find_program (ASCIIDOCTOR_EXECUTABLE asciidoctor) find_program (A2X_EXECUTABLE a2x) @@ -241,7 +263,7 @@ if (NOT ASCIIDOCTOR_EXECUTABLE AND NOT A2X_EXECUTABLE) "falling back to a substandard manual page generator") endif () -foreach (page xB xC xD) +foreach (page ${project_binaries}) set (page_output "${PROJECT_BINARY_DIR}/${page}.1") list (APPEND project_MAN_PAGES "${page_output}") if (ASCIIDOCTOR_EXECUTABLE) -- cgit v1.2.3-70-g09d2