summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-03-20 20:52:12 +0100
committerRobin Gareus <robin@gareus.org>2016-03-20 20:54:36 +0100
commit6972db0d554ba36d05fbd0ada5e303148cbab2bf (patch)
tree5c0ae4e5c9495fae4a77f1b43de6a192d367bea7
parent618ef9f9230a4ef497a6c0c003f26fa4fbc351fa (diff)
add luadoc binary (developer tool) to dump lua bindings
output is either JSON or lua-tables. enable via ./waf configure --luadoc ... , needs C++11
-rwxr-xr-xgtk2_ardour/arluadoc9
-rw-r--r--gtk2_ardour/luadoc.cc26
-rw-r--r--gtk2_ardour/main.cc2
-rw-r--r--gtk2_ardour/wscript38
-rw-r--r--wscript7
5 files changed, 82 insertions, 0 deletions
diff --git a/gtk2_ardour/arluadoc b/gtk2_ardour/arluadoc
new file mode 100755
index 0000000000..2983cf9103
--- /dev/null
+++ b/gtk2_ardour/arluadoc
@@ -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
index 0000000000..794740eeda
--- /dev/null
+++ b/gtk2_ardour/luadoc.cc
@@ -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;
+}
diff --git a/gtk2_ardour/main.cc b/gtk2_ardour/main.cc
index 6a8347fb1d..83f8491855 100644
--- a/gtk2_ardour/main.cc
+++ b/gtk2_ardour/main.cc
@@ -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
diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript
index 36223bd2cb..72e8120585 100644
--- a/gtk2_ardour/wscript
+++ b/gtk2_ardour/wscript
@@ -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 077e924ea9..926e6feed6 100644
--- 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'))