|
1 | 1 | const std = @import("std"); |
| 2 | +const builtin = @import("builtin"); |
2 | 3 | const androidbuild = @import("androidbuild.zig"); |
3 | 4 | const Sdk = @import("tools.zig"); |
4 | 5 | const BuiltinOptionsUpdate = @import("builtin_options_update.zig"); |
@@ -394,7 +395,11 @@ fn doInstallApk(apk: *Apk) std.mem.Allocator.Error!*Step.InstallFile { |
394 | 395 | }); |
395 | 396 | aapt2packagename.setName(runNameContext("aapt2 dump packagename")); |
396 | 397 | aapt2packagename.addFileArg(resources_apk); |
397 | | - break :blk aapt2packagename.captureStdOut(); |
| 398 | + const aapt2_package_name_file = if (builtin.zig_version.major == 0 and builtin.zig_version.minor <= 15) |
| 399 | + aapt2packagename.captureStdOut() |
| 400 | + else |
| 401 | + aapt2packagename.captureStdOut(.{}); |
| 402 | + break :blk aapt2_package_name_file; |
398 | 403 | }; |
399 | 404 |
|
400 | 405 | const android_builtin = blk: { |
@@ -770,7 +775,7 @@ fn updateLinkObjects(apk: *Apk, root_artifact: *Step.Compile, so_dir: []const u8 |
770 | 775 | // Update libraries linked to this library |
771 | 776 | apk.updateLinkObjects(artifact, so_dir, raw_top_level_apk_files); |
772 | 777 |
|
773 | | - // Apply workaround for Zig 0.14.0 |
| 778 | + // Apply workaround for Zig 0.14.0 and Zig 0.15.X |
774 | 779 | apk.applyLibLinkCppWorkaroundIssue19(artifact); |
775 | 780 | }, |
776 | 781 | else => continue, |
@@ -806,6 +811,11 @@ fn applyLibLinkCppWorkaroundIssue19(apk: *Apk, artifact: *Step.Compile) void { |
806 | 811 |
|
807 | 812 | artifact.root_module.addLibraryPath(libcppabi_dir); |
808 | 813 |
|
| 814 | + // NOTE(jae): 2025-11-18 |
| 815 | + // Due to Android include files not being provided by Zig, we should provide them if the library is linking against C++ |
| 816 | + // 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> |
| 817 | + artifact.addIncludePath(.{ .cwd_relative = b.fmt("{s}/usr/include/c++/v1", .{apk.ndk.sysroot_path}) }); |
| 818 | + |
809 | 819 | if (artifact.root_module.link_libcpp == true) { |
810 | 820 | // NOTE(jae): 2025-04-06 |
811 | 821 | // Don't explicitly linkLibCpp |
|
0 commit comments