Skip to content

Commit ffc61e3

Browse files
committed
improve C++ include support so that openxr_loader will build for Android with Zig
1 parent abeec4e commit ffc61e3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/androidbuild/apk.zig

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ fn updateLinkObjects(apk: *Apk, root_artifact: *Step.Compile, so_dir: []const u8
770770
// Update libraries linked to this library
771771
apk.updateLinkObjects(artifact, so_dir, raw_top_level_apk_files);
772772

773-
// Apply workaround for Zig 0.14.0
773+
// Apply workaround for Zig 0.14.0 and Zig 0.15.X
774774
apk.applyLibLinkCppWorkaroundIssue19(artifact);
775775
},
776776
else => continue,
@@ -806,6 +806,11 @@ fn applyLibLinkCppWorkaroundIssue19(apk: *Apk, artifact: *Step.Compile) void {
806806

807807
artifact.root_module.addLibraryPath(libcppabi_dir);
808808

809+
// NOTE(jae): 2025-11-18
810+
// Due to Android include files not being provided by Zig, we should provide them if the library is linking against C++
811+
// This resolves an issue where if you are trying to build the openxr_loader C++ code from source, it can't find standard library includes like <string> or <algorithm>
812+
artifact.addIncludePath(.{ .cwd_relative = b.fmt("{s}/usr/include/c++/v1", .{apk.ndk.sysroot_path}) });
813+
809814
if (artifact.root_module.link_libcpp == true) {
810815
// NOTE(jae): 2025-04-06
811816
// Don't explicitly linkLibCpp

0 commit comments

Comments
 (0)