summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@iki.fi>2015-09-28 01:13:34 +0300
committerTomi Valkeinen <tomi.valkeinen@iki.fi>2015-09-28 01:13:34 +0300
commit009828beac9bfe9c36d336a4de0d297f90aece52 (patch)
tree3ea6b22f2036dcc0c23c459ce53bfc2ad282e3e7 /lua
Initial version
Diffstat (limited to 'lua')
-rw-r--r--lua/CMakeLists.txt20
-rw-r--r--lua/luakms.i20
-rwxr-xr-xlua/test.lua21
3 files changed, 61 insertions, 0 deletions
diff --git a/lua/CMakeLists.txt b/lua/CMakeLists.txt
new file mode 100644
index 0000000..ba70561
--- /dev/null
+++ b/lua/CMakeLists.txt
@@ -0,0 +1,20 @@
+set(SWIG_EXECUTABLE "swig3.0")
+find_package(SWIG 3.0 REQUIRED)
+include(${SWIG_USE_FILE})
+
+include_directories(${LIBDRM_INCLUDE_DIRS})
+link_directories(${LIBDRM_LIBRARY_DIRS})
+
+pkg_search_module(LUA REQUIRED lua5.2 lua)
+include_directories(${LUA_INCLUDE_DIRS})
+link_directories(${LUA_LIBRARY_DIRS})
+
+#include_directories(libkms)
+#XXX
+include_directories(../libkms++)
+
+set_source_files_properties(luakms.i PROPERTIES CPLUSPLUS ON)
+swig_add_module(luakms lua luakms.i)
+swig_link_libraries(luakms kms++ ${LIBDRM_LIBRARIES} ${LUA_LIBRARIES})
+
+add_custom_target(luaextras SOURCES test.lua)
diff --git a/lua/luakms.i b/lua/luakms.i
new file mode 100644
index 0000000..60931f1
--- /dev/null
+++ b/lua/luakms.i
@@ -0,0 +1,20 @@
+%module libluakms
+%{
+#include "kms++.h"
+#include "utils/testpat.h"
+using namespace kms;
+%}
+
+%include "stdint.i"
+
+%include "decls.h"
+%include "drmobject.h"
+%include "atomicreq.h"
+%include "crtc.h"
+%include "card.h"
+%include "property.h"
+%include "framebuffer.h"
+%include "plane.h"
+%include "connector.h"
+%include "encoder.h"
+%include "utils/testpat.h"
diff --git a/lua/test.lua b/lua/test.lua
new file mode 100755
index 0000000..bc6c4fc
--- /dev/null
+++ b/lua/test.lua
@@ -0,0 +1,21 @@
+#!/usr/bin/lua
+
+require("libluakms")
+require("bit32")
+
+card = libluakms.Card()
+card:print_short()
+
+conn = card:get_first_connected_connector()
+
+mode = conn:get_default_mode()
+
+fb = libluakms.Framebuffer(card, mode.hdisplay, mode.vdisplay, "XR24");
+libluakms.draw_test_pattern(fb);
+
+crtc = conn:get_current_crtc()
+
+crtc:set_mode(conn, fb, mode)
+
+print("Press enter to exit")
+io.read()