1 # This file is part of LyX, the document processor.
2 # Licence details can be found in the file COPYING.
4 # Copyright (c) 2012 Kornel Benko kornel@lyx.org
7 # LYX_ROOT = ${TOP_SRC_DIR}/lib/{doc,examples,templates}
8 # LYX_USERDIR_VER = Name of environment variable for the user directory
10 # format = lyx16x|xhtml
11 # extension = 16.lyx|xhtml
14 # Script should be called like:
15 # cmake -DLYX_ROOT=xxx \
16 # -DLYX_TESTS_USERDIR=${LYX_TESTS_USERDIR} \
17 # -DWORKDIR=${BUILD_DIR}/autotests/out-home \
18 # -DLYX_USERDIR_VER=${LYX_USERDIR_VER} \
24 # -DTOP_SRC_DIR=${TOP_SRC_DIR}
25 # -DPERL_EXECUTABLE=${PERL_EXECUTABLE}
26 # -P "${TOP_SRC_DIR}/development/autotests/export.cmake"
29 set(Perl_Script "${TOP_SRC_DIR}/development/autotests/useSystemFonts.pl")
30 if(format MATCHES "dvi3|pdf4|pdf5")
31 message(STATUS "LYX_TESTS_USERDIR = ${LYX_TESTS_USERDIR}")
32 message(STATUS "Converting with perl ${Perl_Script}")
33 set(LYX_SOURCE "${WORKDIR}/${file}_${format}.lyx")
34 message(STATUS "Using source \"${LYX_ROOT}/${file}.lyx\"")
35 message(STATUS "Using dest \"${LYX_SOURCE}\"")
36 execute_process(COMMAND ${PERL_EXECUTABLE} "${Perl_Script}" "${LYX_ROOT}/${file}.lyx" "${LYX_SOURCE}" ${format}
38 string(COMPARE EQUAL ${_err} 0 _erg)
40 message(FATAL_ERROR "Export failed while converting")
43 message(STATUS "Not converting")
44 set(LYX_SOURCE "${LYX_ROOT}/${file}.lyx")
47 message(STATUS "Executing ${lyx} -userdir \"${LYX_TESTS_USERDIR}\" -E ${format} ${file}.${extension} \"${LYX_SOURCE}\"")
48 set(ENV{${LYX_USERDIR_VER}} "${LYX_TESTS_USERDIR}")
49 execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${file}.${extension})
51 COMMAND ${lyx} -userdir "${LYX_TESTS_USERDIR}" -E ${format} ${file}.${extension} "${LYX_SOURCE}"
54 string(COMPARE EQUAL ${_err} 0 _erg)
56 string(COMPARE NOTEQUAL ${_err} 0 _erg)
59 message(STATUS "Exporting ${f}.lyx to ${format}")
60 message(FATAL_ERROR "Export failed")