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} \
25 # -DTOP_SRC_DIR=${TOP_SRC_DIR}
26 # -DPERL_EXECUTABLE=${PERL_EXECUTABLE}
27 # -P "${TOP_SRC_DIR}/development/autotests/export.cmake"
30 set(Perl_Script "${TOP_SRC_DIR}/development/autotests/useSystemFonts.pl")
32 message(STATUS "using fonttype = ${_ft}")
33 if(format MATCHES "dvi3|pdf4|pdf5")
34 message(STATUS "LYX_TESTS_USERDIR = ${LYX_TESTS_USERDIR}")
35 message(STATUS "Converting with perl ${Perl_Script}")
36 set(LYX_SOURCE "${WORKDIR}/${file}_${format}_${_ft}.lyx")
37 message(STATUS "Using source \"${LYX_ROOT}/${file}.lyx\"")
38 message(STATUS "Using dest \"${LYX_SOURCE}\"")
39 execute_process(COMMAND ${PERL_EXECUTABLE} "${Perl_Script}" "${LYX_ROOT}/${file}.lyx" "${LYX_SOURCE}" ${format} ${_ft}
41 string(COMPARE EQUAL ${_err} 0 _erg)
43 message(FATAL_ERROR "Export failed while converting")
46 message(STATUS "Not converting")
47 set(LYX_SOURCE "${LYX_ROOT}/${file}.lyx")
50 message(STATUS "Executing ${lyx} -userdir \"${LYX_TESTS_USERDIR}\" -E ${format} ${file}.${extension} \"${LYX_SOURCE}\"")
51 set(ENV{${LYX_USERDIR_VER}} "${LYX_TESTS_USERDIR}")
52 execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${file}.${extension})
54 COMMAND ${lyx} -userdir "${LYX_TESTS_USERDIR}" -E ${format} ${file}.${extension} "${LYX_SOURCE}"
57 string(COMPARE EQUAL ${_err} 0 _erg)
59 string(COMPARE NOTEQUAL ${_err} 0 _erg)
62 message(STATUS "Exporting ${f}.lyx to ${format}")
63 message(FATAL_ERROR "Export failed")