lua: support building as C++ - #2767
v-for-vandal wants to merge 1 commit into
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 ! |
|
Since Lua is meant to be embedded, I'm not surprised that there are build options not supported by the build system, and I do think it's useful to support this feature. So I'm okay with something like #2767 (comment). |
f728a77 to
f14b670
Compare
f0782bd to
b4dc6d2
Compare
|
@bgilbert All done, I think ? |
Add option to build lua as C++.