@@ -28,6 +28,8 @@ api_level: APILevel,
2828ndk_version : []const u8 ,
2929/// ie. "$ANDROID_HOME/ndk/{ndk_version}/toolchains/llvm/prebuilt/{host_os_and_arch}/sysroot"
3030ndk_sysroot_path : []const u8 ,
31+ /// ie. "$ANDROID_HOME/ndk/{ndk_version}/toolchains/llvm/prebuilt/{host_os_and_arch}/sysroot/usr/include"
32+ include_path : []const u8 ,
3133/// ie. "$ANDROID_HOME/Sdk/platforms/android-{api_level}/android.jar"
3234root_jar : []const u8 ,
3335// $JDK_HOME, $JAVA_HOME or auto-discovered from java binaries found in $PATH
@@ -320,6 +322,7 @@ pub fn create(b: *std.Build, options: Options) *Tools {
320322 .api_level = options .api_level ,
321323 .ndk_version = options .ndk_version ,
322324 .ndk_sysroot_path = android_ndk_sysroot ,
325+ .include_path = b .fmt ("{s}/usr/include" , .{tools .ndk_sysroot_path }),
323326 .root_jar = root_jar ,
324327 .jdk_path = jdk_path ,
325328 .build_tools = .{
@@ -439,9 +442,7 @@ pub fn createKeyStore(tools: *const Tools, options: CreateKey) KeyStore {
439442pub fn setLibCFile (tools : * const Tools , compile : * Step.Compile ) void {
440443 const b = tools .b ;
441444
442- const target : ResolvedTarget = compile .root_module .resolved_target orelse {
443- @panic (b .fmt ("no 'target' set on Android module" , .{}));
444- };
445+ const target : ResolvedTarget = compile .root_module .resolved_target orelse @panic ("no 'target' set on Android module" );
445446 const system_target = getAndroidTriple (target ) catch | err | @panic (@errorName (err ));
446447
447448 const android_libc_path = createLibC (
@@ -455,6 +456,12 @@ pub fn setLibCFile(tools: *const Tools, compile: *Step.Compile) void {
455456 compile .setLibCFile (android_libc_path );
456457}
457458
459+ pub fn getSystemIncludePath (tools : * const Tools , target : ResolvedTarget ) []const u8 {
460+ const b = tools .b ;
461+ const system_target = getAndroidTriple (target ) catch | err | @panic (@errorName (err ));
462+ return b .fmt ("{s}/{s}" , .{ tools .include_path , system_target });
463+ }
464+
458465fn createLibC (b : * std.Build , system_target : []const u8 , android_version : APILevel , ndk_sysroot_path : []const u8 , ndk_version : []const u8 ) LazyPath {
459466 const libc_file_format =
460467 \\# Generated by zig-android-sdk. DO NOT EDIT.
0 commit comments