Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(build): broken android target build caused by ndk upgrade
- Loading branch information
1 parent
548f358
commit f650a78
Showing
3 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use std::env; | ||
use std::fs; | ||
use std::io::{Error, Write}; | ||
use std::path; | ||
|
||
// Workaround from https://github.com/rust-lang/rust/pull/85806#issuecomment-1096266946 | ||
pub fn setup() -> Result<(), Error> { | ||
let out_dir = env::var("OUT_DIR").expect("OUT_DIR not set"); | ||
let mut dist = path::PathBuf::from(&out_dir); | ||
dist.push("libgcc.a"); | ||
let mut libgcc = fs::File::create(&dist)?; | ||
libgcc.write(b"INPUT(-lunwind)")?; | ||
drop(libgcc); | ||
println!("cargo:rustc-link-search={}", &out_dir); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
mod android; | ||
mod macos; | ||
|
||
pub fn setup() { | ||
println!("cargo:rerun-if-env-changed=DEBUG_GENERATED_CODE"); | ||
if let Ok("macos") = std::env::var("CARGO_CFG_TARGET_OS").as_deref() { | ||
macos::setup(); | ||
match std::env::var("CARGO_CFG_TARGET_OS").as_deref() { | ||
Ok("macos") => { | ||
macos::setup(); | ||
} | ||
Ok("android") => if let Ok(_) = android::setup() {}, | ||
_ => {} | ||
} | ||
} |
f650a78
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark
noop#napi-rs
59595525
ops/sec (±1.1%
)55554627
ops/sec (±0.2%
)0.93
noop#JavaScript
914012269
ops/sec (±1.77%
)713679301
ops/sec (±0.14%
)0.78
Plus number#napi-rs
20070127
ops/sec (±1.57%
)18971890
ops/sec (±0.12%
)0.95
Plus number#JavaScript
886675346
ops/sec (±1.41%
)711238235
ops/sec (±0.12%
)0.80
Create buffer#napi-rs
340643
ops/sec (±11.51%
)399925
ops/sec (±9.13%
)1.17
Create buffer#JavaScript
1495440
ops/sec (±7.03%
)1624790
ops/sec (±5.85%
)1.09
createArray#createArrayJson
40447
ops/sec (±1.09%
)37083
ops/sec (±0.12%
)0.92
createArray#create array for loop
7357
ops/sec (±1%
)7650
ops/sec (±0.11%
)1.04
createArray#create array with serde trait
7312
ops/sec (±0.83%
)7633
ops/sec (±0.1%
)1.04
getArrayFromJs#get array from json string
15492
ops/sec (±1.72%
)16819
ops/sec (±0.13%
)1.09
getArrayFromJs#get array from serde
9804
ops/sec (±1.89%
)10325
ops/sec (±0.13%
)1.05
getArrayFromJs#get array with for loop
11809
ops/sec (±1.09%
)12291
ops/sec (±0.06%
)1.04
Get Set property#Get Set from native#u32
390264
ops/sec (±6.28%
)419381
ops/sec (±5.36%
)1.07
Get Set property#Get Set from JavaScript#u32
343061
ops/sec (±5.52%
)353885
ops/sec (±5.34%
)1.03
Get Set property#Get Set from native#string
362202
ops/sec (±5.49%
)375850
ops/sec (±5.11%
)1.04
Get Set property#Get Set from JavaScript#string
326759
ops/sec (±5.6%
)338322
ops/sec (±5.13%
)1.04
Async task#spawn task
36180
ops/sec (±3.88%
)38092
ops/sec (±1.4%
)1.05
Async task#ThreadSafeFunction
2256
ops/sec (±3.24%
)1680
ops/sec (±8.75%
)0.74
Async task#Tokio future to Promise
27806
ops/sec (±2.02%
)28358
ops/sec (±1.22%
)1.02
Query#query * 100
1867
ops/sec (±2.45%
)1921
ops/sec (±1.41%
)1.03
Query#query * 1
22646
ops/sec (±1.23%
)28177
ops/sec (±1.19%
)1.24
This comment was automatically generated by workflow using github-action-benchmark.