From 950ef6f85409d1f1bb00d33fb972e5c277cf5836 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Fri, 22 Aug 2014 17:01:48 +0400 Subject: add luabind-test.cpp all programs using luabind should define LUA_COMPAT_ALL --- src/luabind-test.cpp | 29 +++++++++++++++++++++++++++++ src/luabind.mk | 6 ++++++ 2 files changed, 35 insertions(+) create mode 100644 src/luabind-test.cpp diff --git a/src/luabind-test.cpp b/src/luabind-test.cpp new file mode 100644 index 0000000..02f2638 --- /dev/null +++ b/src/luabind-test.cpp @@ -0,0 +1,29 @@ +#include +#include +#include + +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()"); +} diff --git a/src/luabind.mk b/src/luabind.mk index 2a1608a..e08fb81 100644 --- a/src/luabind.mk +++ b/src/luabind.mk @@ -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 = -- cgit v0.12