Debian Codegraph @

po/CMakeLists.txt

raw
1 # Distributed under the original FontForge BSD 3-clause license
2
3 # * Run the 'pofiles' command to generate the binary .mo files
4 # * Run the 'potfiles' command to generate the master .pot file
5 # (which contains all translatable strings)
6 # * Run the 'fullpo' command to generate the .po files, merged
7 # with the master .pot file and with context
8
9 # TODO: Probably should add a FindXGettext or something
10 add_custom_target(potfiles
11 COMMAND xgettext
12 --from-code=utf-8
13 -k_ -kN_ -kS_ -kU_ -kNU_ -kP_:1,2
14 --sort-by-file
15 --add-comments=GT:
16 "-o${CMAKE_CURRENT_BINARY_DIR}/FontForge.pot"
17 ../fontforge/*.c
18 ../fontforge/*.cpp
19 ../fontforgeexe/*.c
20 ../fontforgeexe/*.cpp
21 ../fontforgeexe/gtk/*.cpp
22 ../gdraw/*.c
23 ../gutils/*.c
24 ../inc/*.h
25 ../Unicode/*.c
26 ../Unicode/*.h
27 ../desktop/org.fontforge.FontForge.appdata.xml.in
28 ../desktop/org.fontforge.FontForge.desktop
29 COMMAND patch "${CMAKE_CURRENT_BINARY_DIR}/FontForge.pot" "pottitle.patch"
30 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
31 )
32
33 file(STRINGS LINGUAS _langs)
34
35 foreach(_lang ${_langs})
36 set(_input "${CMAKE_CURRENT_SOURCE_DIR}/${_lang}.po")
37 set(_output "${CMAKE_CURRENT_BINARY_DIR}/${_lang}/LC_MESSAGES/FontForge.mo")
38 set(_full "${CMAKE_CURRENT_BINARY_DIR}/full/${_lang}.po")
39 add_custom_command(OUTPUT "${_output}"
40 COMMAND "${GETTEXT_MSGFMT_EXECUTABLE}" --check -o "${_output}" "${_input}"
41 DEPENDS "${_input}"
42 VERBATIM
43 )
44 add_custom_command(OUTPUT "${_full}"
45 COMMAND "${CMAKE_COMMAND}" -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/full"
46 COMMAND "${GETTEXT_MSGMERGE_EXECUTABLE}" -N "${_input}" -F "${CMAKE_CURRENT_BINARY_DIR}/FontForge.pot" -o "${_full}"
47 DEPENDS "${_input}" potfiles
48 VERBATIM
49 )
50 install(FILES "${_output}" DESTINATION "${CMAKE_INSTALL_LOCALEDIR}/${_lang}/LC_MESSAGES" RENAME "FontForge.mo" COMPONENT pofiles)
51 list(APPEND _outputs "${_output}")
52 list(APPEND _fulls "${_full}")
53 endforeach()
54
55 add_custom_target(pofiles ALL DEPENDS ${_outputs})
56 add_custom_target(fullpo DEPENDS ${_fulls})
57 add_custom_target(poupdate
58 COMMAND "${Python3_EXECUTABLE}" "update.py" "${CMAKE_CURRENT_BINARY_DIR}/FontForge.pot"
59 DEPENDS potfiles
60 WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
61 VERBATIM
62 )
63
64 if(ENABLE_MAINTAINER_TOOLS)
65 add_executable(toengb toengb.c)
66 endif()