2013-12-18 18:54:55 -05:00
|
|
|
|
|
|
|
cmake_minimum_required (VERSION 2.6)
|
|
|
|
project (tolua++)
|
|
|
|
|
|
|
|
include_directories ("${PROJECT_SOURCE_DIR}/../../src/")
|
|
|
|
include_directories ("${PROJECT_SOURCE_DIR}/include/")
|
|
|
|
include_directories ("${PROJECT_SOURCE_DIR}/../")
|
2014-03-15 09:45:26 -04:00
|
|
|
include_directories ("${PROJECT_SOURCE_DIR}")
|
|
|
|
|
2014-03-22 11:30:49 -04:00
|
|
|
find_program(XXD_EXECUTABLE xxd)
|
|
|
|
|
|
|
|
if(NOT XXD_EXECUTABLE STREQUAL "xxd-NOTFOUND")
|
2014-03-15 09:45:26 -04:00
|
|
|
add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/src/bin/basic_lua.h
|
2014-03-22 11:30:49 -04:00
|
|
|
COMMAND ${XXD_EXECUTABLE} -i lua/basic.lua | sed 's/unsigned char/static const unsigned char/g' >basic_lua.h
|
2014-03-15 09:45:26 -04:00
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src/bin/
|
|
|
|
DEPENDS ${PROJECT_SOURCE_DIR}/src/bin/lua/basic.lua)
|
|
|
|
add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/src/bin/enumerate_lua.h
|
2014-03-22 11:30:49 -04:00
|
|
|
COMMAND ${XXD_EXECUTABLE} -i lua/enumerate.lua | sed 's/unsigned char/static const unsigned char/g' >enumerate_lua.h
|
2014-03-15 09:45:26 -04:00
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src/bin/
|
|
|
|
DEPENDS ${PROJECT_SOURCE_DIR}/src/bin/lua/enumerate.lua)
|
2014-03-15 10:15:02 -04:00
|
|
|
add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/src/bin/function_lua.h
|
2014-03-22 11:30:49 -04:00
|
|
|
COMMAND ${XXD_EXECUTABLE} -i lua/function.lua | sed 's/unsigned char/static const unsigned char/g' >function_lua.h
|
2014-03-15 09:45:26 -04:00
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src/bin/
|
|
|
|
DEPENDS ${PROJECT_SOURCE_DIR}/src/bin/lua/function.lua)
|
2014-03-19 15:38:00 -04:00
|
|
|
add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/src/bin/declaration_lua.h
|
2014-03-22 11:30:49 -04:00
|
|
|
COMMAND ${XXD_EXECUTABLE} -i lua/declaration.lua | sed 's/unsigned char/static const unsigned char/g' >declaration_lua.h
|
2014-03-19 15:38:00 -04:00
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src/bin/
|
|
|
|
DEPENDS ${PROJECT_SOURCE_DIR}/src/bin/lua/declaration.lua)
|
|
|
|
set_property(SOURCE src/bin/toluabind.c APPEND PROPERTY OBJECT_DEPENDS ${PROJECT_SOURCE_DIR}/src/bin/enumerate_lua.h ${PROJECT_SOURCE_DIR}/src/bin/basic_lua.h ${PROJECT_SOURCE_DIR}/src/bin/function_lua.h ${PROJECT_SOURCE_DIR}/src/bin/declaration_lua.h)
|
2014-03-22 11:30:49 -04:00
|
|
|
else()
|
|
|
|
message("xxd not found, changes to tolua scripts will be ignored")
|
2014-03-15 09:45:26 -04:00
|
|
|
endif()
|
|
|
|
|
2013-12-18 18:54:55 -05:00
|
|
|
|
2013-12-18 19:52:52 -05:00
|
|
|
file(GLOB LIB_SOURCE
|
|
|
|
"src/lib/*.c"
|
|
|
|
)
|
|
|
|
|
|
|
|
file(GLOB BIN_SOURCE
|
2013-12-18 18:54:55 -05:00
|
|
|
"src/bin/*.c"
|
|
|
|
)
|
|
|
|
|
2014-03-15 09:45:26 -04:00
|
|
|
|
|
|
|
|
2013-12-18 19:52:52 -05:00
|
|
|
add_executable(tolua ${BIN_SOURCE})
|
|
|
|
add_library(tolualib ${LIB_SOURCE})
|
2013-12-18 18:54:55 -05:00
|
|
|
|
|
|
|
#m is the standard math librarys
|
2013-12-19 19:22:06 -05:00
|
|
|
if(UNIX)
|
2014-02-15 18:17:58 -05:00
|
|
|
target_link_libraries(tolua m ${DYNAMIC_LOADER})
|
2013-12-19 19:22:06 -05:00
|
|
|
endif()
|
|
|
|
|
|
|
|
target_link_libraries(tolua lua tolualib)
|