From 6fa12b09718bb1709f0c613c2fb8f40b71f1e147 Mon Sep 17 00:00:00 2001 From: Kornel Benko Date: Mon, 30 Jul 2012 09:30:16 +0200 Subject: [PATCH] Adapt tex2lyx roundtrip to cmake build. Use build tree only. --- CMakeLists.txt | 1 + lib/examples/CMakeLists.txt | 11 +++++++++++ src/tex2lyx/CMakeLists.txt | 2 ++ src/tex2lyx/test/CMakeLists.txt | 35 +++++++++++++++++++++++++++++++++ src/tex2lyx/test/runtests.py | 12 +++++++---- 5 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 lib/examples/CMakeLists.txt create mode 100644 src/tex2lyx/test/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 2766fcd729..e3dfa48f7e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -668,6 +668,7 @@ endif() add_subdirectory(src "${TOP_BINARY_DIR}/src") add_subdirectory(lib/lyx2lyx "${TOP_BINARY_DIR}/lyx2lyx") add_subdirectory(lib/scripts "${TOP_BINARY_DIR}/scripts") +add_subdirectory(lib/examples "${TOP_BINARY_DIR}/lib/examples") if(LYX_INSTALL) diff --git a/lib/examples/CMakeLists.txt b/lib/examples/CMakeLists.txt new file mode 100644 index 0000000000..5e78b2721e --- /dev/null +++ b/lib/examples/CMakeLists.txt @@ -0,0 +1,11 @@ +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# Copyright (c) 2012 Kornel Benko, +# + +project(test) + +foreach(_arg longsheet.gnumeric iecc05.fen beamer-icsi-logo.pdf) + configure_file(${_arg} "${CMAKE_CURRENT_BINARY_DIR}/${_arg}" COPYONLY) +endforeach(_arg) diff --git a/src/tex2lyx/CMakeLists.txt b/src/tex2lyx/CMakeLists.txt index 00a577f323..f032d4d36b 100644 --- a/src/tex2lyx/CMakeLists.txt +++ b/src/tex2lyx/CMakeLists.txt @@ -63,6 +63,8 @@ endif() project_source_group("${GROUP_CODE}" tex2lyx_sources tex2lyx_headers) +add_subdirectory(test) + if(LYX_BUNDLE) install(TARGETS ${_tex2lyx} RUNTIME DESTINATION bin diff --git a/src/tex2lyx/test/CMakeLists.txt b/src/tex2lyx/test/CMakeLists.txt new file mode 100644 index 0000000000..19abf65aff --- /dev/null +++ b/src/tex2lyx/test/CMakeLists.txt @@ -0,0 +1,35 @@ +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# Copyright (c) 2012 Kornel Benko, +# + +project(test) + +set(_test_depend "${TOP_SRC_DIR}/src/tex2lyx/test/test.ltx") +set(_test_output "${TOP_SRC_DIR}/src/tex2lyx/test/test.lyx.tex") +foreach(_arg runtests.py DummyDocument.tex test.ltx foo.eps foo.png) + configure_file("${TOP_SRC_DIR}/src/tex2lyx/test/${_arg}" "${CMAKE_CURRENT_BINARY_DIR}/${_arg}" COPYONLY) +endforeach(_arg) + +foreach(_arg test-structure test-insets box-color-size-space-align CJK XeTeX-polyglossia) + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_arg}.tex" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${TOP_SRC_DIR}/src/tex2lyx/test/${_arg}.tex" "${CMAKE_CURRENT_BINARY_DIR}/${_arg}.tex" + DEPENDS "${TOP_SRC_DIR}/src/tex2lyx/test/${_arg}.tex" + ) + list(APPEND _test_depend "${CMAKE_CURRENT_BINARY_DIR}/${_arg}.tex") + list(APPEND _test_output "${CMAKE_CURRENT_BINARY_DIR}/${_arg}.lyx.tex") + list(APPEND _test_output "${CMAKE_CURRENT_BINARY_DIR}/${_arg}.lyx.lyx") +endforeach(_arg) + +ADD_CUSTOM_COMMAND( + OUTPUT ${_test_output} + COMMAND ${LYX_PYTHON_EXECUTABLE} + ARGS "${CMAKE_CURRENT_BINARY_DIR}/runtests.py" "${TOP_BINARY_DIR}/bin/${_tex2lyx}" "${TOP_SRC_DIR}/lib/scripts" + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + DEPENDS ${_tex2lyx} ${_test_depend} +) + +ADD_CUSTOM_TARGET(test DEPENDS ${_tex2lyx} ${_test_output}) + diff --git a/src/tex2lyx/test/runtests.py b/src/tex2lyx/test/runtests.py index 2478e9c920..084e8e1258 100755 --- a/src/tex2lyx/test/runtests.py +++ b/src/tex2lyx/test/runtests.py @@ -15,17 +15,21 @@ import os, string, sys def usage(prog_name): - return "Usage: %s []" % prog_name + return "Usage: %s [ [