Port the lexer from a QRegExp based state machine to a TextProcessor.
[grantlee:grantlee.git] / templates / tests / CMakeLists.txt
1 project(grantlee_templates_tests)
2
3 include_directories( ${QT_INCLUDES}
4   ${CMAKE_CURRENT_BINARY_DIR}
5 )
6
7 set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} )
8
9 set( GRANTLEE_PLUGIN_PATH "${CMAKE_BINARY_DIR}/" )
10
11 configure_file(grantlee_paths.h.cmake ${PROJECT_BINARY_DIR}/grantlee_paths.h)
12
13 set(TESTS_LOCALES "fr_FR" "de_DE")
14
15 set(LINGUIST_TS_ARGS COMMAND "${QT_LUPDATE_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/test_input.cpp" "-ts")
16
17 foreach(TESTS_LOCALE ${TESTS_LOCALES})
18     set( LINGUIST_TS_ARGS ${LINGUIST_TS_ARGS} "${CMAKE_CURRENT_SOURCE_DIR}/test_${TESTS_LOCALE}.ts" )
19 endforeach()
20
21 add_custom_target(test_l10n
22   ${LINGUIST_TS_ARGS}
23 )
24
25 set( LINGUIST_QM_ARGS COMMAND "${QT_LRELEASE_EXECUTABLE}" )
26
27 foreach(TESTS_LOCALE ${TESTS_LOCALES})
28     set( generate_QMs ${generate_QMs} ${LINGUIST_QM_ARGS} "${CMAKE_CURRENT_SOURCE_DIR}/test_${TESTS_LOCALE}.ts" "-qm" "${CMAKE_CURRENT_BINARY_DIR}/test_${TESTS_LOCALE}.qm" )
29 endforeach()
30
31 add_custom_command(
32   OUTPUT test_de_DE.qm test_fr_FR.qm
33   ${generate_QMs}
34   DEPENDS test_de_DE.ts test_fr_FR.ts
35 )
36
37 configure_file(testresource.qrc.cmake "${PROJECT_BINARY_DIR}/testresource.qrc")
38
39 set (_rcc_file "${PROJECT_BINARY_DIR}/testresource.qrc")
40 qt4_add_resources(_testresource_rcc_src ${_rcc_file} OPTIONS -root "/" )
41
42 macro(GRANTLEE_TEMPLATES_UNIT_TESTS)
43   foreach(_testname ${ARGN})
44     set(_testSrcs ${_testname}.cpp)
45     set(moc_output_file "${CMAKE_CURRENT_BINARY_DIR}/${_testname}.moc")
46     qt4_generate_moc(${_testname}.cpp ${moc_output_file})
47     add_executable(${_testname}_exec
48                   ${_testSrcs}
49                   ${moc_output_file}
50                   ${_testresource_rcc_src}
51                   ${PROJECT_SOURCE_DIR}/../lib/lexer.cpp
52                   ${PROJECT_SOURCE_DIR}/../lib/textprocessingmachine.cpp
53                   ${PROJECT_SOURCE_DIR}/../lib/nulllocalizer.cpp )
54     add_test(${_testname} ${_testname}_exec )
55     target_link_libraries(${_testname}_exec ${QT_QTTEST_LIBRARY} ${Grantlee_TEMPLATES_LIBRARIES} )
56   endforeach(_testname)
57 endmacro(GRANTLEE_TEMPLATES_UNIT_TESTS)
58
59 grantlee_templates_unit_tests(
60   testsafestring
61   testbuiltins
62   testloadertags
63   testdefaulttags
64   testscriptabletags
65   testfilters
66   testgenerictypes
67   testgenericcontainers
68   testinternationalization
69   benchmarks
70 )
71
72 add_subdirectory(pluginpointertest)
73