]> git.lyx.org Git - lyx.git/blob - src/tests/CMakeLists.txt
Account for old versions of Pygments
[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 CiteEnginesList.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 support/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     file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "Format 63\n")
42     file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "Style Standard\n")
43     file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" " LabelType No_Label\n")
44     file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" " Category MainText\n")
45     file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "End\n")
46     file(APPEND "${LYX_TESTS_USERDIR}/layouts/test${bn}.layout" "Input ${bns}\n")
47     add_test(NAME "check_layout/${bns}"
48       COMMAND ${CMAKE_COMMAND}
49         "-DCheckLayout=$<TARGET_FILE:check_layout>"
50         "-DModule=${LYX_TESTS_USERDIR}/layouts/test${bn}"
51         "-DOutput=${CMAKE_CURRENT_BINARY_DIR}/${bn}.out${_checktype}"
52         -P "${TOP_SRC_DIR}/src/tests/check_layout.cmake")
53     set_tests_properties("check_layout/${bns}" PROPERTIES ENVIRONMENT ${LYX_USERDIR_VER}=${LYX_TESTS_USERDIR})
54   else()
55     add_test(NAME "check_layout/${bns}"
56       COMMAND check_layout "${TOP_SRC_DIR}/lib/layouts/${bn}" "${CMAKE_CURRENT_BINARY_DIR}/${bn}.out${_checktype}")
57   endif()
58   settestlabel("check_layout/${bns}" "${_checktype}")
59 endforeach()
60
61 set(check_ExternalTransforms_SOURCES)
62 foreach(_f graphics/GraphicsParams.cpp insets/ExternalTransforms.cpp
63         Length.cpp lengthcommon.cpp tests/check_ExternalTransforms.cpp
64         tests/boost.cpp support/tests/dummy_functions.cpp)
65     list(APPEND check_ExternalTransforms_SOURCES ${TOP_SRC_DIR}/src/${_f})
66 endforeach()
67
68 include_directories(${TOP_SRC_DIR}/src/tests)
69 add_executable(check_ExternalTransforms ${check_ExternalTransforms_SOURCES})
70
71 target_link_libraries(check_ExternalTransforms support
72         ${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
73 lyx_target_link_libraries(check_ExternalTransforms Magic)
74
75 add_dependencies(lyx_run_tests check_ExternalTransforms)
76 set_target_properties(check_ExternalTransforms PROPERTIES FOLDER "tests/src")
77 target_link_libraries(check_ExternalTransforms ${ICONV_LIBRARY})
78
79 add_test(NAME "check_ExternalTransforms"
80   COMMAND ${CMAKE_COMMAND} -DCommand=$<TARGET_FILE:check_ExternalTransforms>
81         "-DInput=${TOP_SRC_DIR}/src/tests/regfiles/ExternalTransforms"
82         "-DOutput=${CMAKE_CURRENT_BINARY_DIR}/ExternalTransforms_data"
83         -P "${TOP_SRC_DIR}/src/support/tests/supporttest.cmake")
84 add_dependencies(lyx_run_tests check_ExternalTransforms)
85
86 set(check_Length_SOURCES)
87 foreach(_f Length.cpp lengthcommon.cpp tests/check_Length.cpp tests/boost.cpp support/tests/dummy_functions.cpp)
88   list(APPEND check_Length_SOURCES ${TOP_SRC_DIR}/src/${_f})
89 endforeach()
90 add_executable(check_Length ${check_Length_SOURCES})
91
92 target_link_libraries(check_Length support
93         ${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
94 lyx_target_link_libraries(check_Length Magic)
95
96 add_dependencies(lyx_run_tests check_Length)
97 set_target_properties(check_Length PROPERTIES FOLDER "tests/src")
98 target_link_libraries(check_Length ${ICONV_LIBRARY})
99
100 add_test(NAME "check_Length"
101   COMMAND ${CMAKE_COMMAND} -DCommand=$<TARGET_FILE:check_Length>
102         "-DInput=${TOP_SRC_DIR}/src/tests/regfiles/Length"
103         "-DOutput=${CMAKE_CURRENT_BINARY_DIR}/Length_data"
104         -P "${TOP_SRC_DIR}/src/support/tests/supporttest.cmake")
105 add_dependencies(lyx_run_tests check_Length)
106
107 include_directories(${TOP_SRC_DIR}/src/tests)
108 set(check_ListingsCaption_SOURCES)
109 foreach(_f tests/check_ListingsCaption.cpp tests/boost.cpp support/tests/dummy_functions.cpp)
110   list(APPEND check_ListingsCaption_SOURCES ${TOP_SRC_DIR}/src/${_f})
111 endforeach()
112 add_executable(check_ListingsCaption ${check_ListingsCaption_SOURCES})
113
114 target_link_libraries(check_ListingsCaption support
115         ${Lyx_Boost_Libraries} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
116 lyx_target_link_libraries(check_ListingsCaption Magic)
117
118 add_dependencies(lyx_run_tests check_ListingsCaption)
119 set_target_properties(check_ListingsCaption PROPERTIES FOLDER "tests/src")
120 target_link_libraries(check_ListingsCaption ${ICONV_LIBRARY})
121
122 add_test(NAME "check_ListingsCaption"
123   COMMAND ${CMAKE_COMMAND} -DCommand=$<TARGET_FILE:check_ListingsCaption>
124         "-DInput=${TOP_SRC_DIR}/src/tests/regfiles/ListingsCaption"
125         "-DOutput=${CMAKE_CURRENT_BINARY_DIR}/ListingsCaption_data"
126         -P "${TOP_SRC_DIR}/src/support/tests/supporttest.cmake")
127 add_dependencies(lyx_run_tests check_ListingsCaption)
128