diff --git a/CMakeLists.txt b/CMakeLists.txt index 5034bcf3..1a0eed8a 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 e0d74d38..515412af 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)