diff options
| author | Patrick Storz <eduard.braun2@gmx.de> | 2019-02-10 22:51:51 +0000 |
|---|---|---|
| committer | Patrick Storz <eduard.braun2@gmx.de> | 2019-02-16 16:56:17 +0000 |
| commit | a693c5a412381fdcab589a2cf8c2190a9e75ac9e (patch) | |
| tree | 4cacdd7782a3ad4589a8833186c3f6913bc5d483 /share/templates/CMakeLists.txt | |
| parent | Fix preview for large file (diff) | |
| download | inkscape-a693c5a412381fdcab589a2cf8c2190a9e75ac9e.tar.gz inkscape-a693c5a412381fdcab589a2cf8c2190a9e75ac9e.zip | |
Optimize creation of localized default templates
- extract localized strings directly from .po/.mo files instead of
having them in a separate file
- drop dependency on perl
- avoid re-creating the templates on each build
Diffstat (limited to 'share/templates/CMakeLists.txt')
| -rw-r--r-- | share/templates/CMakeLists.txt | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/share/templates/CMakeLists.txt b/share/templates/CMakeLists.txt index aecdca6bb..563c55837 100644 --- a/share/templates/CMakeLists.txt +++ b/share/templates/CMakeLists.txt @@ -12,13 +12,23 @@ add_custom_target(templates_h ALL DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/templates. install(FILES ${_FILES} "README" DESTINATION ${INKSCAPE_SHARE_INSTALL}/templates) -install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DESTINATION ${INKSCAPE_SHARE_INSTALL} - FILES_MATCHING PATTERN "*.svg" PATTERN "CMakeFiles" EXCLUDE ) -add_custom_target(inkscape_default_svg ALL - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/create_defaults.pl ${CMAKE_CURRENT_SOURCE_DIR}/default.svg - #BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/default-* - COMMAND sh -c "${CMAKE_CURRENT_SOURCE_DIR}/create_defaults.pl" - COMMAND sh -c "mv default-* ${CMAKE_CURRENT_BINARY_DIR}" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) +# create localized versions of default.svg +file(GLOB POFILES ${CMAKE_SOURCE_DIR}/po/*.po) + foreach(pofile ${POFILES}) + string(REGEX REPLACE "(.+(\\\\|/))+" "${CMAKE_BINARY_DIR}/po/" pofile ${pofile}) + string(REGEX REPLACE "\\.po$" ".gmo" pofile ${pofile}) + list(APPEND GMOFILES "${pofile}") +endforeach(pofile) + +add_custom_command( + OUTPUT default_templates.timestamp + COMMAND ./create_default_templates.py ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/default.svg ${CMAKE_CURRENT_SOURCE_DIR}/create_default_templates.py ${GMOFILES} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "Generating localized default templates" +) +add_custom_target(default_templates ALL DEPENDS default_templates.timestamp) +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DESTINATION ${INKSCAPE_SHARE_INSTALL} + FILES_MATCHING PATTERN "*.svg" PATTERN "CMakeFiles" EXCLUDE ) |
