summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/luabind-test.cpp29
-rw-r--r--src/luabind.mk6
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 =