From 46aa0b55acad7b30d434c96711bf87d7cd709a30 Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Wed, 25 Jun 2008 12:46:53 +0200 Subject: [PATCH] cmake: compile lua libs --- CMakeLists.txt | 20 +++++++++++++++++++- awesomeConfig.cmake | 1 + 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5034bcf3e..1a0eed8ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -289,6 +289,24 @@ if(GENERATE_LUADOC) endif() # }}} +# {{{ compile Lua libs +if(LUAC_EXECUTABLE) + foreach(luafile ${AWE_LUA_FILES}) + string(REGEX REPLACE ".lua\$" ".luac" luacfile ${luafile}) + string(REPLACE ${SOURCE_DIR} ${BUILD_DIR} luacfile ${luacfile}) + + add_custom_command( + COMMAND ${LUAC_EXECUTABLE} -o ${luacfile} ${luafile} + OUTPUT ${luacfile} + DEPENDS ${luafile}) + + set(AWE_LUAC_FILES ${AWE_LUAC_FILES} ${luacfile}) + endforeach() + + add_custom_target(compile_lua ALL DEPENDS ${AWE_LUAC_FILES}) +endif() +# }}} + # {{{ dist tarball if(BUILD_FROM_GIT) add_custom_target(dist @@ -299,7 +317,7 @@ endif() # {{{ Installation. install(TARGETS ${PROJECT_AWE_NAME} ${PROJECT_AWECLIENT_NAME} RUNTIME DESTINATION bin) -install(FILES ${AWE_LUA_FILES} DESTINATION ${AWESOME_LUA_LIB_PATH}) +install(FILES ${AWE_LUA_FILES} ${AWE_LUAC_FILES} DESTINATION ${AWESOME_LUA_LIB_PATH}) install(FILES ${AWE_CONF_FILES} DESTINATION ${AWESOME_CONF_PATH}) if(GENERATE_MANPAGES) install(FILES ${AWE_MAN1_FILES} DESTINATION ${AWESOME_MAN_PATH}/man1) diff --git a/awesomeConfig.cmake b/awesomeConfig.cmake index e0d74d388..515412aff 100644 --- a/awesomeConfig.cmake +++ b/awesomeConfig.cmake @@ -35,6 +35,7 @@ find_program(GREP_EXECUTABLE grep) find_program(GIT_EXECUTABLE git) find_program(HOSTNAME_EXECUTABLE hostname) find_program(GPERF_EXECUTABLE gperf) +find_program(LUAC_EXECUTABLE luac) # programs needed for man pages find_program(ASCIIDOC_EXECUTABLE asciidoc) find_program(XMLTO_EXECUTABLE xmlto)