• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1find_package(LuaJIT)
2find_program(LUAJIT luajit)
3
4if (LUAJIT_LIBRARIES AND LUAJIT)
5	FILE(GLOB_RECURSE SRC_LUA
6		${CMAKE_CURRENT_SOURCE_DIR}/bcc/*.lua
7		${CMAKE_CURRENT_SOURCE_DIR}/bcc/vendor/*.lua
8		${CMAKE_CURRENT_SOURCE_DIR}/bpf/*.lua)
9
10	ADD_CUSTOM_COMMAND(
11		OUTPUT bcc.lua
12		COMMAND ${LUAJIT} ${CMAKE_CURRENT_SOURCE_DIR}/src/squish.lua ${CMAKE_CURRENT_SOURCE_DIR}
13		DEPENDS ${SRC_LUA} ${CMAKE_CURRENT_SOURCE_DIR}/squishy
14	)
15
16	ADD_CUSTOM_COMMAND(
17		OUTPUT bcc.o
18		COMMAND ${LUAJIT} -bg bcc.lua bcc.o
19		DEPENDS bcc.lua
20	)
21
22	include_directories(${LUAJIT_INCLUDE_DIR})
23	add_executable(bcc-lua src/main.c bcc.o)
24	set_target_properties(bcc-lua PROPERTIES LINKER_LANGUAGE C)
25	target_link_libraries(bcc-lua ${LUAJIT_LIBRARIES})
26	target_link_libraries(bcc-lua ${bcc-lua-static})
27	if (NOT COMPILER_NOPIE_FLAG EQUAL "")
28		target_link_libraries(bcc-lua ${COMPILER_NOPIE_FLAG})
29	endif()
30
31	install(TARGETS bcc-lua RUNTIME DESTINATION bin)
32endif()
33