Hi all,

> >> What's the easiest way to compile one xform plugin as C++11 while
> >> leaving everything else alone?

Thanks for your help with this!

> > I think you need to modify the cxxflags and linkflags of just your
> > targets. There is something on how to do this manually at
> > src/lib/xmmstypes/wscript, where -DXMMSV_USE_INT64=1 is added to
> > cflags.

Unfortunately I couldn't figure this out.  I don't know waf well enough
to get it into the cxxflags instead of the cflags, when there seems to
be other options like cxxshlib vs cshlib, etc, etc.

> An alternative I wouldn't mind is adding C++11 to global C++ flags, as
> it's kind of old nowadays and fix whatever breaks. We have some
> agreement of enabling C11 (or was it C99?) server side at least too,
> so it would be kind of aligned with that as well.

I was globally enabling C++11 while I was working on my C++11 plugin
and nothing breaks, so I guess that's a decision about whether you want
to introduce the C++11 "dependency" when it is currently not needed.

In the end I got it to work by modifying plugin.py and adding a new
tool type called "cxx11" and then hacking it in that way, like this:

diff --git a/waftools/plugin.py b/waftools/plugin.py
index 54f987a..1238ff3 100644
--- a/waftools/plugin.py
+++ b/waftools/plugin.py
@@ -21,9 +21,16 @@ def plugin(name, source=None, configure=False, build=False,
             conf.env.XMMS_OUTPUT_PLUGINS.append((output_prio, name))
 
     def stock_build(bld):
+        nonlocal tool
         pat = tool=='c' and '*.c' or '*.cpp'
+        if tool=='cxx11':
+            tool = 'cxx'
+            cxxflags = '-std=c++11'
+        else:
+            cxxflags = ''
         obj = bld(
             features = '%(tool)s visibilityhidden' % dict(tool=tool),
+            cxxflags = cxxflags,
             target = 'xmms_%s' % name,
             source = copy(source) or bld.path.ant_glob(pat),
             includes = '../../.. ../../include',

Is this type of change something that you'd consider merging into the
main code?  I'm guessing you might want to approach it differently, but
adding a new tool type like this at least means the plugin's wscript
doesn't have to change to make use of C++11, only the tool string has
to be altered.

Thanks,
Adam.

--
_______________________________________________
Xmms2-devel mailing list
Xmms2-devel@lists.xmms2.org
https://lists.xmms2.org/cgi-bin/mailman/listinfo/xmms2-devel

Reply via email to