add luadoc binary (developer tool) to dump lua bindings
authorRobin Gareus <robin@gareus.org>
Sun, 20 Mar 2016 19:52:12 +0000 (20:52 +0100)
committerRobin Gareus <robin@gareus.org>
Sun, 20 Mar 2016 19:54:36 +0000 (20:54 +0100)
output is either JSON or lua-tables.
enable via  ./waf configure --luadoc ... , needs C++11

gtk2_ardour/arluadoc [new file with mode: 0755]
gtk2_ardour/luadoc.cc [new file with mode: 0644]
gtk2_ardour/main.cc
gtk2_ardour/wscript
wscript

diff --git a/gtk2_ardour/arluadoc b/gtk2_ardour/arluadoc
new file mode 100755 (executable)
index 0000000..2983cf9
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+TOP=`dirname "$0"`/..
+. $TOP/build/gtk2_ardour/ardev_common_waf.sh
+export UBUNTU_MENUPROXY=""
+
+$TOP/build/gtk2_ardour/luadoc "$@" \
+       | sed 's/__cxx11:://g;' \
+       | sed 's/std::basic_string<char, std::char_traits<char>\, std::allocator<char> >/std::string/g;' \
+       | sed 's/, std::allocator<[^>]*> //g;'
diff --git a/gtk2_ardour/luadoc.cc b/gtk2_ardour/luadoc.cc
new file mode 100644 (file)
index 0000000..794740e
--- /dev/null
@@ -0,0 +1,26 @@
+#include <stdio.h>
+#include <string.h>
+#include <iostream>
+
+#include "ardour/luabindings.h"
+#include "luainstance.h"
+
+int main (int argc, char **argv)
+{
+       luabridge::setPrintBindings (true);
+       LuaState lua;
+       lua_State* L = lua.getState ();
+#ifdef LUADOCOUT
+       printf ("doc = {\n");
+#else
+       printf ("[\n");
+#endif
+       LuaInstance::register_classes (L);
+       ARDOUR::LuaBindings::dsp (L);
+#ifdef LUADOCOUT
+       printf ("}\n");
+#else
+       printf ("{} ]\n");
+#endif
+       return 0;
+}
index 6a8347fb1d14d60252857b68778d71140bce60d5..83f849185502d108e701c5999f5ba7f7bf789285 100644 (file)
@@ -273,6 +273,8 @@ extern "C" {
 
 int ardour_main (int argc, char *argv[])
 
+#elif defined NOMAIN
+int nomain (int argc, char *argv[])
 #else
 int main (int argc, char *argv[])
 #endif
index 36223bd2cbdd0e9f0a41fc17803a178fb74da710..72e81205850c65a87b616121aeae8733ca25d30d 100644 (file)
@@ -405,6 +405,44 @@ def build(bld):
     VERSION = "%s.%s" % (bld.env['MAJOR'], bld.env['MINOR'])
     I18N_PACKAGE = 'gtk2_ardour' + bld.env['MAJOR']
 
+    # Tool to dump lua-bindings (of gtk2ardour + libs)
+    if re.search ("linux", sys.platform) != None and bld.env['LUABINDINGDOC']:
+        obj = bld (features = 'cxx c cxxprogram')
+        obj.install_path = None
+        obj.source    = list(gtk2_ardour_sources)
+        obj.target    = 'luadoc'
+        obj.includes  = ['.', '../libs']
+        obj.ldflags   = ['-no-undefined']
+        obj.use       = [
+                'libpbd',
+                'libardour',
+                'libardour_cp',
+                'libtimecode',
+                'libmidipp',
+                'libgtkmm2ext',
+                'libcanvas',
+                'libptformat',
+                ]
+        obj.defines = [
+                'NOMAIN',
+                'PACKAGE="' + I18N_PACKAGE + '"',
+                'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
+                'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
+                'LOCALEDIR="' + os.path.normpath(bld.env['LOCALEDIR']) + '"',
+                ]
+        obj.linkflags = ''
+        obj.uselib    = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG CURL DL GTKMM CANVAS FFTW3F LO TAGLIB XML '
+        obj.source += [ 'luadoc.cc', 'bundle_env_linux.cc' ]
+        if bld.is_defined('HAVE_SUIL'):
+            obj.source += [ 'lv2_plugin_ui.cc' ]
+            obj.use += [ 'SUIL' ]
+        if bld.is_defined('LXVST_SUPPORT'):
+            obj.source += [ 'vst_plugin_ui.cc' ]
+            obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
+            obj.defines += [ 'LXVST_SUPPORT' ]
+            obj.use += [ 'X11' ]
+
+
     if bld.is_defined('WINDOWS_VST_SUPPORT') and bld.env['build_target'] != 'mingw':
         # Windows VST support w/wine
         # If we require VST support we build a stub main() and the FST library
diff --git a/wscript b/wscript
index 077e924ea9ddf22884971f8f60e3de3e3a65814f..926e6feed68706413752a990e78a9480ed16b294 100644 (file)
--- a/wscript
+++ b/wscript
@@ -682,6 +682,8 @@ def options(opt):
                    help='Build internal libs as static libraries')
     opt.add_option('--use-external-libs', action='store_true', default=False, dest='use_external_libs',
                    help='Use external/system versions of some bundled libraries')
+    opt.add_option('--luadoc', action='store_true', default=False, dest='luadoc',
+                    help='Compile Tool to dump LuaBindings (needs C++11)')
     opt.add_option('--lv2', action='store_true', default=True, dest='lv2',
                     help='Compile with support for LV2 (if Lilv+Suil is available)')
     opt.add_option('--no-lv2', action='store_false', dest='lv2',
@@ -898,6 +900,10 @@ def configure(conf):
             print ('No Carbon support available for this build\n')
 
 
+    if Options.options.luadoc:
+        conf.env['LUABINDINGDOC'] = True
+        conf.define ('LUABINDINGDOC', 1)
+
     if Options.options.internal_shared_libs:
         conf.define('INTERNAL_SHARED_LIBS', 1)
 
@@ -1166,6 +1172,7 @@ const char* const ardour_config_info = "\\n\\
     write_config_text('Freedesktop files',     opts.freedesktop)
     write_config_text('Libjack linking',       conf.env['libjack_link'])
     write_config_text('Libjack metadata',      conf.is_defined ('HAVE_JACK_METADATA'))
+    write_config_text('Lua Binding Doc',       conf.is_defined('LUABINDINGDOC'))
     write_config_text('LV2 UI embedding',      conf.is_defined('HAVE_SUIL'))
     write_config_text('LV2 support',           conf.is_defined('LV2_SUPPORT'))
     write_config_text('LV2 extensions',        conf.is_defined('LV2_EXTENDED'))