]> git.lyx.org Git - lyx.git/blob - src/tests/CMakeLists.txt
d440bf68798a73d7e2a7a5585c75cd217abbd0dc
[lyx.git] / src / tests / CMakeLists.txt
1 # This file is part of LyX, the document processor.
2 # Licence details can be found in the file COPYING.
3 #
4 # Copyright (c) 2013 Kornel Benko kornel@lyx.org
5 #
6
7 set(check_layout_SOURCES)
8 foreach(_f insets/InsetLayout.cpp Color.cpp Counters.cpp Floating.cpp
9        FloatList.cpp FontInfo.cpp Layout.cpp LayoutFile.cpp Lexer.cpp
10        ModuleList.cpp Spacing.cpp TextClass.cpp tests/check_layout.cpp
11        tests/boost.cpp tests/dummy_functions.cpp)
12   list(APPEND check_layout_SOURCES "${TOP_SRC_DIR}/src/${_f}")
13 endforeach()
14
15 include_directories(${TOP_SRC_DIR}/src/support/tests)
16
17 add_executable(check_layout ${check_layout_SOURCES})
18
19 target_link_libraries(check_layout support
20   ${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY}
21   ${ZLIB_LIBRARY} ${ICONV_LIBRARY})
22 if(CYGWIN)
23     target_link_libraries(check_layout shlwapi)
24 endif()
25 lyx_target_link_libraries(check_layout Magic)
26
27 add_dependencies(lyx_run_tests check_layout)
28 set_target_properties(check_layout PROPERTIES FOLDER "tests/src")
29
30 file(GLOB layout_files RELATIVE "${TOP_SRC_DIR}/lib/layouts" "${TOP_SRC_DIR}/lib/layouts/*.layout")
31 file(GLOB module_files RELATIVE "${TOP_SRC_DIR}/lib/layouts" "${TOP_SRC_DIR}/lib/layouts/*.module")
32 list(SORT layout_files)
33 list(SORT module_files)
34
35 foreach(bns ${layout_files} ${module_files})
36   string(REGEX REPLACE "\\.(layout|module)" "" bn ${bns})
37   set(_checktype ${CMAKE_MATCH_1})
38   if("${_checktype}" STREQUAL "module")
39     file(WRITE "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "#% Do not delete the line below; configure depends on this\n")
40     file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "#  \\DeclareLaTeXClass{test${bn}}\n")
41
42     file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "Format 5\n")
43     file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "Input ${bns}\n")
44     add_test(NAME "check_layout/${bns}"
45       COMMAND env LYX_USERDIR_22x=${LYX_TESTS_USERDIR} $<TARGET_FILE:check_layout> "${LYX_TESTS_USERDIR}/layouts/test${bn}" "${CMAKE_CURRENT_BINARY_DIR}/${bn}.out${_checktype}")
46   else()
47     add_test(NAME "check_layout/${bns}"
48       COMMAND check_layout "${TOP_SRC_DIR}/lib/layouts/${bn}" "${CMAKE_CURRENT_BINARY_DIR}/${bn}.out${_checktype}")
49   endif()
50   settestlabel("check_layout/${bns}" "${_checktype}")
51 endforeach()
52
53 set(check_ExternalTransforms_SOURCES)
54 foreach(_f graphics/GraphicsParams.cpp insets/ExternalTransforms.cpp
55         Length.cpp lengthcommon.cpp tests/check_ExternalTransforms.cpp
56         tests/boost.cpp tests/dummy_functions.cpp)
57     list(APPEND check_ExternalTransforms_SOURCES ${TOP_SRC_DIR}/src/${_f})
58 endforeach()
59
60 include_directories(${TOP_SRC_DIR}/src/tests)
61 add_executable(check_ExternalTransforms ${check_ExternalTransforms_SOURCES})
62
63 target_link_libraries(check_ExternalTransforms support
64         ${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
65 lyx_target_link_libraries(check_ExternalTransforms Magic)
66
67 add_dependencies(lyx_run_tests check_ExternalTransforms)
68 set_target_properties(check_ExternalTransforms PROPERTIES FOLDER "tests/src")
69 target_link_libraries(check_ExternalTransforms ${ICONV_LIBRARY})
70
71 add_test(NAME "check_ExternalTransforms"
72   COMMAND ${CMAKE_COMMAND} -DCommand=$<TARGET_FILE:check_ExternalTransforms>
73         "-DInput=${TOP_SRC_DIR}/src/tests/regfiles/ExternalTransforms"
74         "-DOutput=${CMAKE_CURRENT_BINARY_DIR}/ExternalTransforms_data"
75         -P "${TOP_SRC_DIR}/src/support/tests/supporttest.cmake")
76 add_dependencies(lyx_run_tests check_ExternalTransforms)
77
78 set(check_ExternalTransforms_SOURCES)
79 foreach(_f graphics/GraphicsParams.cpp insets/ExternalTransforms.cpp
80         Length.cpp lengthcommon.cpp tests/check_ExternalTransforms.cpp
81         tests/boost.cpp tests/dummy_functions.cpp)
82     list(APPEND check_ExternalTransforms_SOURCES ${TOP_SRC_DIR}/src/${_f})
83 endforeach()
84
85 include_directories(${TOP_SRC_DIR}/src/tests)
86 add_executable(check_Length ${check_Length_SOURCES})
87
88 target_link_libraries(check_Length support
89         ${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
90 lyx_target_link_libraries(check_Length Magic)
91
92 add_dependencies(lyx_run_tests check_Length)
93 set_target_properties(check_Length PROPERTIES FOLDER "tests/src")
94 target_link_libraries(check_Length ${ICONV_LIBRARY})
95
96 add_test(NAME "check_Length"
97   COMMAND ${CMAKE_COMMAND} -DCommand=$<TARGET_FILE:check_Length>
98         "-DInput=${TOP_SRC_DIR}/src/tests/regfiles/Length"
99         "-DOutput=${CMAKE_CURRENT_BINARY_DIR}/Length_data"
100         -P "${TOP_SRC_DIR}/src/support/tests/supporttest.cmake")
101 add_dependencies(lyx_run_tests check_Length)
102