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
8 # Make sure, the needed programs are in PATH
9 find_program(PCREGREP_EXE "pcregrep")
10 find_program(WMCTRL_EXE "wmctrl")
11 # This is needed to build xvkbd
12 # Programs pcregrep wmctrl and xvkbd are used in subsequent scripts
15 if(X11_FOUND AND PCREGREP_EXE AND WMCTRL_EXE)
16 #message(STATUS "PCREGREP_EXE and WMCTRL_EXE found")
19 add_subdirectory(xvkbd)
21 set(KEYTEST "${CMAKE_CURRENT_SOURCE_DIR}/keytest.py")
22 set(LYX_HOME "out-home")
23 set(LYX_USERDIR "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}/.lyx")
24 set(LOCALE_DIR "${CMAKE_CURRENT_BINARY_DIR}/locale")
25 file(GLOB TESTST RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*-in.txt")
26 file(GLOB TESTSS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*-in.sh")
27 list(REMOVE_ITEM TESTST hello-world-in.txt first-time-in.txt)
29 file(MAKE_DIRECTORY "${LYX_USERDIR}" "${LOCALE_DIR}")
31 foreach(_tf first-time-in.txt hello-world-in.txt ${TESTST})
32 string(REGEX REPLACE "-in\\.(txt|sh)" "" _t ${_tf})
33 add_test(NAME autotests/${_t}
34 WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}"
35 COMMAND ${CMAKE_COMMAND}
36 -DAUTOTEST_ROOT=${TOP_SRC_DIR}/development/autotests
37 -DPO_BUILD_DIR=${TOP_BINARY_DIR}/po
38 -DKEYTEST_INFILE=${_tf}
39 -DBINDIR=$<TARGET_FILE_DIR:${_lyx}>
41 -DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}
42 -DKEYTEST_OUTFILE=${_t}-out.txt
44 -DLOCALE_DIR=${LOCALE_DIR}
45 -P ${TOP_SRC_DIR}/development/autotests/single-test.cmake)
50 macro(getdefaultoutputformat filepath varname)
51 file(STRINGS "${filepath}" lines)
52 set(${varname} "pdf") # try at least this one
54 if(_l MATCHES "^\\\\default_output_format +\([^ ]+\)")
55 set(found ${CMAKE_MATCH_1})
56 if(found STREQUAL "default")
57 set(found "pdf" "pdf2" "pdf5")
59 set(${varname} ${found})
65 foreach(libsubfolder doc examples templates)
66 set(LIBSUB_SRC_DIR "${TOP_SRC_DIR}/lib/${libsubfolder}")
67 file(GLOB_RECURSE lyx_files RELATIVE "${LIBSUB_SRC_DIR}" "${LIBSUB_SRC_DIR}/*.lyx")
69 # Now create 2 lists. One for files in a language dir, one without
72 foreach(f ${lyx_files})
73 string(REGEX MATCHALL "^[a-z][a-z](_[A-Z][A-Z])?\\/" _v ${f})
75 list(APPEND lang_lyx_files ${f})
77 list(APPEND nolang_lyx_files ${f})
80 foreach(f ${nolang_lyx_files} ${lang_lyx_files})
81 if(f MATCHES "MergedManuals")
82 # we do not test (for now) the uncompilable file MergedManuals.lyx
85 string(REGEX REPLACE "\\.lyx$" "" f ${f})
86 add_test(NAME export/${libsubfolder}/${f}_lyx16
87 WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}"
88 COMMAND ${CMAKE_COMMAND} -DLYX_ROOT=${LIBSUB_SRC_DIR}
89 -Dlyx=$<TARGET_FILE:${_lyx}>
93 -P "${TOP_SRC_DIR}/development/autotests/export.cmake")
94 getdefaultoutputformat("${LIBSUB_SRC_DIR}/${f}.lyx" formatlist)
95 foreach(format "xhtml" ${formatlist})
96 add_test(NAME export/${libsubfolder}/${f}_${format}
97 WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}"
98 COMMAND ${CMAKE_COMMAND} -DLYX_ROOT=${LIBSUB_SRC_DIR}
99 -Dlyx=$<TARGET_FILE:${_lyx}>
101 -Dextension=${format}
103 -P "${TOP_SRC_DIR}/development/autotests/export.cmake")