summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2019-04-28 10:56:41 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2019-04-28 10:56:41 +0200
commit27e0efba01e390b2008e1c43fe9aa398bcfa99db (patch)
tree0e164b4acc30157611b042a1151d678144e15f1a
parentfb8588d8a0013b8da78b796f84ddcccf2bc9238e (diff)
Set LV2 UIClass based on operating system (aka. support mac and windows UIs as well as X11 UIs).
-rw-r--r--ttlgen.cc19
1 files changed, 18 insertions, 1 deletions
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\