Skip to content

Commit 162faeb

Browse files
committed
feat: add sqlite3 library
this somehow works in the sim
1 parent 5b12c92 commit 162faeb

File tree

5 files changed

+20
-7
lines changed

5 files changed

+20
-7
lines changed

Sources/Code/WASM/navdata_updater/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ strip = true
1717
msfs = { git = "https://github.com/pepperoni505/msfs-rs.git", branch = "main" }
1818
serde = "1.0.190"
1919
serde_json = "1.0.108"
20+
rusqlite = { git = "https://github.com/rusqlite/rusqlite", rev = "d7ac6a1", features = ["bundled", "wasm32-wasi-vfs"] }
21+
zip = { version = "0.6.4", default-features = false, features = ["deflate"] }
2022

21-
[dependencies.zip]
22-
default-features = false
23-
features = ["deflate"]
24-
version = "0.6.4"
23+
[patch.crates-io]
24+
libsqlite3-sys = { git = "https://github.com/pepperoni505/rusqlite", branch = "master" }
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
run `rustup toolchain install 1.65`, `rustup target add wasm32-wasi`
22

3-
building: `cargo build --release; .\copy.bat`
3+
building: `.\build.bat`
44

5-
you need clang v15 to compile this properly. you MUST build with the release flag or the sim crashes
5+
you need clang v15 to compile this properly. you MUST build with the release flag or the sim crashes
6+
you need wasi sdk v19 and set a WASI_SDK environment variable to its install location
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@echo off
2+
3+
set "CLANG_LIB_WASI=%WASI_SDK%\\lib\\clang\\15.0.7\\lib\\wasi"
4+
set "WASI_SYSROOT=%WASI_SDK%\\share\\wasi-sysroot"
5+
set "CC=%WASI_SDK%\\bin\\clang --sysroot=%WASI_SYSROOT%"
6+
set "AR=%WASI_SDK%\\bin\\llvm-ar"
7+
set "CC_wasm32_wasi=%WASI_SDK%\\bin\\clang"
8+
set "LIBSQLITE3_FLAGS=-DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_SHARED_CACHE -D_LARGEFILE64_SOURCE"
9+
set "RUSTFLAGS=-Clink-arg=--export-table -Clink-arg=--export=malloc -Clink-arg=--export=free -Clink-arg=-L%CLANG_LIB_WASI% -Clink-arg=-lclang_rt.builtins-wasm32"
10+
11+
12+
cargo build --release
13+
copy "target\wasm32-wasi\release\navdata_updater.wasm" "..\..\..\..\PackageSources\SimObjects\Airplanes\Navigraph_Navdata_Updater_Aircraft\panel\navdata_updater.wasm"

Sources/Code/WASM/navdata_updater/copy.bat

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)