tolua++ in combination with scons
August 20th, 2007
No comments
tolua is a program that can generate c/c++ interface code from simplified header files. so how to integrate this into your buildsystem?
here is a simple and elegant solution:
sconscript:
import os, glob
Import("env")
localenv = env.Copy()
localenv.Append(CPPPATH = ["#/lua-5.1.2/src"])
localenv.Append(LIBS = ["liblua", "dl","libtolua++"])
localenv.Append(LIBPATH=["#/lua-5.1.2/src"])
# find and add all .cpp files
sources = glob.glob('*.cpp')
# this builds the interface
lua_interface = 'lua_interface.cpp'
localenv.Command(lua_interface, 'lua_functions.pkg', "tolua++ -o $TARGET $SOURCE")
# depend the build on the interface file
sources.append(lua_interface)
localenv.Program("test", sources)
in this example, "lua_functions.pkg" is the simplified header file for what the code should be generated.
Categories: scons