Files
opu/po/CMakeLists.txt
T
yann64andClaude Opus 5.5 bbc3bb3896
CI / Linux arm64 (push) Waiting to run
CI / Linux x86_64 (push) Waiting to run
CI / ASan + UBSan (push) Waiting to run
Add the OpenPU application icon (SVG, HVIF, PNG)
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
2026-11-29 06:11:23 +01:00

31 lines
1.3 KiB
CMake

# Translations (gettext). Source strings are English; add a language by adding <lang>.po and
# listing it in LINGUAS.
include(GNUInstallDirs)
find_package(Gettext)
if(NOT GETTEXT_FOUND)
message(WARNING "gettext (msgfmt) not found: translations are not built")
return()
endif()
file(STRINGS LINGUAS OPENPU_LINGUAS REGEX "^[^#]")
foreach(lang IN LISTS OPENPU_LINGUAS)
set(mo ${CMAKE_BINARY_DIR}/locale/${lang}/LC_MESSAGES/openpu.mo)
add_custom_command(OUTPUT ${mo}
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/locale/${lang}/LC_MESSAGES
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${mo} ${CMAKE_CURRENT_SOURCE_DIR}/${lang}.po
DEPENDS ${lang}.po)
list(APPEND OPENPU_MO_FILES ${mo})
install(FILES ${mo} DESTINATION ${CMAKE_INSTALL_LOCALEDIR}/${lang}/LC_MESSAGES)
endforeach()
add_custom_target(translations ALL DEPENDS ${OPENPU_MO_FILES})
# `cmake --build . --target pot` refreshes the template from the sources.
find_program(XGETTEXT xgettext)
if(XGETTEXT)
add_custom_target(pot
COMMAND ${XGETTEXT} --keyword=_ --keyword=N_ --from-code=UTF-8 --package-name=openpu
--add-comments=TRANSLATORS -o ${CMAKE_CURRENT_SOURCE_DIR}/openpu.pot
${PROJECT_SOURCE_DIR}/src/ui-gtk/main_window.cpp
${PROJECT_SOURCE_DIR}/src/ui-haiku/main_window.cpp
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
endif()