chore(builtin): cleanup cmake file

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2013-12-28 22:27:36 -08:00
parent 66178ae65a
commit a05c815d31

View file

@ -1,26 +1,35 @@
# This directory contains Lean builtin libraries and Lua scripts
# needed to run Lean. The builtin Lean libraries are compiled
# using ${LEAN_BINARY_DIR}/shell/lean
# The library builtin is not a real library.
# It is just a hack to force CMake to consider our custom targets
add_library(builtin builtin.cpp) add_library(builtin builtin.cpp)
file(GLOB LEANLIB "${LEAN_SOURCE_DIR}/builtin/*.lean") # We copy files to the shell directory, to make sure we can test lean
# without installing it.
set(SHELL_DIR ${LEAN_BINARY_DIR}/shell)
file(GLOB LEANLIB "*.lean")
FOREACH(FILE ${LEANLIB}) FOREACH(FILE ${LEANLIB})
get_filename_component(BASENAME ${FILE} NAME_WE) get_filename_component(BASENAME ${FILE} NAME_WE)
set(FNAME "${BASENAME}.olean") set(FNAME "${BASENAME}.olean")
add_custom_command(OUTPUT ${LEAN_BINARY_DIR}/builtin/${FNAME} add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${FNAME}
COMMAND ${LEAN_BINARY_DIR}/shell/lean -o ${LEAN_BINARY_DIR}/builtin/${FNAME} ${FILE} COMMAND ${SHELL_DIR}/lean -o ${CMAKE_CURRENT_BINARY_DIR}/${FNAME} ${FILE}
COMMAND ${CMAKE_COMMAND} -E copy ${LEAN_BINARY_DIR}/builtin/${FNAME} ${LEAN_BINARY_DIR}/shell/${FNAME} COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${FNAME} ${SHELL_DIR}/${FNAME}
DEPENDS ${FILE} ${LEAN_BINARY_DIR}/shell/lean) DEPENDS ${FILE} ${SHELL_DIR}/lean)
add_custom_target(${FNAME}_builtin DEPENDS ${LEAN_BINARY_DIR}/builtin/${FNAME}) add_custom_target(${FNAME}_builtin DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${FNAME})
add_dependencies(builtin ${FNAME}_builtin) add_dependencies(builtin ${FNAME}_builtin)
install(FILES ${LEAN_BINARY_DIR}/builtin/${FNAME} DESTINATION library) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${FNAME} DESTINATION library)
ENDFOREACH(FILE) ENDFOREACH(FILE)
file(GLOB LEANLIB "${LEAN_SOURCE_DIR}/builtin/*.lua") file(GLOB LEANLIB "*.lua")
FOREACH(FILE ${LEANLIB}) FOREACH(FILE ${LEANLIB})
get_filename_component(FNAME ${FILE} NAME) get_filename_component(FNAME ${FILE} NAME)
add_custom_command(OUTPUT ${LEAN_BINARY_DIR}/builtin/${FNAME} add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${FNAME}
COMMAND ${CMAKE_COMMAND} -E copy ${FILE} ${LEAN_BINARY_DIR}/builtin/${FNAME} COMMAND ${CMAKE_COMMAND} -E copy ${FILE} ${CMAKE_CURRENT_BINARY_DIR}/${FNAME}
COMMAND ${CMAKE_COMMAND} -E copy ${FILE} ${LEAN_BINARY_DIR}/shell/${FNAME} COMMAND ${CMAKE_COMMAND} -E copy ${FILE} ${SHELL_DIR}/${FNAME}
DEPENDS ${FILE}) DEPENDS ${FILE})
add_custom_target("${FNAME}_builtin" DEPENDS ${LEAN_BINARY_DIR}/builtin/${FNAME}) add_custom_target("${FNAME}_builtin" DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${FNAME})
add_dependencies(builtin "${FNAME}_builtin") add_dependencies(builtin "${FNAME}_builtin")
install(FILES ${LEAN_BINARY_DIR}/builtin/${FNAME} DESTINATION library) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${FNAME} DESTINATION library)
ENDFOREACH(FILE) ENDFOREACH(FILE)