feat(build): copy extra files to bin directory

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2013-12-22 21:00:32 -08:00
parent e91fdaed00
commit 84c984a435
2 changed files with 17 additions and 3 deletions

View file

@ -14,8 +14,8 @@ option(SPLIT_STACK "SPLIT_STACK" OFF)
option(READLINE "READLINE" OFF) option(READLINE "READLINE" OFF)
# Added for CTest # Added for CTest
INCLUDE(CTest) include(CTest)
CONFIGURE_FILE(${LEAN_SOURCE_DIR}/CTestCustom.cmake.in configure_file(${LEAN_SOURCE_DIR}/CTestCustom.cmake.in
${LEAN_BINARY_DIR}/CTestCustom.cmake @ONLY) ${LEAN_BINARY_DIR}/CTestCustom.cmake @ONLY)
set(LEAN_EXTRA_LINKER_FLAGS "") set(LEAN_EXTRA_LINKER_FLAGS "")
@ -217,6 +217,7 @@ endif()
set(CMAKE_EXE_LINKER_FLAGS_TESTCOV "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage") set(CMAKE_EXE_LINKER_FLAGS_TESTCOV "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
set(EXTRA_LIBS ${LEAN_LIBS} ${EXTRA_LIBS}) set(EXTRA_LIBS ${LEAN_LIBS} ${EXTRA_LIBS})
add_subdirectory(shell) add_subdirectory(shell)
add_subdirectory(tests/util) add_subdirectory(tests/util)
add_subdirectory(tests/util/numerics) add_subdirectory(tests/util/numerics)
add_subdirectory(tests/util/interval) add_subdirectory(tests/util/interval)

View file

@ -4,6 +4,20 @@ add_executable(lean lean.cpp)
add_dependencies(lean githash) add_dependencies(lean githash)
target_link_libraries(lean ${EXTRA_LIBS}) target_link_libraries(lean ${EXTRA_LIBS})
function(add_extra_module indir)
file(GLOB EXTRA_LUA_FILES "${LEAN_SOURCE_DIR}/extra/${indir}/*.lua")
foreach(FILE ${EXTRA_LUA_FILES})
get_filename_component(FNAME ${FILE} NAME)
add_custom_command(OUTPUT ${LEAN_BINARY_DIR}/shell/${indir}/${FNAME}
COMMAND ${CMAKE_COMMAND} -E copy ${FILE} ${LEAN_BINARY_DIR}/shell/${indir}/${FNAME}
MAIN_DEPENDENCY ${FILE})
add_custom_target("${FNAME}_extra" DEPENDS ${LEAN_BINARY_DIR}/shell/${indir}/${FNAME})
add_dependencies(lean "${FNAME}_extra")
endforeach(FILE)
endfunction()
add_extra_module(.)
add_test(example1_stdin1 ${LEAN_SOURCE_DIR}/cmake/redirect.sh ${CMAKE_CURRENT_BINARY_DIR}/lean "${LEAN_SOURCE_DIR}/../tests/lean/single.lean") add_test(example1_stdin1 ${LEAN_SOURCE_DIR}/cmake/redirect.sh ${CMAKE_CURRENT_BINARY_DIR}/lean "${LEAN_SOURCE_DIR}/../tests/lean/single.lean")
add_test(example1_stdin2 ${LEAN_SOURCE_DIR}/cmake/redirect.sh ${CMAKE_CURRENT_BINARY_DIR}/lean "-l" "${LEAN_SOURCE_DIR}/../tests/lean/single.lean") add_test(example1_stdin2 ${LEAN_SOURCE_DIR}/cmake/redirect.sh ${CMAKE_CURRENT_BINARY_DIR}/lean "-l" "${LEAN_SOURCE_DIR}/../tests/lean/single.lean")
add_test(example1_stdin3 ${LEAN_SOURCE_DIR}/cmake/redirect.sh ${CMAKE_CURRENT_BINARY_DIR}/lean "--lean" "${LEAN_SOURCE_DIR}/../tests/lean/single.lean") add_test(example1_stdin3 ${LEAN_SOURCE_DIR}/cmake/redirect.sh ${CMAKE_CURRENT_BINARY_DIR}/lean "--lean" "${LEAN_SOURCE_DIR}/../tests/lean/single.lean")
@ -23,7 +37,6 @@ add_test(lean_unknown_option ${LEAN_SOURCE_DIR}/cmake/check_failure.sh "${CMAKE_
add_test(lean_unknown_file1 ${LEAN_SOURCE_DIR}/cmake/check_failure.sh "${CMAKE_CURRENT_BINARY_DIR}/lean" "boofoo.lean") add_test(lean_unknown_file1 ${LEAN_SOURCE_DIR}/cmake/check_failure.sh "${CMAKE_CURRENT_BINARY_DIR}/lean" "boofoo.lean")
add_test(lean_unknown_file2 ${LEAN_SOURCE_DIR}/cmake/check_failure.sh "${CMAKE_CURRENT_BINARY_DIR}/lean" "boofoo.lua") add_test(lean_unknown_file2 ${LEAN_SOURCE_DIR}/cmake/check_failure.sh "${CMAKE_CURRENT_BINARY_DIR}/lean" "boofoo.lua")
# LEAN EXAMPLES # LEAN EXAMPLES
file(GLOB LEANEXAMPLES "${LEAN_SOURCE_DIR}/../examples/lean/*.lean") file(GLOB LEANEXAMPLES "${LEAN_SOURCE_DIR}/../examples/lean/*.lean")
FOREACH(T ${LEANEXAMPLES}) FOREACH(T ${LEANEXAMPLES})