Skip to content

Commit

Permalink
Merge pull request #482 from markdrayton/lua-outside-source-build
Browse files Browse the repository at this point in the history
bcc-lua: build bcc.lua and bcc.o in the build tree
  • Loading branch information
4ast committed Apr 11, 2016
2 parents a377194 + 80f52c1 commit b51da5e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
14 changes: 6 additions & 8 deletions src/lua/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,19 @@ if (LUAJIT_LIBRARIES)
FILE(GLOB_RECURSE SRC_LUA ${CMAKE_CURRENT_SOURCE_DIR}/bcc/*/*.lua)

ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/src/bcc.lua
COMMAND ${LUAJIT} src/squish.lua
OUTPUT bcc.lua
COMMAND ${LUAJIT} ${CMAKE_CURRENT_SOURCE_DIR}/src/squish.lua ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${SRC_LUA} ${CMAKE_CURRENT_SOURCE_DIR}/squishy
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)

ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/src/bcc.o
COMMAND ${LUAJIT} -bg src/bcc.lua src/bcc.o
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/bcc.lua
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT bcc.o
COMMAND ${LUAJIT} -bg bcc.lua bcc.o
DEPENDS bcc.lua
)

include_directories(${LUAJIT_INCLUDE_DIR})
add_executable(bcc-lua src/main.c src/bcc.o)
add_executable(bcc-lua src/main.c bcc.o)
target_link_libraries(bcc-lua ${LUAJIT_LIBRARIES})

install(TARGETS bcc-lua RUNTIME DESTINATION bin)
Expand Down
2 changes: 1 addition & 1 deletion src/lua/squishy
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ Module "bcc.table" "bcc/table.lua"
Module "bcc.ld" "bcc/ld.lua"

Main "bcc/run.lua"
Output "src/bcc.lua"
Output "bcc.lua"

0 comments on commit b51da5e

Please sign in to comment.