lua: support building as C++#2767
Conversation
|
Lua upstream doesn't support this, and we don't add features that are not available upstream. I'm also confused on why you'd even want to compile these files as c++, they're C files and can be linked with C++ trivially. |
|
@dcbaker
I actually found no working way to build lua as c++ using existing wrap. You can't just link it - you need to compile it (see links above). You can't use '-xc++' as option to compiler - even if you know how to set up compiler options only for subproject ( It is possible to redirect all C code to be compiled as C++ by overriding C compiler and C linker in native file in global [binaries] section, but then you can't use e.g. wrap for protobuf nor any other library that has real C code. P.S. |
|
No need to at me. This is annoying because the code exists, but lua itself injects -std=c99 into their makefiles. The only really feasable way to do this is to do a copy of the files from Either with a generator or a loop of sources = [...]
if get_option('build_as_cpp')
add_language('cpp', required : true)
_sources = []
foreach s : sources
_sources += fs.copyfile(s, fs@s@.cpp')
endforeach
sources = _sources
endifYou'd then just compile the |
|
Whether that is something we want to support in our wrap is a question I can't answer though, let's see if one of the other devs has an opinion. |
|
Hi @bgilbert ! |
Add option to build lua as C++.