It is c++ lua binding (c++14)
- only header
- without rtti
- without exception
my_script.cc
#include <iostream>
#include <luacxx/binding/function.hpp>
#include <luacxx/binding/engine.hpp>
void hello()
{
std::cout << "Hello World" << std::endl;
}
int main()
{
luacxx::engine engine;
luacxx::make_function(engine, "hello", hello);
engine.bind();
engine.do_file("my_script.lua");
return 0;
}
my_script.lua
hello();
output
$ g++ -I/where/luacxx/installed/root/include -I/where/lua/installed/root/include -L/where/lua/installed/root/lib -llua my_prog.cc
$ ./a.out
Hello World
- c++ compiler with support c++11 / c++14
- toolsbox
- cmake 3.0 or highter
- boost unit test (not mandatory, to run unit test)
- lua 5.3 or highter
By default :
- unit test is builded (if there are boost unit test)
- in debug mode
Common cmake option (to add on common line) :
Option | Value | Default | Description |
---|---|---|---|
CMAKE_BUILD_TYPE | Debug or Release | Debug | Select build type |
CMAKE_INSTALL_PREFIX | path | /usr/local | Prefix installation |
DISABLE_UNITTEST | ON or OFF | OFF | Disable unittest |
run cmake :
luacxx $ mkdir build && cd build
build $ cmake ..
specify tu cmake where is lua :
luacxx $ mkdir build && cd build
build $ LUA_DIR=/lua/root/dir cmake ..
build :
build $ make
run unit test :
build $ make test
install :
build $ make install