/// Write a CMake toolchain which will remove references to the rustc build target before including
/// the NDK provided toolchain. The NDK provided android toolchain will set the target appropriately
/// Returns the path to the generated toolchain file
Write a CMake toolchain which will remove references to the rustc build target before including
the NDK provided toolchain. The NDK provided android toolchain will set the target appropriately
Returns the path to the generated toolchain file
Write a CMake toolchain which will remove references to the rustc build target before including the NDK provided toolchain . The NDK provided android toolchain will set the target appropriately Returns the path to the generated toolchain file
fn write_cmake_toolchain(
    config: &AndroidConfig,
    build_target_dir: &PathBuf,
    build_target: AndroidBuildTarget,
) -> CargoResult<PathBuf> {
    let toolchain_path = build_target_dir.join("cargo-apk.toolchain.cmake");
    let mut toolchain_file = File::create(&toolchain_path).unwrap();
    writeln!(
        toolchain_file,
        r#"set(ANDROID_PLATFORM android-{min_sdk_version})
set(ANDROID_ABI {abi})
string(REPLACE "--target={build_target}" "" CMAKE_C_FLAGS "${{CMAKE_C_FLAGS}}")
string(REPLACE "--target={build_target}" "" CMAKE_CXX_FLAGS "${{CMAKE_CXX_FLAGS}}")
unset(CMAKE_C_COMPILER CACHE)
unset(CMAKE_CXX_COMPILER CACHE)
include("{ndk_path}/build/cmake/android.toolchain.cmake")"#,
        min_sdk_version = config.min_sdk_version,
        ndk_path = config.ndk_path.to_string_lossy().replace("\\", "/"), // Use forward slashes even on windows to avoid path escaping issues.
        build_target = build_target.rust_triple(),
        abi = build_target.android_abi(),
    )?;
    Ok(toolchain_path)
}
fn write_cmake_toolchain ( config : & AndroidConfig , build_target_dir : & PathBuf , build_target : AndroidBuildTarget , ) -> CargoResult < PathBuf > { let toolchain_path = build_target_dir . join ( " " ) ; let mut toolchain_file = File :: create ( & toolchain_path ) . unwrap ( ) ; writeln ! ( toolchain_file r#"set(ANDROID_PLATFORM android-{min_sdk_version})
set(ANDROID_ABI {abi})
string(REPLACE "--target={build_target}" "" CMAKE_C_FLAGS "${{CMAKE_C_FLAGS}}")
string(REPLACE "--target={build_target}" "" CMAKE_CXX_FLAGS "${{CMAKE_CXX_FLAGS}}")
unset(CMAKE_C_COMPILER CACHE)
unset(CMAKE_CXX_COMPILER CACHE)
include("{ndk_path}/build/cmake/android.toolchain.cmake")"# min_sdk_version config min_sdk_version ndk_path config ndk_path to_string_lossy ( ) replace ( " \\ " " " ) // Use forward slashes even on windows to avoid path escaping issues. build_target build_target rust_triple ( ) abi build_target android_abi ( ) ) ? ; Ok ( toolchain_path ) }
Write a CMake toolchain which will remove references to the rustc build target before including
the NDK provided toolchain.
Write a CMake toolchain which will remove references to the rustc build target before including the NDK provided toolchain .
config
&AndroidConfig
build_target_dir
&PathBuf
build_target
AndroidBuildTarget