Files
android-activity/android-activity/build.rs
T
Robert Bragg 3de1433f82 native-activity: complete (first-pass) port of C code to Rust
At this point the C code has been fully ported to Rust but it's not yet
well integrated with the pre-existing Rust code and the port is not yet
particularly idiomatic Rust code.
2022-10-08 14:39:21 +01:00

34 lines
1.1 KiB
Rust

#![allow(dead_code)]
fn build_glue_for_game_activity() {
cc::Build::new()
.cpp(true)
.include("game-activity-csrc")
.file("game-activity-csrc/game-activity/GameActivity.cpp")
.extra_warnings(false)
.cpp_link_stdlib("c++_static")
.compile("libgame_activity.a");
cc::Build::new()
.cpp(true)
.include("game-activity-csrc")
.file("game-activity-csrc/game-text-input/gametextinput.cpp")
.cpp_link_stdlib("c++_static")
.compile("libgame_text_input.a");
cc::Build::new()
.include("game-activity-csrc")
.include("game-activity-csrc/game-activity/native_app_glue")
.file("game-activity-csrc/game-activity/native_app_glue/android_native_app_glue.c")
.extra_warnings(false)
.cpp_link_stdlib("c++_static")
.compile("libnative_app_glue.a");
// We need to link to both c++_static and c++abi for the static C++ library.
// Ideally we'd link directly to libc++.a.
println!("cargo:rustc-link-lib=c++abi");
}
fn main() {
#[cfg(feature = "game-activity")]
build_glue_for_game_activity();
}