]> git.lyx.org Git - lyx.git/blobdiff - po/CMakeLists.txt
Add latexfonts_l10.pot to cmake build
[lyx.git] / po / CMakeLists.txt
index fcceade5bb2fecb95017fc25921014239b350985..a2e98190de785a67eec73b3136cb27c51f649048 100755 (executable)
@@ -78,6 +78,7 @@ SET_SOURCE_FILES_PROPERTIES("${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.pot" GENERA
 add_gettext_python(qt4 src/frontends/qt4/ui *.ui)
 add_gettext_python(layouts lib/layouts *.layout *.inc *.module)
 add_gettext_python(languages lib languages)
+add_gettext_python(latexfonts lib latexfonts)
 add_gettext_python(encodings lib encodings)
 add_gettext_python(ui lib/ui *.ui *.inc)
 add_gettext_python(external lib external_templates)
@@ -88,6 +89,8 @@ ADD_CUSTOM_COMMAND(
     OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat.pot"
     COMMAND ${LYX_PYTHON_EXECUTABLE}
     ARGS   "${TOP_SRC_DIR}/development/cmake/po/cat.py" ${_py_sources} > "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat.pot"
+    COMMAND ${LYX_PYTHON_EXECUTABLE}
+      ARGS   "${TOP_SRC_DIR}/development/cmake/po/dos2unix.py" "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat.pot"
     DEPENDS ${_py_sources}
     )
 
@@ -103,7 +106,7 @@ SET(_potfiles_dep)
 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/POTFILES.in "")
 file(GLOB_RECURSE _tmp_potfiles RELATIVE ${TOP_SRC_DIR}/ ${TOP_SRC_DIR}/src/*.h  ${TOP_SRC_DIR}/src/*.cpp  ${TOP_SRC_DIR}/src/*.cpp.in)
 list(SORT _tmp_potfiles)
-list(REMOVE_ITEM _tmp_potfiles src/support/Package.cpp)
+list(REMOVE_ITEM _tmp_potfiles src/support/Package.cpp)
 
 foreach(_f ${_tmp_potfiles})
   # we don't need to select only relevant files because the outcome of xgettext
@@ -124,13 +127,30 @@ ADD_CUSTOM_COMMAND(
 #
 # We have to copy the po-files first,
 # otherwise they would be modified (inside the macro GETTEXT_CREATE_TRANSLATIONS())
-# This makes the "svn up" on po-files work again
+# This makes the "git pull" on po-files work again
 file(GLOB LYX_BASE_PO_FILES RELATIVE ${TOP_SRC_DIR}/po ${TOP_SRC_DIR}/po/*.po)
+list(SORT LYX_BASE_PO_FILES)
 set(LYX_PO_FILES)
 SET(LYX_UPDATED_PO_FILES)
 SET(LYX_DEST_PO ${TOP_SRC_DIR}/po)
 
+set(CONFIGURED_LANGUAGES)              # from file LINGUAS
+set(INSTALLED_LANGUAGES)               # from names of existing po-files
+
+file(STRINGS "${TOP_SRC_DIR}/po/LINGUAS" _lang_lines)
+foreach(_c_l ${_lang_lines})
+  if(NOT _c_l MATCHES "^#.*")
+    string(REPLACE " " ";" _c_l ${_c_l}) #Split ${_c_l}
+    list(APPEND CONFIGURED_LANGUAGES ${_c_l})
+  endif()
+endforeach(_c_l)
+
 foreach(_pofile ${LYX_BASE_PO_FILES})
+  string(REGEX REPLACE "^(.*)\\.po$" "\\1" _inst_lng ${_pofile})
+  list(FIND CONFIGURED_LANGUAGES ${_inst_lng} _lng_idx)
+  if(_lng_idx GREATER -1)
+    list(APPEND INSTALLED_LANGUAGES "${_inst_lng} ")
+  endif()
   add_custom_command(
     OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_pofile}
     COMMAND ${CMAKE_COMMAND} -E copy ${TOP_SRC_DIR}/po/${_pofile} ${CMAKE_CURRENT_BINARY_DIR}/${_pofile}
@@ -139,14 +159,30 @@ foreach(_pofile ${LYX_BASE_PO_FILES})
   list(APPEND LYX_PO_FILES ${CMAKE_CURRENT_BINARY_DIR}/${_pofile})
 endforeach(_pofile)
 
+# We mimic the autoconf behaviour, e.g write this file at "configure" time
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installed_translations" ${INSTALLED_LANGUAGES})
+
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/installed_translations" DESTINATION .)
+
 set(LYX_UPDATED_PO_FILES)
 foreach(_pofile ${LYX_BASE_PO_FILES})
-  add_custom_command(
-    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_pofile}.copied
-    COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/${_pofile} ${LYX_DEST_PO}/${_pofile}
-    COMMAND ${CMAKE_COMMAND} -E touch ${_pofile}.copied
-    DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_pofile}
-    )
+  if(WIN32)
+    add_custom_command(
+      OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_pofile}.copied
+      COMMAND ${LYX_PYTHON_EXECUTABLE}
+        ARGS   "${TOP_SRC_DIR}/development/cmake/po/unix2dos.py" "${CMAKE_CURRENT_BINARY_DIR}/${_pofile}"
+      COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/${_pofile} ${LYX_DEST_PO}/${_pofile}
+      COMMAND ${CMAKE_COMMAND} -E touch ${_pofile}.copied
+      DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_pofile}
+      )
+  else()
+    add_custom_command(
+      OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_pofile}.copied
+      COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/${_pofile} ${LYX_DEST_PO}/${_pofile}
+      COMMAND ${CMAKE_COMMAND} -E touch ${_pofile}.copied
+      DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_pofile}
+      )
+  endif()
   list(APPEND LYX_UPDATED_PO_FILES ${CMAKE_CURRENT_BINARY_DIR}/${_pofile}.copied)
 endforeach(_pofile)