summaryrefslogtreecommitdiffstats
path: root/lib/tolua++/CMakeLists.txt
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-04-02 15:05:55 +0200
committerTycho <work.tycho+git@gmail.com>2014-04-02 15:05:55 +0200
commitdcaea749ae502366c23f2c04f3b42882cb71d0d6 (patch)
tree56e499098895a03bc66beac5aa33ba4ee261f17e /lib/tolua++/CMakeLists.txt
parentMerge branch 'master' into globals (diff)
parentMerge pull request #831 from mc-server/Wither (diff)
downloadcuberite-dcaea749ae502366c23f2c04f3b42882cb71d0d6.tar
cuberite-dcaea749ae502366c23f2c04f3b42882cb71d0d6.tar.gz
cuberite-dcaea749ae502366c23f2c04f3b42882cb71d0d6.tar.bz2
cuberite-dcaea749ae502366c23f2c04f3b42882cb71d0d6.tar.lz
cuberite-dcaea749ae502366c23f2c04f3b42882cb71d0d6.tar.xz
cuberite-dcaea749ae502366c23f2c04f3b42882cb71d0d6.tar.zst
cuberite-dcaea749ae502366c23f2c04f3b42882cb71d0d6.zip
Diffstat (limited to 'lib/tolua++/CMakeLists.txt')
-rw-r--r--lib/tolua++/CMakeLists.txt28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/tolua++/CMakeLists.txt b/lib/tolua++/CMakeLists.txt
index 5ec8ee822..e5c8ce3e8 100644
--- a/lib/tolua++/CMakeLists.txt
+++ b/lib/tolua++/CMakeLists.txt
@@ -5,6 +5,32 @@ project (tolua++)
include_directories ("${PROJECT_SOURCE_DIR}/../../src/")
include_directories ("${PROJECT_SOURCE_DIR}/include/")
include_directories ("${PROJECT_SOURCE_DIR}/../")
+include_directories ("${PROJECT_SOURCE_DIR}")
+
+find_program(XXD_EXECUTABLE xxd)
+
+if(NOT XXD_EXECUTABLE STREQUAL "XXD_EXECUTABLE-NOTFOUND")
+ add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/src/bin/basic_lua.h
+ COMMAND ${XXD_EXECUTABLE} -i lua/basic.lua | sed 's/unsigned char/static const unsigned char/g' >basic_lua.h
+ 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
+ COMMAND ${XXD_EXECUTABLE} -i lua/enumerate.lua | sed 's/unsigned char/static const unsigned char/g' >enumerate_lua.h
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src/bin/
+ DEPENDS ${PROJECT_SOURCE_DIR}/src/bin/lua/enumerate.lua)
+ add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/src/bin/function_lua.h
+ COMMAND ${XXD_EXECUTABLE} -i lua/function.lua | sed 's/unsigned char/static const unsigned char/g' >function_lua.h
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src/bin/
+ DEPENDS ${PROJECT_SOURCE_DIR}/src/bin/lua/function.lua)
+ add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/src/bin/declaration_lua.h
+ COMMAND ${XXD_EXECUTABLE} -i lua/declaration.lua | sed 's/unsigned char/static const unsigned char/g' >declaration_lua.h
+ 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)
+else()
+ message("xxd not found, changes to tolua scripts will be ignored")
+endif()
+
file(GLOB LIB_SOURCE
"src/lib/*.c"
@@ -14,6 +40,8 @@ file(GLOB BIN_SOURCE
"src/bin/*.c"
)
+
+
add_executable(tolua ${BIN_SOURCE})
add_library(tolualib ${LIB_SOURCE})