@thi.ng/wasm-api 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -1
- package/README.md +12 -8
- package/api.d.ts +1 -1
- package/bridge.d.ts +28 -4
- package/bridge.js +37 -20
- package/package.json +2 -2
- package/test/custom.zig +2 -2
- package/zig/core.zig +26 -26
- package/dev/zig-cache/o/85202d15b9c43c8c66de01ab98d6eb2c/builtin.zig +0 -39
- package/dev/zig-cache/o/9e1187e9310422c9c2330ebceeaecce7/builtin.zig +0 -39
- package/dev/zig-cache/o/f647d1186cb589536c92b809f6e25f75/builtin.zig +0 -39
- package/test/zig-cache/o/117d44467ded6ce3864cde3c180ef73c/builtin.zig +0 -39
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2022-08-
|
|
3
|
+
- **Last updated**: 2022-08-07T15:28:01Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,15 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
## [0.4.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/wasm-api@0.4.0) (2022-08-07)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- use named import objects ([4965f20](https://github.com/thi-ng/umbrella/commit/4965f20))
|
|
17
|
+
- switch to name import objects to avoid merging into flat namespace
|
|
18
|
+
- update externs in core.zig
|
|
19
|
+
- update docstrings
|
|
20
|
+
|
|
12
21
|
## [0.3.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/wasm-api@0.3.0) (2022-08-04)
|
|
13
22
|
|
|
14
23
|
#### 🚀 Features
|
package/README.md
CHANGED
|
@@ -57,15 +57,15 @@ export class CustomAPI implements IWasmAPI {
|
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
* Returns object of functions to import as externals into
|
|
60
|
-
* the WASM module. These imports are merged
|
|
61
|
-
*
|
|
60
|
+
* the WASM module. These imports are merged into a larger
|
|
61
|
+
* imports object alongside the bridge's core API...
|
|
62
62
|
*/
|
|
63
63
|
getImports(): WebAssembly.Imports {
|
|
64
64
|
return {
|
|
65
65
|
/**
|
|
66
66
|
* Writes 2 random float32 numbers to given address
|
|
67
67
|
*/
|
|
68
|
-
|
|
68
|
+
randomVec2: (addr: number) => {
|
|
69
69
|
this.parent.f32.set(
|
|
70
70
|
[Math.random(), Math.random()],
|
|
71
71
|
addr >> 2
|
|
@@ -83,14 +83,17 @@ export const bridge = new WasmBridge({ custom: new CustomAPI() });
|
|
|
83
83
|
```
|
|
84
84
|
|
|
85
85
|
In Zig (or any other language of your choice) we can then utilize this custom
|
|
86
|
-
API like so (Please also see example further below in this
|
|
86
|
+
API like so (Please also see /test/index.ts` & the example further below in this
|
|
87
|
+
readme):
|
|
87
88
|
|
|
88
89
|
```zig
|
|
89
90
|
// Import JS core API
|
|
90
91
|
const js = @import("wasmapi");
|
|
91
92
|
|
|
92
93
|
/// JS external to fill vec2 w/ random values
|
|
93
|
-
|
|
94
|
+
/// Note: Each API module uses a separate import object to avoid naming clashes
|
|
95
|
+
/// Here we declare an external binding belonging to the "custom" import group
|
|
96
|
+
extern "custom" fn randomVec2(addr: usize) void;
|
|
94
97
|
|
|
95
98
|
export fn test_randomVec2() void {
|
|
96
99
|
var foo = [2]f32{ 0, 0 };
|
|
@@ -99,7 +102,7 @@ export fn test_randomVec2() void {
|
|
|
99
102
|
js.printF32Array(foo[0..]);
|
|
100
103
|
|
|
101
104
|
// populate foo with random numbers
|
|
102
|
-
|
|
105
|
+
randomVec2(@ptrToInt(&foo));
|
|
103
106
|
|
|
104
107
|
// print result
|
|
105
108
|
js.printF32Array(foo[0..]);
|
|
@@ -182,7 +185,7 @@ node --experimental-repl-await
|
|
|
182
185
|
> const wasmApi = await import("@thi.ng/wasm-api");
|
|
183
186
|
```
|
|
184
187
|
|
|
185
|
-
Package sizes (gzipped, pre-treeshake): ESM: 1.
|
|
188
|
+
Package sizes (gzipped, pre-treeshake): ESM: 1.61 KB
|
|
186
189
|
|
|
187
190
|
## Dependencies
|
|
188
191
|
|
|
@@ -212,6 +215,7 @@ interface App extends WasmExports {
|
|
|
212
215
|
|
|
213
216
|
// instantiate WASM module using imports provided by the bridge
|
|
214
217
|
// this also initializes any bindings & bridge child APIs (if any)
|
|
218
|
+
// (also accepts a fetch() `Response` as input)
|
|
215
219
|
await bridge.instantiate(readFileSync("hello.wasm"));
|
|
216
220
|
|
|
217
221
|
// call an exported WASM function
|
|
@@ -253,7 +257,7 @@ The resulting WASM:
|
|
|
253
257
|
(module
|
|
254
258
|
(type $i32_i32_=>_none (func (param i32 i32)))
|
|
255
259
|
(type $none_=>_none (func))
|
|
256
|
-
(import "
|
|
260
|
+
(import "core" "_printStr" (func $fimport$0 (param i32 i32)))
|
|
257
261
|
(global $global$0 (mut i32) (i32.const 65536))
|
|
258
262
|
(memory $0 2)
|
|
259
263
|
(data (i32.const 65536) "hello world!\00")
|
package/api.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export interface WasmExports {
|
|
|
48
48
|
* functions are declared as bindings in `/zig/core.zig`. Also see this file for
|
|
49
49
|
* documentation of each function...
|
|
50
50
|
*/
|
|
51
|
-
export interface CoreAPI {
|
|
51
|
+
export interface CoreAPI extends WebAssembly.ModuleImports {
|
|
52
52
|
printI8: Fn<number, void>;
|
|
53
53
|
printU8: Fn<number, void>;
|
|
54
54
|
printU8Hex: Fn<number, void>;
|
package/bridge.d.ts
CHANGED
|
@@ -32,8 +32,9 @@ export declare class WasmBridge<T extends WasmExports = WasmExports> {
|
|
|
32
32
|
f64: Float64Array;
|
|
33
33
|
utf8Decoder: TextDecoder;
|
|
34
34
|
utf8Encoder: TextEncoder;
|
|
35
|
-
|
|
35
|
+
imports: WebAssembly.Imports;
|
|
36
36
|
exports: T;
|
|
37
|
+
core: CoreAPI;
|
|
37
38
|
constructor(modules?: Record<string, IWasmAPI<T>>, logger?: ILogger);
|
|
38
39
|
/**
|
|
39
40
|
* Instantiates WASM module from given `src` (and optional provided extra
|
|
@@ -63,9 +64,32 @@ export declare class WasmBridge<T extends WasmExports = WasmExports> {
|
|
|
63
64
|
* API and any provided bridge API modules.
|
|
64
65
|
*
|
|
65
66
|
* @remarks
|
|
66
|
-
* Since
|
|
67
|
-
*
|
|
68
|
-
*
|
|
67
|
+
* Since v0.4.0 each API module's imports will be in their own WASM import
|
|
68
|
+
* table, named using the same key which was assigned to the module when
|
|
69
|
+
* creating the WASM bridge.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* The following creates a bridge with a fictional `custom` API module:
|
|
73
|
+
*
|
|
74
|
+
* ```ts
|
|
75
|
+
* const bridge = new WasmBridge({ custom: new CustomAPI() });
|
|
76
|
+
*
|
|
77
|
+
* // get combined imports object
|
|
78
|
+
* bridge.getImports();
|
|
79
|
+
* {
|
|
80
|
+
* // imports defined by the core API of the bridge itself
|
|
81
|
+
* core: { ... },
|
|
82
|
+
* // imports defined by the CustomAPI module
|
|
83
|
+
* custom: { ... }
|
|
84
|
+
* }
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
87
|
+
* Any related API bindings on the WASM (Zig) side then also need to refer
|
|
88
|
+
* to these custom import sections (also see `/zig/core.zig`):
|
|
89
|
+
*
|
|
90
|
+
* ```zig
|
|
91
|
+
* pub export "custom" fn foo(x: u32) void;
|
|
92
|
+
* ```
|
|
69
93
|
*/
|
|
70
94
|
getImports(): WebAssembly.Imports;
|
|
71
95
|
getI8(addr: number): number;
|
package/bridge.js
CHANGED
|
@@ -70,14 +70,10 @@ export class WasmBridge {
|
|
|
70
70
|
*/
|
|
71
71
|
async instantiate(src, imports) {
|
|
72
72
|
const $src = await src;
|
|
73
|
-
const $imports = { ...
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
wasm = await WebAssembly.instantiate($src, $imports);
|
|
80
|
-
}
|
|
73
|
+
const $imports = { ...this.getImports(), ...imports };
|
|
74
|
+
const wasm = await ($src instanceof Response
|
|
75
|
+
? WebAssembly.instantiateStreaming($src, $imports)
|
|
76
|
+
: WebAssembly.instantiate($src, $imports));
|
|
81
77
|
return this.init(wasm.instance.exports);
|
|
82
78
|
}
|
|
83
79
|
/**
|
|
@@ -114,23 +110,44 @@ export class WasmBridge {
|
|
|
114
110
|
* API and any provided bridge API modules.
|
|
115
111
|
*
|
|
116
112
|
* @remarks
|
|
117
|
-
* Since
|
|
118
|
-
*
|
|
119
|
-
*
|
|
113
|
+
* Since v0.4.0 each API module's imports will be in their own WASM import
|
|
114
|
+
* table, named using the same key which was assigned to the module when
|
|
115
|
+
* creating the WASM bridge.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* The following creates a bridge with a fictional `custom` API module:
|
|
119
|
+
*
|
|
120
|
+
* ```ts
|
|
121
|
+
* const bridge = new WasmBridge({ custom: new CustomAPI() });
|
|
122
|
+
*
|
|
123
|
+
* // get combined imports object
|
|
124
|
+
* bridge.getImports();
|
|
125
|
+
* {
|
|
126
|
+
* // imports defined by the core API of the bridge itself
|
|
127
|
+
* core: { ... },
|
|
128
|
+
* // imports defined by the CustomAPI module
|
|
129
|
+
* custom: { ... }
|
|
130
|
+
* }
|
|
131
|
+
* ```
|
|
132
|
+
*
|
|
133
|
+
* Any related API bindings on the WASM (Zig) side then also need to refer
|
|
134
|
+
* to these custom import sections (also see `/zig/core.zig`):
|
|
135
|
+
*
|
|
136
|
+
* ```zig
|
|
137
|
+
* pub export "custom" fn foo(x: u32) void;
|
|
138
|
+
* ```
|
|
120
139
|
*/
|
|
121
140
|
getImports() {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
if (env[k] !== undefined) {
|
|
128
|
-
illegalArgs(`attempt to redeclare import: ${k} by API module ${id}`);
|
|
141
|
+
if (!this.imports) {
|
|
142
|
+
this.imports = { core: this.core };
|
|
143
|
+
for (let id in this.modules) {
|
|
144
|
+
if (this.imports[id] !== undefined) {
|
|
145
|
+
illegalArgs(`attempt to redeclare API module ${id}`);
|
|
129
146
|
}
|
|
147
|
+
this.imports[id] = this.modules[id].getImports();
|
|
130
148
|
}
|
|
131
|
-
Object.assign(env, imports);
|
|
132
149
|
}
|
|
133
|
-
return
|
|
150
|
+
return this.imports;
|
|
134
151
|
}
|
|
135
152
|
getI8(addr) {
|
|
136
153
|
return this.i8[addr];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/wasm-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Modular, extensible API bridge and generic glue code between JS & WebAssembly",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"status": "alpha",
|
|
93
93
|
"year": 2022
|
|
94
94
|
},
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "0eeb5054111cea51f4714b013dda8700ade3cd54\n"
|
|
96
96
|
}
|
package/test/custom.zig
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
const js = @import("wasmapi");
|
|
3
3
|
|
|
4
4
|
/// Fill vec2 with random values
|
|
5
|
-
extern fn
|
|
5
|
+
extern "custom" fn setVec2(addr: usize) void;
|
|
6
6
|
|
|
7
7
|
export fn test_setVec2() void {
|
|
8
8
|
var foo = [2]f32{ 0, 0 };
|
|
9
9
|
js.printF32Array(foo[0..]);
|
|
10
|
-
|
|
10
|
+
setVec2(@ptrToInt(&foo));
|
|
11
11
|
js.printF32Array(foo[0..]);
|
|
12
12
|
}
|
package/zig/core.zig
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
1
|
//! JavaScript externals for https://thi.ng/wasm-api
|
|
2
2
|
|
|
3
3
|
/// Prints number using configured JS logger
|
|
4
|
-
pub extern fn printI8(x: i8) void;
|
|
4
|
+
pub extern "core" fn printI8(x: i8) void;
|
|
5
5
|
/// Prints number using configured JS logger
|
|
6
|
-
pub extern fn printU8(x: u8) void;
|
|
6
|
+
pub extern "core" fn printU8(x: u8) void;
|
|
7
7
|
/// Prints hex number using configured JS logger
|
|
8
|
-
pub extern fn printU8Hex(x: u8) void;
|
|
8
|
+
pub extern "core" fn printU8Hex(x: u8) void;
|
|
9
9
|
|
|
10
10
|
/// Prints number using configured JS logger
|
|
11
|
-
pub extern fn printI16(x: i16) void;
|
|
11
|
+
pub extern "core" fn printI16(x: i16) void;
|
|
12
12
|
/// Prints number using configured JS logger
|
|
13
|
-
pub extern fn printU16(x: u16) void;
|
|
13
|
+
pub extern "core" fn printU16(x: u16) void;
|
|
14
14
|
/// Prints hex number using configured JS logger
|
|
15
|
-
pub extern fn printU16Hex(x: u16) void;
|
|
15
|
+
pub extern "core" fn printU16Hex(x: u16) void;
|
|
16
16
|
|
|
17
17
|
/// Prints number using configured JS logger
|
|
18
|
-
pub extern fn printI32(x: i32) void;
|
|
18
|
+
pub extern "core" fn printI32(x: i32) void;
|
|
19
19
|
/// Prints number using configured JS logger
|
|
20
|
-
pub extern fn printU32(x: u32) void;
|
|
20
|
+
pub extern "core" fn printU32(x: u32) void;
|
|
21
21
|
/// Prints hex number using configured JS logger
|
|
22
|
-
pub extern fn printU32Hex(x: u32) void;
|
|
22
|
+
pub extern "core" fn printU32Hex(x: u32) void;
|
|
23
23
|
|
|
24
24
|
/// Prints decomposed i64 number using configured JS logger
|
|
25
|
-
pub extern fn _printI64(hi: i32, lo: i32) void;
|
|
25
|
+
pub extern "core" fn _printI64(hi: i32, lo: i32) void;
|
|
26
26
|
/// Convenience wrapper for _printI64(), accepting an i64
|
|
27
27
|
pub fn printI64(x: i64) void {
|
|
28
28
|
_printI64(@truncate(i32, x >> 32), @truncate(i32, x));
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/// Prints decomposed u64 number using configured JS logger
|
|
32
|
-
pub extern fn _printU64(hi: u32, lo: u32) void;
|
|
32
|
+
pub extern "core" fn _printU64(hi: u32, lo: u32) void;
|
|
33
33
|
/// Convenience wrapper for _printU64(), accepting an u64
|
|
34
34
|
pub fn printU64(x: u64) void {
|
|
35
35
|
_printU64(@truncate(u32, x >> 32), @truncate(u32, x));
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/// Prints decomposed u64 hex number using configured JS logger
|
|
39
|
-
pub extern fn _printU64Hex(hi: u32, lo: u32) void;
|
|
39
|
+
pub extern "core" fn _printU64Hex(hi: u32, lo: u32) void;
|
|
40
40
|
/// Convenience wrapper for _printU64Hex(), accepting an u64
|
|
41
41
|
pub fn printU64Hex(x: u64) void {
|
|
42
42
|
_printU64Hex(@truncate(u32, x >> 32), @truncate(u32, x));
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/// Prints number using configured JS logger
|
|
46
|
-
pub extern fn printF32(x: f32) void;
|
|
46
|
+
pub extern "core" fn printF32(x: f32) void;
|
|
47
47
|
/// Prints number using configured JS logger
|
|
48
|
-
pub extern fn printF64(x: f64) void;
|
|
48
|
+
pub extern "core" fn printF64(x: f64) void;
|
|
49
49
|
|
|
50
50
|
/// Prints pointer as hex number using configured JS logger
|
|
51
51
|
pub fn printPtr(ptr: *const anyopaque) void {
|
|
@@ -53,25 +53,25 @@ pub fn printPtr(ptr: *const anyopaque) void {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
/// Prints number array using configured JS logger
|
|
56
|
-
pub extern fn _printI8Array(addr: usize, len: usize) void;
|
|
56
|
+
pub extern "core" fn _printI8Array(addr: usize, len: usize) void;
|
|
57
57
|
/// Prints number array using configured JS logger
|
|
58
|
-
pub extern fn _printU8Array(addr: usize, len: usize) void;
|
|
58
|
+
pub extern "core" fn _printU8Array(addr: usize, len: usize) void;
|
|
59
59
|
/// Prints number array using configured JS logger
|
|
60
|
-
pub extern fn _printI16Array(addr: usize, len: usize) void;
|
|
60
|
+
pub extern "core" fn _printI16Array(addr: usize, len: usize) void;
|
|
61
61
|
/// Prints number array using configured JS logger
|
|
62
|
-
pub extern fn _printU16Array(addr: usize, len: usize) void;
|
|
62
|
+
pub extern "core" fn _printU16Array(addr: usize, len: usize) void;
|
|
63
63
|
/// Prints number array using configured JS logger
|
|
64
|
-
pub extern fn _printI32Array(addr: usize, len: usize) void;
|
|
64
|
+
pub extern "core" fn _printI32Array(addr: usize, len: usize) void;
|
|
65
65
|
/// Prints number array using configured JS logger
|
|
66
|
-
pub extern fn _printU32Array(addr: usize, len: usize) void;
|
|
66
|
+
pub extern "core" fn _printU32Array(addr: usize, len: usize) void;
|
|
67
67
|
/// Prints number array using configured JS logger
|
|
68
|
-
pub extern fn _printI64Array(addr: usize, len: usize) void;
|
|
68
|
+
pub extern "core" fn _printI64Array(addr: usize, len: usize) void;
|
|
69
69
|
/// Prints number array using configured JS logger
|
|
70
|
-
pub extern fn _printU64Array(addr: usize, len: usize) void;
|
|
70
|
+
pub extern "core" fn _printU64Array(addr: usize, len: usize) void;
|
|
71
71
|
/// Prints number array using configured JS logger
|
|
72
|
-
pub extern fn _printF32Array(addr: usize, len: usize) void;
|
|
72
|
+
pub extern "core" fn _printF32Array(addr: usize, len: usize) void;
|
|
73
73
|
/// Prints number array using configured JS logger
|
|
74
|
-
pub extern fn _printF64Array(addr: usize, len: usize) void;
|
|
74
|
+
pub extern "core" fn _printF64Array(addr: usize, len: usize) void;
|
|
75
75
|
|
|
76
76
|
/// Prints number array using configured JS logger
|
|
77
77
|
pub fn printI8Array(buf: []const i8) void {
|
|
@@ -115,9 +115,9 @@ pub fn printF64Array(buf: []const f64) void {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
/// Prints a zero-terminated string using configured JS logger
|
|
118
|
-
extern fn _printStr0(addr: usize) void;
|
|
118
|
+
pub extern "core" fn _printStr0(addr: usize) void;
|
|
119
119
|
/// Prints a string of given length using configured JS logger
|
|
120
|
-
extern fn _printStr(addr: usize, len: usize) void;
|
|
120
|
+
pub extern "core" fn _printStr(addr: usize, len: usize) void;
|
|
121
121
|
/// Convenience wrapper for _printStr, accepting a slice as arg
|
|
122
122
|
pub fn printStr(msg: []const u8) void {
|
|
123
123
|
_printStr(@ptrToInt(msg.ptr), msg.len);
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const std = @import("std");
|
|
2
|
-
/// Zig version. When writing code that supports multiple versions of Zig, prefer
|
|
3
|
-
/// feature detection (i.e. with `@hasDecl` or `@hasField`) over version checks.
|
|
4
|
-
pub const zig_version = std.SemanticVersion.parse("0.10.0-dev.3034+6fab6c3e4") catch unreachable;
|
|
5
|
-
pub const zig_backend = std.builtin.CompilerBackend.stage1;
|
|
6
|
-
/// Temporary until self-hosted supports the `cpu.arch` value.
|
|
7
|
-
pub const stage2_arch: std.Target.Cpu.Arch = .wasm32;
|
|
8
|
-
|
|
9
|
-
pub const output_mode = std.builtin.OutputMode.Lib;
|
|
10
|
-
pub const link_mode = std.builtin.LinkMode.Dynamic;
|
|
11
|
-
pub const is_test = false;
|
|
12
|
-
pub const single_threaded = true;
|
|
13
|
-
pub const abi = std.Target.Abi.musl;
|
|
14
|
-
pub const cpu: std.Target.Cpu = .{
|
|
15
|
-
.arch = .wasm32,
|
|
16
|
-
.model = &std.Target.wasm.cpu.generic,
|
|
17
|
-
.features = std.Target.wasm.featureSet(&[_]std.Target.wasm.Feature{
|
|
18
|
-
}),
|
|
19
|
-
};
|
|
20
|
-
pub const os = std.Target.Os{
|
|
21
|
-
.tag = .freestanding,
|
|
22
|
-
.version_range = .{ .none = {} },
|
|
23
|
-
};
|
|
24
|
-
pub const target = std.Target{
|
|
25
|
-
.cpu = cpu,
|
|
26
|
-
.os = os,
|
|
27
|
-
.abi = abi,
|
|
28
|
-
};
|
|
29
|
-
pub const object_format = std.Target.ObjectFormat.wasm;
|
|
30
|
-
pub const mode = std.builtin.Mode.ReleaseSmall;
|
|
31
|
-
pub const link_libc = false;
|
|
32
|
-
pub const link_libcpp = false;
|
|
33
|
-
pub const have_error_return_tracing = false;
|
|
34
|
-
pub const valgrind_support = false;
|
|
35
|
-
pub const sanitize_thread = false;
|
|
36
|
-
pub const position_independent_code = true;
|
|
37
|
-
pub const position_independent_executable = false;
|
|
38
|
-
pub const strip_debug_info = true;
|
|
39
|
-
pub const code_model = std.builtin.CodeModel.default;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const std = @import("std");
|
|
2
|
-
/// Zig version. When writing code that supports multiple versions of Zig, prefer
|
|
3
|
-
/// feature detection (i.e. with `@hasDecl` or `@hasField`) over version checks.
|
|
4
|
-
pub const zig_version = std.SemanticVersion.parse("0.10.0-dev.3034+6fab6c3e4") catch unreachable;
|
|
5
|
-
pub const zig_backend = std.builtin.CompilerBackend.stage1;
|
|
6
|
-
/// Temporary until self-hosted supports the `cpu.arch` value.
|
|
7
|
-
pub const stage2_arch: std.Target.Cpu.Arch = .wasm32;
|
|
8
|
-
|
|
9
|
-
pub const output_mode = std.builtin.OutputMode.Lib;
|
|
10
|
-
pub const link_mode = std.builtin.LinkMode.Dynamic;
|
|
11
|
-
pub const is_test = false;
|
|
12
|
-
pub const single_threaded = true;
|
|
13
|
-
pub const abi = std.Target.Abi.musl;
|
|
14
|
-
pub const cpu: std.Target.Cpu = .{
|
|
15
|
-
.arch = .wasm32,
|
|
16
|
-
.model = &std.Target.wasm.cpu.generic,
|
|
17
|
-
.features = std.Target.wasm.featureSet(&[_]std.Target.wasm.Feature{
|
|
18
|
-
}),
|
|
19
|
-
};
|
|
20
|
-
pub const os = std.Target.Os{
|
|
21
|
-
.tag = .freestanding,
|
|
22
|
-
.version_range = .{ .none = {} },
|
|
23
|
-
};
|
|
24
|
-
pub const target = std.Target{
|
|
25
|
-
.cpu = cpu,
|
|
26
|
-
.os = os,
|
|
27
|
-
.abi = abi,
|
|
28
|
-
};
|
|
29
|
-
pub const object_format = std.Target.ObjectFormat.wasm;
|
|
30
|
-
pub const mode = std.builtin.Mode.ReleaseSmall;
|
|
31
|
-
pub const link_libc = false;
|
|
32
|
-
pub const link_libcpp = false;
|
|
33
|
-
pub const have_error_return_tracing = false;
|
|
34
|
-
pub const valgrind_support = false;
|
|
35
|
-
pub const sanitize_thread = false;
|
|
36
|
-
pub const position_independent_code = true;
|
|
37
|
-
pub const position_independent_executable = false;
|
|
38
|
-
pub const strip_debug_info = true;
|
|
39
|
-
pub const code_model = std.builtin.CodeModel.default;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const std = @import("std");
|
|
2
|
-
/// Zig version. When writing code that supports multiple versions of Zig, prefer
|
|
3
|
-
/// feature detection (i.e. with `@hasDecl` or `@hasField`) over version checks.
|
|
4
|
-
pub const zig_version = std.SemanticVersion.parse("0.10.0-dev.3034+6fab6c3e4") catch unreachable;
|
|
5
|
-
pub const zig_backend = std.builtin.CompilerBackend.stage1;
|
|
6
|
-
/// Temporary until self-hosted supports the `cpu.arch` value.
|
|
7
|
-
pub const stage2_arch: std.Target.Cpu.Arch = .wasm32;
|
|
8
|
-
|
|
9
|
-
pub const output_mode = std.builtin.OutputMode.Lib;
|
|
10
|
-
pub const link_mode = std.builtin.LinkMode.Dynamic;
|
|
11
|
-
pub const is_test = false;
|
|
12
|
-
pub const single_threaded = true;
|
|
13
|
-
pub const abi = std.Target.Abi.musl;
|
|
14
|
-
pub const cpu: std.Target.Cpu = .{
|
|
15
|
-
.arch = .wasm32,
|
|
16
|
-
.model = &std.Target.wasm.cpu.generic,
|
|
17
|
-
.features = std.Target.wasm.featureSet(&[_]std.Target.wasm.Feature{
|
|
18
|
-
}),
|
|
19
|
-
};
|
|
20
|
-
pub const os = std.Target.Os{
|
|
21
|
-
.tag = .freestanding,
|
|
22
|
-
.version_range = .{ .none = {} },
|
|
23
|
-
};
|
|
24
|
-
pub const target = std.Target{
|
|
25
|
-
.cpu = cpu,
|
|
26
|
-
.os = os,
|
|
27
|
-
.abi = abi,
|
|
28
|
-
};
|
|
29
|
-
pub const object_format = std.Target.ObjectFormat.wasm;
|
|
30
|
-
pub const mode = std.builtin.Mode.ReleaseSmall;
|
|
31
|
-
pub const link_libc = false;
|
|
32
|
-
pub const link_libcpp = false;
|
|
33
|
-
pub const have_error_return_tracing = false;
|
|
34
|
-
pub const valgrind_support = false;
|
|
35
|
-
pub const sanitize_thread = false;
|
|
36
|
-
pub const position_independent_code = true;
|
|
37
|
-
pub const position_independent_executable = false;
|
|
38
|
-
pub const strip_debug_info = true;
|
|
39
|
-
pub const code_model = std.builtin.CodeModel.default;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const std = @import("std");
|
|
2
|
-
/// Zig version. When writing code that supports multiple versions of Zig, prefer
|
|
3
|
-
/// feature detection (i.e. with `@hasDecl` or `@hasField`) over version checks.
|
|
4
|
-
pub const zig_version = std.SemanticVersion.parse("0.10.0-dev.3034+6fab6c3e4") catch unreachable;
|
|
5
|
-
pub const zig_backend = std.builtin.CompilerBackend.stage1;
|
|
6
|
-
/// Temporary until self-hosted supports the `cpu.arch` value.
|
|
7
|
-
pub const stage2_arch: std.Target.Cpu.Arch = .wasm32;
|
|
8
|
-
|
|
9
|
-
pub const output_mode = std.builtin.OutputMode.Lib;
|
|
10
|
-
pub const link_mode = std.builtin.LinkMode.Dynamic;
|
|
11
|
-
pub const is_test = false;
|
|
12
|
-
pub const single_threaded = true;
|
|
13
|
-
pub const abi = std.Target.Abi.musl;
|
|
14
|
-
pub const cpu: std.Target.Cpu = .{
|
|
15
|
-
.arch = .wasm32,
|
|
16
|
-
.model = &std.Target.wasm.cpu.generic,
|
|
17
|
-
.features = std.Target.wasm.featureSet(&[_]std.Target.wasm.Feature{
|
|
18
|
-
}),
|
|
19
|
-
};
|
|
20
|
-
pub const os = std.Target.Os{
|
|
21
|
-
.tag = .freestanding,
|
|
22
|
-
.version_range = .{ .none = {} },
|
|
23
|
-
};
|
|
24
|
-
pub const target = std.Target{
|
|
25
|
-
.cpu = cpu,
|
|
26
|
-
.os = os,
|
|
27
|
-
.abi = abi,
|
|
28
|
-
};
|
|
29
|
-
pub const object_format = std.Target.ObjectFormat.wasm;
|
|
30
|
-
pub const mode = std.builtin.Mode.ReleaseSmall;
|
|
31
|
-
pub const link_libc = false;
|
|
32
|
-
pub const link_libcpp = false;
|
|
33
|
-
pub const have_error_return_tracing = false;
|
|
34
|
-
pub const valgrind_support = false;
|
|
35
|
-
pub const sanitize_thread = false;
|
|
36
|
-
pub const position_independent_code = true;
|
|
37
|
-
pub const position_independent_executable = false;
|
|
38
|
-
pub const strip_debug_info = true;
|
|
39
|
-
pub const code_model = std.builtin.CodeModel.default;
|