Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commiteef17e8

Browse files
committed
Support emscripten (wasm)
1 parentf3dc037 commiteef17e8

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

‎.github/workflows/main.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ jobs:
2828
os:macos-latest
2929
-target:x86_64-pc-windows-msvc
3030
os:windows-latest
31+
-target:wasm32-unknown-emscripten
32+
os:ubuntu-latest
3133
steps:
3234
-uses:actions/checkout@v3
3335
-uses:dtolnay/rust-toolchain@stable
@@ -51,6 +53,12 @@ jobs:
5153
sudo apt-get update -y
5254
sudo apt-get install -y --no-install-recommends gcc-arm-linux-gnueabi libc6-dev-armel-cross
5355
shell:bash
56+
-name:Install emscripten (wasm32-unknown-emscripten)
57+
if:${{ matrix.target == 'wasm32-unknown-emscripten' }}
58+
run:|
59+
sudo apt-get update -y
60+
sudo apt-get install -y --no-install-recommends emscripten
61+
shell:bash
5462
-name:Build ${{ matrix.lua }}
5563
run:|
5664
cargo build --manifest-path testcrate/Cargo.toml --target ${{ matrix.target }} --release --features ${{ matrix.lua }}
@@ -71,11 +79,21 @@ jobs:
7179
target:x86_64-apple-darwin
7280
-os:windows-latest
7381
target:x86_64-pc-windows-msvc
82+
-os:ubuntu-latest
83+
target:wasm32-unknown-emscripten
7484
steps:
7585
-uses:actions/checkout@v3
7686
-uses:dtolnay/rust-toolchain@stable
7787
with:
7888
target:${{ matrix.target }}
89+
-name:Install emscripten (wasm32-unknown-emscripten)
90+
if:${{ matrix.target == 'wasm32-unknown-emscripten' }}
91+
run:|
92+
sudo apt-get update -y
93+
sudo apt-get install -y --no-install-recommends emscripten
94+
echo 'CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUNNER=node' >> $GITHUB_ENV
95+
echo 'RUSTFLAGS="-C link-args=-sERROR_ON_UNDEFINED_SYMBOLS=0"' >> $GITHUB_ENV
96+
shell:bash
7997
-name:Run ${{ matrix.lua }} tests
8098
run:|
8199
cargo test --manifest-path testcrate/Cargo.toml --release --features ${{ matrix.lua }}

‎src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ impl Build {
104104
// Defined in Lua >= 5.3
105105
config.define("LUA_USE_WINDOWS",None);
106106
}
107+
_if target.ends_with("emscripten") =>{
108+
config.define("LUA_USE_POSIX",None);
109+
}
107110
_ =>panic!("don't know how to build Lua for {}", target),
108111
};
109112

‎testcrate/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ extern "C" {
77
pubfnlua_tolstring(state:*mutc_void,index:c_int,len:*mutc_long) ->*constc_char;
88
pubfnluaL_loadstring(state:*mutc_void,s:*constc_char) ->c_int;
99

10-
#[cfg(any(feature ="lua52", feature ="lua53", feature ="lua54"))]
10+
#[cfg(feature ="lua52")]
1111
pubfnlua_getglobal(state:*mutc_void,k:*constc_char);
12+
#[cfg(any(feature ="lua53", feature ="lua54"))]
13+
pubfnlua_getglobal(state:*mutc_void,k:*constc_char) ->c_int;
1214
}
1315

1416
#[cfg(feature ="lua51")]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp