13
0

add luadoc binary (developer tool) to dump lua bindings

output is either JSON or lua-tables.
enable via  ./waf configure --luadoc ... , needs C++11
This commit is contained in:
Robin Gareus 2016-03-20 20:52:12 +01:00
parent 618ef9f923
commit 6972db0d55
5 changed files with 82 additions and 0 deletions

9
gtk2_ardour/arluadoc Executable file
View File

@ -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;'

26
gtk2_ardour/luadoc.cc Normal file
View File

@ -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;
}

View 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

View 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

View File

@ -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'))