From 27e0efba01e390b2008e1c43fe9aa398bcfa99db Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 28 Apr 2019 10:56:41 +0200 Subject: Set LV2 UIClass based on operating system (aka. support mac and windows UIs as well as X11 UIs). --- ttlgen.cc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/ttlgen.cc b/ttlgen.cc index 77780d0..7d6bd93 100644 --- a/ttlgen.cc +++ b/ttlgen.cc @@ -69,6 +69,23 @@ static void includes(std::ostream& output) "; } +// If UIClass was not explicitly set already, try to autodetect it based on +// operating system. +#ifndef UIClass + #ifdef __linux__ + #define UIClass "X11UI" + #elif _WIN32 + #define UIClass "WindowsUI" + #elif __APPLE__ + #define UIClass "CocoaUI" + #elif __FreeBSD__ + #define UIClass "X11UI" + #elif __unix__ + // All other unices (*BSD etc) + #define UIClass "X11UI" + #endif +#endif + static void ui(Plugin& plugin, const std::string& pluginfile, std::ostream& output) { if(!plugin.hasGUI()) @@ -78,7 +95,7 @@ static void ui(Plugin& plugin, const std::string& pluginfile, std::ostream& outp output << "\ <" << plugin.getURI() << "/lv2#ui>\n\ - a ui:X11UI ;\n\ + a ui:" UIClass " ;\n \ lv2:requiredFeature ui:resize ;\n\ lv2:extensionData ui:resize ;\n\ lv2:requiredFeature ui:idleInterface ;\n\ -- cgit v1.2.3