Skip to content

Commit

Permalink
Fix compilation (#81)
Browse files Browse the repository at this point in the history
* Fix compilation

* Fork bevy for dodorare

* Delete derpecated method

* Fetch and merge bevy main
  • Loading branch information
Heezay committed Mar 15, 2022
1 parent fd5774b commit 5b4b537
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 47 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ndk-glue = "0.6.0"
[patch.crates-io]
ron = { git = "https://github.com/enfipy/ron", rev = "3b1f28075071d743469347575b34caf2043beeb9" }
winit = { git = "https://github.com/rust-windowing/winit", rev = "f93f2c158bf527ed56ab2b6f5272214f0c1d9f7d" }
bevy = { git = "https://github.com/Heezay/bevy", rev = "f368754c8d7cc8e8fbc6c913c44450d30388276e" }
bevy = { git = "https://github.com/dodorare/bevy", branch = "dodorare" }

[features]
default = []
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions crossbundle/tools/src/commands/android/rust_compile/mod.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
mod change_crate_name;
mod cmake_toolchain;
mod compile_options;
mod consts;
mod gen_tmp_lib_file;
mod rust_compiler;
mod set_linker_args;

pub use change_crate_name::*;
pub use cmake_toolchain::*;
pub use rust_compiler::*;
pub use set_linker_args::*;
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,16 @@ impl cargo::core::compiler::Executor for SharedLibraryExecutor {
.map_err(|_| anyhow::Error::msg("Failed to create build target directory"))?;

// Change crate-type from bin to cdylib
// Replace output directory with the directory we created
super::change_crate_name(
&self.build_target_dir,
cmd,
true,
CrateType::Bin.as_ref(),
CrateType::Cdylib.as_ref(),
)?;
let mut iter = new_args.iter_mut().rev().peekable();
while let Some(arg) = iter.next() {
if let Some(prev_arg) = iter.peek() {
if *prev_arg == "--crate-type" && arg == "bin" {
*arg = "cdylib".into();
} else if *prev_arg == "--out-dir" {
*arg = self.build_target_dir.clone().into();
}
}
}

// Workaround from https://github.com/rust-windowing/android-ndk-rs/issues/149:
// Rust (1.56 as of writing) still requires libgcc during linking, but this does
Expand Down Expand Up @@ -220,14 +222,17 @@ impl cargo::core::compiler::Executor for SharedLibraryExecutor {
target.name()
)));
} else if mode == cargo::core::compiler::CompileMode::Build {
let mut new_args = cmd.get_args().to_owned();

// Change crate-type from cdylib to rlib
let new_args = super::change_crate_name(
&self.build_target_dir,
cmd,
false,
CrateType::Cdylib.as_ref(),
CrateType::Rlib.as_ref(),
)?;
let mut iter = new_args.iter_mut().rev().peekable();
while let Some(arg) = iter.next() {
if let Some(prev_arg) = iter.peek() {
if *prev_arg == "--crate-type" && arg == "cdylib" {
*arg = "rlib".into();
}
}
}
let mut cmd = cmd.clone();
cmd.args_replace(&new_args);
cmd.exec_with_streaming(on_stdout_line, on_stderr_line, false)
Expand Down
4 changes: 2 additions & 2 deletions crossbundle/tools/tests/add_libs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fn add_bevy_libs() {
let sdk = AndroidSdk::from_env().unwrap();
let ndk = AndroidNdk::from_env(Some(sdk.sdk_path())).unwrap();
let build_target = AndroidTarget::Aarch64LinuxAndroid;
let profile = Profile::Debug;
let profile = Profile::Release;
let target_sdk_version = 30;
let bevy_lib_name = format!("lib{}.so", bevy_package_name.replace("-", "_"));
let app_wrapper_for_bevy = ApplicationWrapper::NdkGlue;
Expand Down Expand Up @@ -88,7 +88,7 @@ fn add_quad_libs() {
let sdk = AndroidSdk::from_env().unwrap();
let ndk = AndroidNdk::from_env(Some(sdk.sdk_path())).unwrap();
let build_target = AndroidTarget::Aarch64LinuxAndroid;
let profile = Profile::Debug;
let profile = Profile::Release;
let target_sdk_version = 30;
let quad_lib_name = format!("lib{}.so", quad_package_name.replace("-", "_"));
let app_wrapper_for_quad = ApplicationWrapper::Sokol;
Expand Down
4 changes: 2 additions & 2 deletions examples/bevy-2d/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ fn main() {
filter: "wgpu=debug,wgpu_hal=debug,bevy_render=info".to_string(),
})
.add_plugins(DefaultPlugins)
.add_startup_system(audio.system())
.add_startup_system(icon.system())
.add_startup_system(audio)
.add_startup_system(icon)
.run();
}

Expand Down
6 changes: 3 additions & 3 deletions examples/bevy-explorer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ fn main() {
})
.add_plugins(DefaultPlugins)
.insert_resource(ExplorerStateChannel::new())
.add_startup_system(explorer_startup.system())
.add_startup_system(explorer_ui.system())
.add_startup_system(explorer_startup)
.add_startup_system(explorer_ui)
.add_stage_after(
CoreStage::Update,
"my_stage",
SystemStage::parallel()
.with_run_criteria(FixedTimestep::steps_per_second(1.0))
.with_system(explorer_text_updater.system()),
.with_system(explorer_text_updater),
)
.run();
}

0 comments on commit 5b4b537

Please sign in to comment.