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 8b120b9
Showing
2 changed files
with
23 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
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() {}, | ||
_ => {} | ||
} | ||
} |
8b120b9
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
43903594
ops/sec (±0.55%
)55554627
ops/sec (±0.2%
)1.27
noop#JavaScript
566127223
ops/sec (±0.15%
)713679301
ops/sec (±0.14%
)1.26
Plus number#napi-rs
15074819
ops/sec (±0.54%
)18971890
ops/sec (±0.12%
)1.26
Plus number#JavaScript
563872270
ops/sec (±0.17%
)711238235
ops/sec (±0.12%
)1.26
Create buffer#napi-rs
320791
ops/sec (±10.6%
)399925
ops/sec (±9.13%
)1.25
Create buffer#JavaScript
1343453
ops/sec (±7.55%
)1624790
ops/sec (±5.85%
)1.21
createArray#createArrayJson
29465
ops/sec (±0.71%
)37083
ops/sec (±0.12%
)1.26
createArray#create array for loop
6090
ops/sec (±0.33%
)7650
ops/sec (±0.11%
)1.26
createArray#create array with serde trait
6087
ops/sec (±0.14%
)7633
ops/sec (±0.1%
)1.25
getArrayFromJs#get array from json string
13740
ops/sec (±0.4%
)16819
ops/sec (±0.13%
)1.22
getArrayFromJs#get array from serde
8303
ops/sec (±0.03%
)10325
ops/sec (±0.13%
)1.24
getArrayFromJs#get array with for loop
9217
ops/sec (±0.68%
)12291
ops/sec (±0.06%
)1.33
Get Set property#Get Set from native#u32
348967
ops/sec (±5.68%
)419381
ops/sec (±5.36%
)1.20
Get Set property#Get Set from JavaScript#u32
309980
ops/sec (±5.31%
)353885
ops/sec (±5.34%
)1.14
Get Set property#Get Set from native#string
324729
ops/sec (±5.4%
)375850
ops/sec (±5.11%
)1.16
Get Set property#Get Set from JavaScript#string
291033
ops/sec (±5.57%
)338322
ops/sec (±5.13%
)1.16
Async task#spawn task
27021
ops/sec (±2.46%
)38092
ops/sec (±1.4%
)1.41
Async task#ThreadSafeFunction
1519
ops/sec (±19.57%
)1680
ops/sec (±8.75%
)1.11
Async task#Tokio future to Promise
20818
ops/sec (±2.71%
)28358
ops/sec (±1.22%
)1.36
Query#query * 100
1423
ops/sec (±3.33%
)1921
ops/sec (±1.41%
)1.35
Query#query * 1
22069
ops/sec (±1.81%
)28177
ops/sec (±1.19%
)1.28
This comment was automatically generated by workflow using github-action-benchmark.