From bdad5edc569d82151922c5c6c4685b1563f12aa1 Mon Sep 17 00:00:00 2001 From: max Date: Thu, 27 Nov 2025 13:23:44 +0100 Subject: [PATCH] Pass ANDROID_ABI and ANDROID_PLATFORM environment variables Uses environment variables as passed by cargo-ndk version 4.0 and later, and passes them as defines to cmake. Note the environment variable names as currently documented on are outdated, the docs have been fixed later in . fixes #226 --- src/lib.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 564d7e3..444b5c6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -507,6 +507,15 @@ impl Config { } } + // These environment variables are set by cargo-ndk when compiling for + // Android (since version 4.x). + if let Ok(abi) = env::var("ANDROID_ABI") { + self.define("ANDROID_ABI", abi); + } + if let Ok(platform) = env::var("ANDROID_PLATFORM") { + self.define("ANDROID_PLATFORM", platform); + } + let generator = self .generator .clone()