You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the spirit of using zig as a drop-in compiler, I bumped into the issue that some C++ code from a third-party library #includes an Objective C header. Their build system simply adds -x objective-c++ to that file, but trying to do the same from build.zig fails, because the compilation flag goes in the end, which is a no-op. The flag should go in front of the files that need to be impacted.
Currently zig solely determines the language based on the extension, with no way to override it from build.zig.
A low-effort hack might be to simply detect the "-x" string being passed to the CSourceFile.flags and instead put that flag in the front?
I read in #13544 that @motiejus worked on something related to this, and did explicitly not include supporting specifying -x <language> from build.zig, because there was doubt whether that was a good idea or not.
Zig Version
0.14.0-dev.2802
Steps to Reproduce and Observed Behavior
In the spirit of using zig as a drop-in compiler, I bumped into the issue that some C++ code from a third-party library
#include
s an Objective C header. Their build system simply adds-x objective-c++
to that file, but trying to do the same frombuild.zig
fails, because the compilation flag goes in the end, which is a no-op. The flag should go in front of the files that need to be impacted.Currently zig solely determines the language based on the extension, with no way to override it from
build.zig
.A low-effort hack might be to simply detect the
"-x"
string being passed to theCSourceFile.flags
and instead put that flag in the front?I read in #13544 that @motiejus worked on something related to this, and did explicitly not include supporting specifying
-x <language>
frombuild.zig
, because there was doubt whether that was a good idea or not.Expected Behavior
works and compiles this as Objective-C++.
The text was updated successfully, but these errors were encountered: