diff options
author | Boris Nagaev <bnagaev@gmail.com> | 2014-08-22 13:01:48 (GMT) |
---|---|---|
committer | Boris Nagaev <bnagaev@gmail.com> | 2014-08-22 15:39:21 (GMT) |
commit | 950ef6f85409d1f1bb00d33fb972e5c277cf5836 (patch) | |
tree | a790a00b0059d43e506af796e4b9c80e0c79986a | |
parent | 22612efbdbdf88bfdf78270d1d97a27f8c111658 (diff) | |
download | mxe-950ef6f85409d1f1bb00d33fb972e5c277cf5836.zip mxe-950ef6f85409d1f1bb00d33fb972e5c277cf5836.tar.gz mxe-950ef6f85409d1f1bb00d33fb972e5c277cf5836.tar.bz2 |
add luabind-test.cpp
all programs using luabind should define LUA_COMPAT_ALL
-rw-r--r-- | src/luabind-test.cpp | 29 | ||||
-rw-r--r-- | src/luabind.mk | 6 |
2 files changed, 35 insertions, 0 deletions
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 <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()"); +} 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 = |