File tree 14 files changed +143
-51
lines changed
14 files changed +143
-51
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -9,9 +9,7 @@ online][compiled]
9
9
You can build the example locally with:
10
10
11
11
```
12
- $ ./ run.sh
12
+ $ python3 run.py
13
13
```
14
14
15
- (or running the commands on Windows manually)
16
-
17
- and then visiting http://localhost:8080 in a browser should run the example!
15
+ and then visiting http://localhost:8000 in a browser should run the example!
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
2
+ import os
3
+ import subprocess
4
+
5
+ root_dir = os .path .dirname (__file__ )
6
+
7
+ # A couple of steps are necessary to get this build working which makes it slightly
8
+ # nonstandard compared to most other builds.
9
+ #
10
+ # * First, the Rust standard library needs to be recompiled with atomics
11
+ # enabled. to do that we use Cargo's unstable `-Zbuild-std` feature.
12
+ #
13
+ # * Next we need to compile everything with the `atomics` and `bulk-memory`
14
+ # features enabled, ensuring that LLVM will generate atomic instructions,
15
+ # shared memory, passive segments, etc.
16
+
17
+ os .environ .update (
18
+ {"RUSTFLAGS" : "-C target-feature=+atomics,+bulk-memory,+mutable-globals" }
19
+ )
20
+
21
+ subprocess .run (
22
+ [
23
+ "cargo" ,
24
+ "build" ,
25
+ "--target" ,
26
+ "wasm32-unknown-unknown" ,
27
+ "--release" ,
28
+ "-Zbuild-std=std,panic_abort" ,
29
+ ],
30
+ cwd = root_dir ,
31
+ ).check_returncode ()
32
+
33
+ # Note the usage of `--target no-modules` here which is required for passing
34
+ # the memory import to each wasm module.
35
+ subprocess .run (
36
+ [
37
+ "cargo" ,
38
+ "run" ,
39
+ "-p" ,
40
+ "wasm-bindgen-cli" ,
41
+ "--" ,
42
+ os .path .join (
43
+ root_dir ,
44
+ ".." ,
45
+ ".." ,
46
+ "target" ,
47
+ "wasm32-unknown-unknown" ,
48
+ "release" ,
49
+ "raytrace_parallel.wasm" ,
50
+ ),
51
+ "--out-dir" ,
52
+ os .path .join (root_dir , "pkg" ),
53
+ "--target" ,
54
+ "no-modules" ,
55
+ ],
56
+ cwd = root_dir ,
57
+ ).check_returncode ()
Original file line number Diff line number Diff line change 2
2
3
3
set -ex
4
4
5
- # A couple of steps are necessary to get this build working which makes it slightly
6
- # nonstandard compared to most other builds.
7
- #
8
- # * First, the Rust standard library needs to be recompiled with atomics
9
- # enabled. to do that we use Cargo's unstable `-Zbuild-std` feature.
10
- #
11
- # * Next we need to compile everything with the `atomics` and `bulk-memory`
12
- # features enabled, ensuring that LLVM will generate atomic instructions,
13
- # shared memory, passive segments, etc.
14
-
15
- RUSTFLAGS=' -C target-feature=+atomics,+bulk-memory,+mutable-globals' \
16
- cargo build --target wasm32-unknown-unknown --release -Z build-std=std,panic_abort
17
-
18
- # Note the usage of `--target no-modules` here which is required for passing
19
- # the memory import to each wasm module.
20
- cargo run -p wasm-bindgen-cli -- \
21
- ../../target/wasm32-unknown-unknown/release/raytrace_parallel.wasm \
22
- --out-dir . \
23
- --target no-modules
5
+ python3 build.py
Original file line number Diff line number Diff line change 219
219
document . getElementById ( 'render' ) . disabled = true ;
220
220
document . getElementById ( 'concurrency' ) . disabled = true ;
221
221
</ script >
222
- < script src ='raytrace_parallel.js '> </ script >
222
+ < script src ='pkg/ raytrace_parallel.js '> </ script >
223
223
< script src ='index.js '> </ script >
224
224
</ body >
225
225
</ html >
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
2
+ import os
3
+ import subprocess
4
+
5
+ root_dir = os .path .dirname (__file__ )
6
+
7
+ subprocess .run (["python3" , "build.py" ], cwd = root_dir ).check_returncode ()
8
+
9
+ subprocess .run (["python3" , "server.py" ], cwd = root_dir ).check_returncode ()
Original file line number Diff line number Diff line change 2
2
3
3
set -ex
4
4
5
- ./ build.sh
5
+ python3 build.py
6
6
7
7
python3 server.py
Original file line number Diff line number Diff line change 1
1
// synchronously, using the browser, import out shim JS scripts
2
- importScripts ( 'raytrace_parallel.js' ) ;
2
+ importScripts ( 'pkg/ raytrace_parallel.js' ) ;
3
3
4
4
// Wait for the main thread to send us the shared module/memory. Once we've got
5
5
// it, initialize it all with the `wasm_bindgen` global we imported via
Original file line number Diff line number Diff line change @@ -9,9 +9,7 @@ online][compiled]
9
9
You can build the example locally with:
10
10
11
11
```
12
- $ ./ run.sh
12
+ $ python3 run.py
13
13
```
14
14
15
- (or running the commands on Windows manually)
16
-
17
15
and then visiting http://localhost:8080 in a browser should run the example!
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
2
+ import os
3
+ import subprocess
4
+
5
+ root_dir = os .path .dirname (__file__ )
6
+
7
+ # A couple of steps are necessary to get this build working which makes it slightly
8
+ # nonstandard compared to most other builds.
9
+ #
10
+ # * First, the Rust standard library needs to be recompiled with atomics
11
+ # enabled. to do that we use Cargo's unstable `-Zbuild-std` feature.
12
+ #
13
+ # * Next we need to compile everything with the `atomics` and `bulk-memory`
14
+ # features enabled, ensuring that LLVM will generate atomic instructions,
15
+ # shared memory, passive segments, etc.
16
+
17
+ os .environ .update (
18
+ {"RUSTFLAGS" : "-C target-feature=+atomics,+bulk-memory,+mutable-globals" }
19
+ )
20
+
21
+ subprocess .run (
22
+ [
23
+ "cargo" ,
24
+ "build" ,
25
+ "--target" ,
26
+ "wasm32-unknown-unknown" ,
27
+ "--release" ,
28
+ "-Zbuild-std=std,panic_abort" ,
29
+ ],
30
+ cwd = root_dir ,
31
+ ).check_returncode ()
32
+
33
+ # Note the usage of `--target no-modules` here which is required for passing
34
+ # the memory import to each wasm module.
35
+ subprocess .run (
36
+ [
37
+ "cargo" ,
38
+ "run" ,
39
+ "-p" ,
40
+ "wasm-bindgen-cli" ,
41
+ "--" ,
42
+ os .path .join (
43
+ root_dir ,
44
+ ".." ,
45
+ ".." ,
46
+ "target" ,
47
+ "wasm32-unknown-unknown" ,
48
+ "release" ,
49
+ "wasm_audio_worklet.wasm" ,
50
+ ),
51
+ "--out-dir" ,
52
+ os .path .join (root_dir , "pkg" ),
53
+ "--target" ,
54
+ "web" ,
55
+ "--split-linked-modules" ,
56
+ ],
57
+ cwd = root_dir ,
58
+ ).check_returncode ()
Original file line number Diff line number Diff line change 2
2
3
3
set -ex
4
4
5
- # A couple of steps are necessary to get this build working which makes it slightly
6
- # nonstandard compared to most other builds.
7
- #
8
- # * First, the Rust standard library needs to be recompiled with atomics
9
- # enabled. to do that we use Cargo's unstable `-Zbuild-std` feature.
10
- #
11
- # * Next we need to compile everything with the `atomics` and `bulk-memory`
12
- # features enabled, ensuring that LLVM will generate atomic instructions,
13
- # shared memory, passive segments, etc.
14
-
15
- RUSTFLAGS=' -C target-feature=+atomics,+bulk-memory,+mutable-globals' \
16
- cargo build --target wasm32-unknown-unknown --release -Z build-std=std,panic_abort
17
-
18
- cargo run -p wasm-bindgen-cli -- \
19
- ../../target/wasm32-unknown-unknown/release/wasm_audio_worklet.wasm \
20
- --out-dir . \
21
- --target web \
22
- --split-linked-modules
5
+ python3 build.py
Original file line number Diff line number Diff line change 5
5
</ head >
6
6
< body >
7
7
< script type ="module ">
8
- import init , { web_main } from "./wasm_audio_worklet.js" ;
8
+ import init , { web_main } from "./pkg/ wasm_audio_worklet.js" ;
9
9
async function run ( ) {
10
10
await init ( ) ;
11
11
web_main ( ) ;
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
2
+ import os
3
+ import subprocess
4
+
5
+ root_dir = os .path .dirname (__file__ )
6
+
7
+ subprocess .run (["python3" , "build.py" ], cwd = root_dir ).check_returncode ()
8
+
9
+ subprocess .run (["python3" , "server.py" ], cwd = root_dir ).check_returncode ()
Original file line number Diff line number Diff line change 2
2
3
3
set -ex
4
4
5
- ./ build.sh
5
+ python3 build.py
6
6
7
7
python3 server.py
You can’t perform that action at this time.
0 commit comments