In CMake, there’s a function check_cxx_symbol_exists
that check if a function or variable exists in a file, I want to replicate that in build.zig
, is there a function for that for C/C++ files?
zig files being struct, you might be able to leverage @typeInfo for that purpose.
sorry, I mean for checking the symbols in C/C++ files, not Zig files.
I’m pretty sure the answer is no. You’ll probably have to leverage some other tool to achieve this.
I think so also, it seems like I have to look into Zig’s internal to know what flag value to set correctly when compiling C/C++ libraries.
A hacky way I can think of is using b.addTranslateC
and then inspecting the resultant output_file
somehow. Probably not the best way, though.
It doesn’t work since addTranslateC
runs after the build script is built and for addConfigHeader
, the macro values have to be defined before that.