2014-10-15 01:58:39 +00:00
|
|
|
if(${EMSCRIPTEN})
|
|
|
|
add_executable(lean.js lean.cpp)
|
2014-10-21 20:18:12 +00:00
|
|
|
target_link_libraries(lean.js ${ALL_LIBS} "--embed-file library --memory-init-file 0")
|
2014-10-15 01:58:39 +00:00
|
|
|
else()
|
|
|
|
add_executable(lean lean.cpp)
|
|
|
|
target_link_libraries(lean ${ALL_LIBS})
|
|
|
|
ADD_CUSTOM_COMMAND(TARGET lean
|
|
|
|
POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${LEAN_SOURCE_DIR}/../bin
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/lean${CMAKE_EXECUTABLE_SUFFIX} ${LEAN_SOURCE_DIR}/../bin/
|
|
|
|
)
|
|
|
|
install(TARGETS lean DESTINATION bin)
|
|
|
|
endif()
|
2013-12-26 00:18:51 +00:00
|
|
|
|
2014-04-29 00:49:23 +00:00
|
|
|
# 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_stdin3 ${LEAN_SOURCE_DIR}/cmake/redirect.sh ${CMAKE_CURRENT_BINARY_DIR}/lean "--lean" "${LEAN_SOURCE_DIR}/../tests/lean/single.lean")
|
2014-06-14 15:01:52 +00:00
|
|
|
# add_test(lean_export ${CMAKE_CURRENT_BINARY_DIR}/lean "-o simple.olean" "${LEAN_SOURCE_DIR}/../tests/lean/run/simple.lean")
|
2014-05-26 11:53:04 +00:00
|
|
|
add_test(lean_help1 ${CMAKE_CURRENT_BINARY_DIR}/lean --help)
|
2014-06-16 23:55:16 +00:00
|
|
|
add_test(lean_help2 ${CMAKE_CURRENT_BINARY_DIR}/lean -h)
|
2014-05-26 11:53:04 +00:00
|
|
|
add_test(lean_version1 ${CMAKE_CURRENT_BINARY_DIR}/lean --version)
|
|
|
|
add_test(lean_version2 ${CMAKE_CURRENT_BINARY_DIR}/lean --v)
|
|
|
|
add_test(lean_ghash1 ${CMAKE_CURRENT_BINARY_DIR}/lean -g)
|
|
|
|
add_test(lean_ghash2 ${CMAKE_CURRENT_BINARY_DIR}/lean --githash)
|
|
|
|
add_test(lean_path1 ${CMAKE_CURRENT_BINARY_DIR}/lean -p)
|
|
|
|
add_test(lean_path2 ${CMAKE_CURRENT_BINARY_DIR}/lean --path)
|
|
|
|
add_test(lean_luahook1 ${CMAKE_CURRENT_BINARY_DIR}/lean --luahook=100 "${LEAN_SOURCE_DIR}/../tests/lua/big.lua")
|
2014-08-10 17:00:04 +00:00
|
|
|
add_test(lean_luahook2 ${CMAKE_CURRENT_BINARY_DIR}/lean -k 100 "${LEAN_SOURCE_DIR}/../tests/lua/big.lua")
|
2014-04-29 00:49:23 +00:00
|
|
|
# add_test(lean_lua1 ${LEAN_SOURCE_DIR}/cmake/redirect.sh "${CMAKE_CURRENT_BINARY_DIR}/lean" "--lua" "${LEAN_SOURCE_DIR}/../tests/lua/single.lua")
|
|
|
|
# add_test(lean_lua2 ${LEAN_SOURCE_DIR}/cmake/redirect.sh "${CMAKE_CURRENT_BINARY_DIR}/lean" "-u" "${LEAN_SOURCE_DIR}/../tests/lua/single.lua")
|
2014-09-20 22:41:12 +00:00
|
|
|
add_test(lean_unknown_option bash ${LEAN_SOURCE_DIR}/cmake/check_failure.sh "${CMAKE_CURRENT_BINARY_DIR}/lean" "-z")
|
|
|
|
add_test(lean_unknown_file1 bash ${LEAN_SOURCE_DIR}/cmake/check_failure.sh "${CMAKE_CURRENT_BINARY_DIR}/lean" "boofoo.lean")
|
|
|
|
add_test(lean_unknown_file2 bash ${LEAN_SOURCE_DIR}/cmake/check_failure.sh "${CMAKE_CURRENT_BINARY_DIR}/lean" "boofoo.lua")
|
2015-01-30 00:30:07 +00:00
|
|
|
add_test(lean_server_trace ${CMAKE_CURRENT_BINARY_DIR}/lean --server-trace "${LEAN_SOURCE_DIR}/../tests/lean/interactive/consume_args.input")
|
|
|
|
add_test(lean_server_trace ${CMAKE_CURRENT_BINARY_DIR}/lean --server-trace "${LEAN_SOURCE_DIR}/../tests/lean/interactive/options_cmd.trace")
|
2015-01-30 17:45:20 +00:00
|
|
|
add_test(lean_server_trace ${CMAKE_CURRENT_BINARY_DIR}/lean --server-trace "${LEAN_SOURCE_DIR}/../tests/lean/interactive/commands.trace")
|
2015-02-02 03:49:14 +00:00
|
|
|
add_test(NAME "lean_eqn_macro"
|
|
|
|
WORKING_DIRECTORY "${LEAN_SOURCE_DIR}/../tests/lean/extra"
|
|
|
|
COMMAND bash "./test_eqn_macro.sh" "${CMAKE_CURRENT_BINARY_DIR}/lean")
|
2015-02-02 04:10:53 +00:00
|
|
|
add_test(NAME "lean_print_notation"
|
|
|
|
WORKING_DIRECTORY "${LEAN_SOURCE_DIR}/../tests/lean/extra"
|
|
|
|
COMMAND bash "./test_single.sh" "${CMAKE_CURRENT_BINARY_DIR}/lean" "print_tests.lean")
|
2013-12-09 20:17:43 +00:00
|
|
|
|
2014-06-11 20:56:11 +00:00
|
|
|
# LEAN TESTS
|
|
|
|
file(GLOB LEANTESTS "${LEAN_SOURCE_DIR}/../tests/lean/*.lean")
|
|
|
|
FOREACH(T ${LEANTESTS})
|
|
|
|
GET_FILENAME_COMPONENT(T_NAME ${T} NAME)
|
|
|
|
add_test(NAME "leantest_${T_NAME}"
|
|
|
|
WORKING_DIRECTORY "${LEAN_SOURCE_DIR}/../tests/lean"
|
2015-01-22 00:19:46 +00:00
|
|
|
COMMAND bash "./test_single.sh" "${CMAKE_CURRENT_BINARY_DIR}/lean" ${T_NAME})
|
2014-06-11 20:56:11 +00:00
|
|
|
ENDFOREACH(T)
|
2013-11-18 23:02:12 +00:00
|
|
|
|
2014-06-12 04:07:08 +00:00
|
|
|
# LEAN RUN TESTS
|
|
|
|
file(GLOB LEANRUNTESTS "${LEAN_SOURCE_DIR}/../tests/lean/run/*.lean")
|
|
|
|
FOREACH(T ${LEANRUNTESTS})
|
|
|
|
GET_FILENAME_COMPONENT(T_NAME ${T} NAME)
|
|
|
|
add_test(NAME "leanruntest_${T_NAME}"
|
|
|
|
WORKING_DIRECTORY "${LEAN_SOURCE_DIR}/../tests/lean/run"
|
2015-01-22 00:19:46 +00:00
|
|
|
COMMAND bash "./test_single.sh" "${CMAKE_CURRENT_BINARY_DIR}/lean" ${T_NAME})
|
|
|
|
ENDFOREACH(T)
|
|
|
|
|
|
|
|
# LEAN TESTS using --trust=0
|
|
|
|
file(GLOB LEANT0TESTS "${LEAN_SOURCE_DIR}/../tests/lean/trust0/*.lean")
|
|
|
|
FOREACH(T ${LEANT0TESTS})
|
|
|
|
GET_FILENAME_COMPONENT(T_NAME ${T} NAME)
|
|
|
|
add_test(NAME "leant0test_${T_NAME}"
|
|
|
|
WORKING_DIRECTORY "${LEAN_SOURCE_DIR}/../tests/lean/trust0"
|
|
|
|
COMMAND bash "./test_single.sh" "${CMAKE_CURRENT_BINARY_DIR}/lean -t 0" ${T_NAME})
|
2014-06-12 04:07:08 +00:00
|
|
|
ENDFOREACH(T)
|
|
|
|
|
2014-12-08 02:17:15 +00:00
|
|
|
# LEAN RUN HoTT TESTS
|
|
|
|
file(GLOB LEANRUNHTESTS "${LEAN_SOURCE_DIR}/../tests/lean/hott/*.hlean")
|
|
|
|
FOREACH(T ${LEANRUNHTESTS})
|
|
|
|
GET_FILENAME_COMPONENT(T_NAME ${T} NAME)
|
|
|
|
add_test(NAME "leanhotttest_${T_NAME}"
|
|
|
|
WORKING_DIRECTORY "${LEAN_SOURCE_DIR}/../tests/lean/hott"
|
2015-01-22 00:19:46 +00:00
|
|
|
COMMAND bash "./test_single.sh" "${CMAKE_CURRENT_BINARY_DIR}/lean" ${T_NAME})
|
2014-12-08 02:17:15 +00:00
|
|
|
ENDFOREACH(T)
|
|
|
|
|
2014-09-04 19:42:19 +00:00
|
|
|
if("${MULTI_THREAD}" MATCHES "ON")
|
2014-06-14 17:38:42 +00:00
|
|
|
# LEAN INTERACTIVE TESTS
|
|
|
|
file(GLOB LEANITTESTS "${LEAN_SOURCE_DIR}/../tests/lean/interactive/*.input")
|
|
|
|
FOREACH(T ${LEANITTESTS})
|
|
|
|
GET_FILENAME_COMPONENT(T_NAME ${T} NAME)
|
|
|
|
add_test(NAME "leanittest_${T_NAME}"
|
|
|
|
WORKING_DIRECTORY "${LEAN_SOURCE_DIR}/../tests/lean/interactive"
|
2015-01-22 00:19:46 +00:00
|
|
|
COMMAND bash "./test_single.sh" "${CMAKE_CURRENT_BINARY_DIR}/lean" ${T_NAME})
|
2014-06-14 17:38:42 +00:00
|
|
|
ENDFOREACH(T)
|
2014-09-04 19:42:19 +00:00
|
|
|
endif()
|
2014-06-14 17:38:42 +00:00
|
|
|
|
2014-07-26 17:53:44 +00:00
|
|
|
# LEAN SLOW TESTS
|
|
|
|
file(GLOB LEANSLOWTESTS "${LEAN_SOURCE_DIR}/../tests/lean/slow/*.lean")
|
|
|
|
FOREACH(T ${LEANSLOWTESTS})
|
|
|
|
GET_FILENAME_COMPONENT(T_NAME ${T} NAME)
|
|
|
|
add_test(NAME "leanslowtest_${T_NAME}"
|
|
|
|
WORKING_DIRECTORY "${LEAN_SOURCE_DIR}/../tests/lean/slow"
|
2015-01-22 00:19:46 +00:00
|
|
|
COMMAND bash "./test_single.sh" "${CMAKE_CURRENT_BINARY_DIR}/lean" ${T_NAME})
|
2014-07-26 17:53:44 +00:00
|
|
|
set_tests_properties("leanslowtest_${T_NAME}" PROPERTIES LABELS "expensive")
|
|
|
|
ENDFOREACH(T)
|
2013-11-20 00:47:47 +00:00
|
|
|
|
2014-04-29 17:36:57 +00:00
|
|
|
# LEAN LUA TESTS
|
|
|
|
file(GLOB LEANLUATESTS "${LEAN_SOURCE_DIR}/../tests/lua/*.lua")
|
|
|
|
FOREACH(T ${LEANLUATESTS})
|
|
|
|
GET_FILENAME_COMPONENT(T_NAME ${T} NAME)
|
|
|
|
add_test(NAME "leanluatest_${T_NAME}"
|
|
|
|
WORKING_DIRECTORY "${LEAN_SOURCE_DIR}/../tests/lua"
|
2015-01-22 00:19:46 +00:00
|
|
|
COMMAND bash "./test_single.sh" "${CMAKE_CURRENT_BINARY_DIR}/lean" ${T_NAME})
|
2014-04-29 17:36:57 +00:00
|
|
|
ENDFOREACH(T)
|
2013-11-20 00:47:47 +00:00
|
|
|
|
2014-05-28 00:47:53 +00:00
|
|
|
# LEAN LUA SLOW TESTS
|
|
|
|
file(GLOB LEANLUASLOWTESTS "${LEAN_SOURCE_DIR}/../tests/lua/slow/*.lua")
|
|
|
|
FOREACH(T ${LEANLUASLOWTESTS})
|
|
|
|
GET_FILENAME_COMPONENT(T_NAME ${T} NAME)
|
|
|
|
add_test(NAME "leanluaslowtest_${T_NAME}"
|
|
|
|
WORKING_DIRECTORY "${LEAN_SOURCE_DIR}/../tests/lua/slow"
|
2015-01-22 00:19:46 +00:00
|
|
|
COMMAND bash "../test_single.sh" "${CMAKE_CURRENT_BINARY_DIR}/lean" ${T_NAME})
|
2014-05-28 00:47:53 +00:00
|
|
|
set_tests_properties("leanluaslowtest_${T_NAME}" PROPERTIES LABELS "expensive")
|
|
|
|
ENDFOREACH(T)
|
|
|
|
|
2014-07-28 19:06:11 +00:00
|
|
|
# LEAN DOCS
|
|
|
|
file(GLOB LEANDOCS "${LEAN_SOURCE_DIR}/../doc/lean/*.org")
|
|
|
|
FOREACH(T ${LEANDOCS})
|
|
|
|
GET_FILENAME_COMPONENT(T_NAME ${T} NAME)
|
|
|
|
add_test(NAME "leandoc_${T_NAME}"
|
|
|
|
WORKING_DIRECTORY "${LEAN_SOURCE_DIR}/../doc/lean"
|
2014-09-20 22:41:12 +00:00
|
|
|
COMMAND bash "./test_single.sh" "${CMAKE_CURRENT_BINARY_DIR}/lean" ${T})
|
2014-07-28 19:06:11 +00:00
|
|
|
ENDFOREACH(T)
|
2014-01-05 21:16:47 +00:00
|
|
|
|
2014-05-27 15:09:54 +00:00
|
|
|
# LEAN LUA DOCS
|
|
|
|
file(GLOB LEANLUADOCS "${LEAN_SOURCE_DIR}/../doc/lua/*.md")
|
|
|
|
FOREACH(T ${LEANLUADOCS})
|
|
|
|
GET_FILENAME_COMPONENT(T_NAME ${T} NAME)
|
|
|
|
add_test(NAME "leanluadoc_${T_NAME}"
|
|
|
|
WORKING_DIRECTORY "${LEAN_SOURCE_DIR}/../doc/lua"
|
2015-01-22 00:19:46 +00:00
|
|
|
COMMAND bash "./test_single.sh" "${CMAKE_CURRENT_BINARY_DIR}/lean" ${T})
|
2014-05-27 15:09:54 +00:00
|
|
|
ENDFOREACH(T)
|
2013-11-20 00:47:47 +00:00
|
|
|
|
2014-04-29 00:49:23 +00:00
|
|
|
# # Create the script lean.sh
|
|
|
|
# # This is used to create a soft dependency on the Lean executable
|
|
|
|
# # Some rules can only be applied if the lean executable exists,
|
|
|
|
# # but we don't want a dependency on the executable because
|
|
|
|
# # the rules would be applied whenever the executable is rebuilt.
|
|
|
|
# # These are the rules for automatically generating .olean files and
|
|
|
|
# # C++/Lean interface files.
|
|
|
|
# add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lean.sh
|
|
|
|
# COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/mk_lean_sh.sh ${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
# DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/lean)
|
|
|
|
# add_custom_target(lean_sh DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/lean.sh)
|