2016-07-24 07:30:14 +00:00
|
|
|
# This file is part of LyX, the document processor.
|
|
|
|
# Licence details can be found in the file COPYING.
|
|
|
|
#
|
|
|
|
# Copyright (c) 2016 Kornel Benko kornel@lyx.org
|
|
|
|
#
|
|
|
|
# Script should be called like:
|
|
|
|
# cmake -DTOP_SRC_DIR=xxx \
|
|
|
|
# -DDestFile=xxx \
|
|
|
|
# -DLYX_PYTHON_EXECUTABLE=xxx \
|
|
|
|
# -DParType=xxx \
|
|
|
|
# -DSources=xxx \
|
2016-07-27 05:34:50 +00:00
|
|
|
# -DLYX_PY_POLIB=${LYX_PY_POLIB} \
|
2016-07-24 07:30:14 +00:00
|
|
|
# -P "${TOP_SRC_DIR}/po/CreateLayoutTranslations.cmake"
|
2016-07-23 18:30:45 +00:00
|
|
|
|
|
|
|
set(_dst ${DestFile})
|
|
|
|
set(type ${ParType})
|
|
|
|
set(_src_files ${Sources})
|
|
|
|
|
2016-07-24 07:30:14 +00:00
|
|
|
macro(die_if _err text)
|
|
|
|
string(COMPARE EQUAL ${${_err}} 0 _erg)
|
|
|
|
if(NOT _erg)
|
|
|
|
message(FATAL_ERROR "CreateLayoutTranslations: ${text}")
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
2016-07-23 18:30:45 +00:00
|
|
|
message(STATUS "Starting CreateLayoutTranslations")
|
2016-07-27 05:34:50 +00:00
|
|
|
if ("${LYX_PY_POLIB}" STREQUAL "")
|
|
|
|
message(STATUS "Missing needed pythons polib, be prepared for error")
|
|
|
|
endif()
|
2016-07-23 18:30:45 +00:00
|
|
|
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${TOP_SRC_DIR}/lib/layouttranslations" "${_dst}"
|
|
|
|
RESULT_VARIABLE _err)
|
2016-07-24 07:30:14 +00:00
|
|
|
die_if(_err "Copy of layouttranslations failed")
|
2016-07-23 18:30:45 +00:00
|
|
|
|
|
|
|
execute_process(COMMAND ${LYX_PYTHON_EXECUTABLE}
|
|
|
|
"${TOP_SRC_DIR}/po/lyx_pot.py" -b "${TOP_SRC_DIR}" -o "${_dst}" -t ${type}
|
|
|
|
"--src_file=${_src_files}"
|
2018-04-22 10:06:47 +00:00
|
|
|
OUTPUT_VARIABLE _err_out
|
2016-07-23 18:30:45 +00:00
|
|
|
RESULT_VARIABLE _err)
|
2018-04-22 10:06:47 +00:00
|
|
|
if(_err)
|
|
|
|
message(STATUS "${_err_out}")
|
|
|
|
endif()
|
2016-07-24 07:30:14 +00:00
|
|
|
die_if(_err "Calling lyx_pot.py failed")
|
2016-07-23 18:30:45 +00:00
|
|
|
|
|
|
|
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_dst}" "${TOP_SRC_DIR}/lib/layouttranslations"
|
|
|
|
RESULT_VARIABLE _err)
|
2016-07-24 07:30:14 +00:00
|
|
|
die_if(_err "Copy of layouttranslations to source failed")
|
2016-07-23 18:30:45 +00:00
|
|
|
|