Add the OpenPU application icon (SVG, HVIF, PNG)
CI / Linux arm64 (push) Waiting to run
CI / Linux x86_64 (push) Waiting to run
CI / ASan + UBSan (push) Waiting to run

Original artwork: a generic shield with a "PU" monogram and a small
download arrow, deep blue and white. tools/make_icons.py describes the
shapes once and writes the master SVG, a simplified 16/24 px variant, the
Haiku HVIF and PNG renderings from 16 to 512 px (own antialiased
rasterizer, standard library only).

- Linux: icons installed in the hicolor theme as io.github.openpu.OpenPU
  (the name the .desktop file and the About dialog already use), with a
  build-tree copy for uninstalled runs.
- Haiku: the HVIF is embedded as the vector_icon resource; the executable
  is relinked when only its resources change.
- Fix: po/ did not include GNUInstallDirs, so translations were installed
  outside the locale directory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WDASLCiN764v685boRVYar
This commit is contained in:
yann64andClaude Opus 5.5 committed 2026-11-29 06:11:23 +01:00
1 parent 155545660e
commit bbc3bb3896
19 files changed
+437 -1

No files matched your search

+16 -1
View File
@@ -9,9 +9,24 @@ add_executable(openpu
target_link_libraries(openpu PRIVATE openpu_core PkgConfig::GTKMM openpu_warnings)
target_compile_definitions(openpu PRIVATE
GETTEXT_PACKAGE="openpu"
OPENPU_LOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}")
OPENPU_LOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}"
OPENPU_BUILD_ICONDIR="${CMAKE_BINARY_DIR}/icons")
# gtkmm headers trigger -Wshadow/-Wconversion noise we cannot fix.
target_compile_options(openpu PRIVATE -Wno-shadow -Wno-conversion)
install(TARGETS openpu RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES io.github.openpu.OpenPU.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
# Application icon (data/icons, generated by tools/make_icons.py), installed in the hicolor theme
# and mirrored in the build tree so that an uninstalled binary finds it too.
set(OPENPU_ICON io.github.openpu.OpenPU)
set(OPENPU_ICONS ${PROJECT_SOURCE_DIR}/data/icons)
configure_file(${OPENPU_ICONS}/openpu.svg ${CMAKE_BINARY_DIR}/icons/hicolor/scalable/apps/${OPENPU_ICON}.svg COPYONLY)
install(FILES ${OPENPU_ICONS}/openpu.svg
DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps RENAME ${OPENPU_ICON}.svg)
foreach(size 16 24 32 48 64 128 256 512)
configure_file(${OPENPU_ICONS}/png/openpu-${size}.png
${CMAKE_BINARY_DIR}/icons/hicolor/${size}x${size}/apps/${OPENPU_ICON}.png COPYONLY)
install(FILES ${OPENPU_ICONS}/png/openpu-${size}.png
DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/${size}x${size}/apps RENAME ${OPENPU_ICON}.png)
endforeach()
+5
View File
@@ -94,6 +94,11 @@ MainWindow::MainWindow()
{
set_title("OpenPU");
set_default_size(640, 520);
// Installed icon from the hicolor theme; the build tree has a copy for uninstalled runs.
auto theme = Gtk::IconTheme::get_for_display(get_display());
if (!theme->has_icon("io.github.openpu.OpenPU"))
theme->add_search_path(OPENPU_BUILD_ICONDIR);
set_icon_name("io.github.openpu.OpenPU");
try {
store_.load();
+6
View File
@@ -14,6 +14,10 @@ target_compile_definitions(OpenPU PRIVATE
target_compile_options(OpenPU PRIVATE -Wno-shadow -Wno-conversion)
# Application resources: signature, version, flags (Haiku rc + xres).
# The vector icon (data/icons/openpu.hvif, generated by tools/make_icons.py) is embedded as hex.
set(OPENPU_HVIF ${PROJECT_SOURCE_DIR}/data/icons/openpu.hvif)
file(READ ${OPENPU_HVIF} OPENPU_HVIF_HEX HEX)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${OPENPU_HVIF})
configure_file(OpenPU.rdef.in ${CMAKE_CURRENT_BINARY_DIR}/OpenPU.rdef @ONLY)
find_program(HAIKU_RC rc)
find_program(HAIKU_XRES xres)
@@ -24,6 +28,8 @@ if(HAIKU_RC AND HAIKU_XRES)
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/OpenPU.rdef)
add_custom_target(OpenPU_rsrc DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/OpenPU.rsrc)
add_dependencies(OpenPU OpenPU_rsrc)
# Relink (and so re-attach the resources) when only the resources change.
set_target_properties(OpenPU PROPERTIES LINK_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/OpenPU.rsrc)
add_custom_command(TARGET OpenPU POST_BUILD
COMMAND ${HAIKU_XRES} -o $<TARGET_FILE:OpenPU> ${CMAKE_CURRENT_BINARY_DIR}/OpenPU.rsrc
COMMAND ${HAIKU_MIMESET} -f $<TARGET_FILE:OpenPU>)
+2
View File
@@ -4,6 +4,8 @@ resource app_signature "application/x-vnd.openpu-OpenPU";
resource app_flags B_SINGLE_LAUNCH;
resource vector_icon $"@OPENPU_HVIF_HEX@";
resource app_version {
major = @PROJECT_VERSION_MAJOR@,
middle = @PROJECT_VERSION_MINOR@,