add luabind-test.cpp

all programs using luabind should define LUA_COMPAT_ALL
This commit is contained in:
Boris Nagaev 2014-08-22 17:01:48 +04:00
parent 22612efbdb
commit 950ef6f854
2 changed files with 35 additions and 0 deletions

29
src/luabind-test.cpp Normal file
View File

@ -0,0 +1,29 @@
#include <iostream>
#include <luabind/luabind.hpp>
#include <lua.hpp>
void greet()
{
std::cout << "hello world!\n";
}
extern "C" int init(lua_State* L)
{
using namespace luabind;
open(L);
module(L)
[
def("greet", &greet)
];
return 0;
}
int main()
{
lua_State* L = luaL_newstate();
init(L);
luaL_dostring(L, "greet()");
}

View File

@ -23,6 +23,12 @@ define $(PKG)_BUILD
'$(1)'
$(MAKE) -C '$(1).build' -j '$(JOBS)' VERBOSE=1 || $(MAKE) -C '$(1).build' -j 1 VERBOSE=1
$(MAKE) -C '$(1).build' -j 1 install VERBOSE=1
# all programs using luabind should define LUA_COMPAT_ALL
'$(TARGET)-g++' \
-W -Wall -DLUA_COMPAT_ALL \
'$(2).cpp' -o '$(PREFIX)/$(TARGET)/bin/test-luabind.exe' \
-llua -lluabind
endef
$(PKG)_BUILD_x86_64-w64-mingw32 =