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 set(LYX_HOME "out-home")
8 set(LOCALE_DIR "${CMAKE_CURRENT_BINARY_DIR}/locale")
9 file(MAKE_DIRECTORY "${LOCALE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}")
14 # Make sure, the needed programs are in PATH
15 find_program(PCREGREP_EXE "pcregrep")
17 list(APPEND Missing "pcregrep")
19 find_program(WMCTRL_EXE "wmctrl")
21 list(APPEND Missing "wmctrl")
23 # This is needed to build xvkbd
24 # Programs pcregrep wmctrl and xvkbd are used in subsequent scripts
27 # Check for needed libraries for xvkbd
28 # do not add autotests, if any of them is lacking
32 list(APPEND Missing "X11")
34 find_package(PkgConfig)
36 foreach(_lb "xaw7" "xmu" "xtst")
37 pkg_check_modules(${_lb}LIB ${_lb})
38 if(${_lb}LIB_LIBRARIES)
39 list(APPEND XVFBDLIBS ${${_lb}LIB_LIBRARIES})
41 list(APPEND Missing ${_lb})
45 foreach(_lb "Xaw7" "Xmu")
46 find_library(${_lb}LIB ${_lb})
48 list(APPEND XVFBDLIBS ${${_lb}LIB})
50 list(APPEND Missing ${_lb})
53 foreach(_lb Xt XTest X11)
55 list(APPEND XVFBDLIBS ${X11_${_lb}_LIB})
57 list(APPEND Missing ${_lb})
62 list(REMOVE_DUPLICATES XVFBDLIBS)
66 message(STATUS "Missing Libraries or programs to create xvkbd: ${Missing}")
67 message(STATUS "cmake build is therefore omitting keytests")
75 add_subdirectory(xvkbd)
78 set(KEYTEST "${CMAKE_CURRENT_SOURCE_DIR}/keytest.py")
79 file(GLOB TESTST RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*-in.txt")
80 file(GLOB TESTSS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*-in.sh")
81 set(_firsttxt first-time-in.txt hello-world-in.txt)
82 foreach(_f ${_firsttxt})
83 list(FIND TESTST ${_f} _ff)
84 if(NOT _ff GREATER -1)
89 list(REMOVE_ITEM TESTST ${_firsttxt})
93 foreach(_tf ${_firsttxt} ${TESTST})
94 string(REGEX REPLACE "-in\\.(txt|sh)" "" _t ${_tf})
95 add_test(NAME keytest/${_t}
96 WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}"
97 COMMAND ${CMAKE_COMMAND}
98 -DLYX_TESTS_USERDIR=${LYX_TESTS_USERDIR}
99 -DAUTOTEST_ROOT=${TOP_SRC_DIR}/development/autotests
100 -DPO_BUILD_DIR=${TOP_BINARY_DIR}/po
101 -DKEYTEST_INFILE=${_tf}
102 -DBINDIR=$<TARGET_FILE_DIR:${_lyx}>
104 -DWORKDIR=${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}
105 -DLYX_USERDIR_VER=${LYX_USERDIR_VER}
106 -DKEYTEST_OUTFILE=${_t}-out.txt
108 -DFRONTEND=${LYX_USE_QT}
109 -DLOCALE_DIR=${LOCALE_DIR}
110 -P ${TOP_SRC_DIR}/development/autotests/single-test.cmake)
111 settestlabel(keytest/${_t} "key")
112 set_tests_properties(keytest/${_t} PROPERTIES RUN_SERIAL ON)
117 if (LYX_ENABLE_EXPORT_TESTS)
118 include(${TOP_SRC_DIR}/development/autotests/ExportTests.cmake)