@thi.ng/wasm-api 1.4.9 → 1.4.11
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 +11 -1
- package/README.md +7 -36
- package/package.json +2 -2
- package/zig/build-v0.10.zig +141 -0
- package/zig/build.zig +110 -119
- package/zig/lib.zig +5 -5
- package/zig/managed-index.zig +2 -2
- package/zig/build-v0.11.zig +0 -128
- package/zig/zig-cache/h/1485f70b201450c74bc93d12fdc7fd01.txt +0 -0
- package/zig/zig-cache/h/e5c1e7746360b4e8cb7bef6cb6cfdeb6.txt +0 -0
- package/zig/zig-cache/h/timestamp +0 -0
- package/zig/zig-cache/o/2c5b3cc6481e0814680f4a94232505ec/dependencies.zig +0 -4
- package/zig/zig-cache/o/3badba3a6b220350270427b08f0d6826/builtin.zig +0 -115
- package/zig/zig-cache/o/436d1d779b9beb6e530e684e246a5d30/builtin.zig +0 -115
- package/zig/zig-cache/o/acdd995b96100aa4acdf8b4c71f8cc3f/dependencies.zig +0 -4
- package/zig/zig-cache/z/4eb978ee2352d5a0d2c0f9b62259aa42 +0 -0
- package/zig/zig-cache/z/638ca913ea12051c72064ed6b2f4f0a9 +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2023-06-
|
|
3
|
+
- **Last updated**: 2023-06-29T08:54:28Z
|
|
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,16 @@ 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
|
+
### [1.4.10](https://github.com/thi-ng/umbrella/tree/@thi.ng/wasm-api@1.4.10) (2023-06-29)
|
|
13
|
+
|
|
14
|
+
#### 🩹 Bug fixes
|
|
15
|
+
|
|
16
|
+
- temporarily disable `WasmLibOpts.out` due to Zig build updates ([cf63c04](https://github.com/thi-ng/umbrella/commit/cf63c04))
|
|
17
|
+
|
|
18
|
+
#### ♻️ Refactoring
|
|
19
|
+
|
|
20
|
+
- Zig v0.11-dev syntax updates ([83a1c7b](https://github.com/thi-ng/umbrella/commit/83a1c7b))
|
|
21
|
+
|
|
12
22
|
## [1.4.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/wasm-api@1.4.0) (2023-02-17)
|
|
13
23
|
|
|
14
24
|
#### 🚀 Features
|
package/README.md
CHANGED
|
@@ -16,7 +16,6 @@ This project is part of the
|
|
|
16
16
|
- [API module auto-initialization](#api-module-auto-initialization)
|
|
17
17
|
- [Object indices & handles](#object-indices--handles)
|
|
18
18
|
- [Using the Zig build system](#using-the-zig-build-system)
|
|
19
|
-
- [Zig v0.10.1 or older](#zig-v0101-or-older)
|
|
20
19
|
- [Zig v0.11.0-dev or newer](#zig-v0110-dev-or-newer)
|
|
21
20
|
- [Example projects](#example-projects)
|
|
22
21
|
- [Naming & structural conventions](#naming--structural-conventions)
|
|
@@ -312,44 +311,16 @@ This package provides utilities to simplify using hybrid TS/Zig WASM API modules
|
|
|
312
311
|
which are distributed as NPM packages. Using these utils, a build file for Zig's
|
|
313
312
|
built-in build system is as simple as:
|
|
314
313
|
|
|
315
|
-
### Zig v0.10.1 or older
|
|
316
|
-
|
|
317
|
-
```zig
|
|
318
|
-
const std = @import("std");
|
|
319
|
-
|
|
320
|
-
pub fn build(b: *std.build.Builder) void {
|
|
321
|
-
// obtain a standard std.build.LibExeObjStep, pre-configured w/ given options
|
|
322
|
-
// see source comments in imported build.zig for further details...
|
|
323
|
-
var lib = @import("node_modules/@thi.ng/wasm-api/zig/build.zig").wasmLib(b, .{
|
|
324
|
-
// Declare extra WASM API packages to use
|
|
325
|
-
// Each package can also declare dependencies to other such packages
|
|
326
|
-
// (wasm-api and wasm-api-bindgen are made available everywhere)
|
|
327
|
-
.packages = &.{
|
|
328
|
-
.{ .id = "wasm-api-dom", .path = "@thi.ng/wasm-api-dom/zig/lib.zig" },
|
|
329
|
-
.{ .id = "wasm-api-schedule", .path = "@thi.ng/wasm-api-schedule/zig/lib.zig" },
|
|
330
|
-
},
|
|
331
|
-
// (optional) build mode override
|
|
332
|
-
// if commented out, we can pass CLI args to choose build mode (default: .Debug)
|
|
333
|
-
.mode = .ReleaseSmall,
|
|
334
|
-
});
|
|
335
|
-
// optionally, add further custom configuration
|
|
336
|
-
// ...
|
|
337
|
-
|
|
338
|
-
// finally trigger build
|
|
339
|
-
lib.install();
|
|
340
|
-
}
|
|
341
|
-
```
|
|
342
|
-
|
|
343
314
|
### Zig v0.11.0-dev or newer
|
|
344
315
|
|
|
345
|
-
|
|
346
|
-
|
|
316
|
+
**IMPORTANT:** Due to recent syntax changes in Zig v0.11-dev, support for Zig
|
|
317
|
+
v0.10.1 or older had to be removed...
|
|
347
318
|
|
|
348
319
|
```zig
|
|
349
320
|
const std = @import("std");
|
|
350
321
|
|
|
351
322
|
pub fn build(b: *std.Build) void {
|
|
352
|
-
// obtain a standard std.Build.
|
|
323
|
+
// obtain a standard std.Build.Step.Compile, pre-configured w/ given options
|
|
353
324
|
// see source comments in imported build-v0.11.zig for further details...
|
|
354
325
|
var lib = @import("node_modules/@thi.ng/wasm-api/zig/build-v0.11.zig").wasmLib(b, .{
|
|
355
326
|
// Declare extra WASM API modules to use
|
|
@@ -366,8 +337,8 @@ pub fn build(b: *std.Build) void {
|
|
|
366
337
|
// optionally, add further custom configuration
|
|
367
338
|
// ...
|
|
368
339
|
|
|
369
|
-
// finally trigger build
|
|
370
|
-
|
|
340
|
+
// finally trigger build & install
|
|
341
|
+
b.installArtifact(lib);
|
|
371
342
|
}
|
|
372
343
|
```
|
|
373
344
|
|
|
@@ -378,7 +349,7 @@ via this script. **Please find more details/options in the commented source
|
|
|
378
349
|
code:**
|
|
379
350
|
|
|
380
351
|
- [`/zig/build.zig`](https://github.com/thi-ng/umbrella/blob/develop/packages/wasm-api/zig/build.zig)
|
|
381
|
-
- [`/zig/build-v0.
|
|
352
|
+
- [`/zig/build-v0.10.zig`](https://github.com/thi-ng/umbrella/blob/develop/packages/wasm-api/zig/build-v0.10.zig)
|
|
382
353
|
|
|
383
354
|
## Naming & structural conventions
|
|
384
355
|
|
|
@@ -501,7 +472,7 @@ folder):
|
|
|
501
472
|
zig build-lib \
|
|
502
473
|
--pkg-begin wasm-api node_modules/@thi.ng/wasm-api/zig/lib.zig --pkg-end \
|
|
503
474
|
-target wasm32-freestanding \
|
|
504
|
-
-O ReleaseSmall -dynamic \
|
|
475
|
+
-O ReleaseSmall -dynamic -rdynamic \
|
|
505
476
|
hello.zig
|
|
506
477
|
|
|
507
478
|
# disassemble WASM
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/wasm-api",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.11",
|
|
4
4
|
"description": "Generic, modular, extensible API bridge and infrastructure for hybrid JS & WebAssembly projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"status": "alpha",
|
|
116
116
|
"year": 2022
|
|
117
117
|
},
|
|
118
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "b363e93fb1b9e754957309ab582bba16b8e187ca\n"
|
|
119
119
|
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
//! DEPRECATED build helpers for using modules/packages distributed via NPM
|
|
2
|
+
//! Intended for use with https://thi.ng/wasm-api and support packages
|
|
3
|
+
//!
|
|
4
|
+
//! This version of the script is only compatible with Zig v0.10.1 or older
|
|
5
|
+
//! Use build-v0.11.zig (in this same directory) for newer Zig versions
|
|
6
|
+
|
|
7
|
+
const std = @import("std");
|
|
8
|
+
|
|
9
|
+
/// Definition for a (usually hybrid) Zig package which will be distributed via NPM
|
|
10
|
+
pub const Pkg = struct {
|
|
11
|
+
/// Package ID used for @import
|
|
12
|
+
id: []const u8,
|
|
13
|
+
/// Package sub path (appended to base path)
|
|
14
|
+
path: []const u8,
|
|
15
|
+
/// Package dependencies aka other package IDs.
|
|
16
|
+
/// All of them must already have been registered
|
|
17
|
+
deps: ?[]const []const u8 = null,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
pub const PkgOpts = struct {
|
|
21
|
+
/// Base path to common node_modules directory under which
|
|
22
|
+
/// all to be imported packages are located
|
|
23
|
+
base: []const u8 = "node_modules",
|
|
24
|
+
/// Additional WASM API support packages.
|
|
25
|
+
/// We don't need to specify core wasmapi, only custom/extra ones
|
|
26
|
+
/// `wasm-api` and `wasm-api-bindgen` are also auto-added
|
|
27
|
+
/// as dependency for each of these...
|
|
28
|
+
packages: ?[]const Pkg = null,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/// Dependency graph for WASM API packages
|
|
32
|
+
/// Expands & resolves the more compact/convenient/human friendly format of PkgOpts
|
|
33
|
+
/// into the data structures used by Zig's build system
|
|
34
|
+
/// Provides a `addAllTo()` function to add all declared packages to a build step
|
|
35
|
+
pub const PkgGraph = struct {
|
|
36
|
+
arena: std.heap.ArenaAllocator,
|
|
37
|
+
basePath: []const u8,
|
|
38
|
+
packages: std.StringArrayHashMap(std.build.Pkg),
|
|
39
|
+
|
|
40
|
+
const Self = @This();
|
|
41
|
+
|
|
42
|
+
pub fn init(opts: PkgOpts) Self {
|
|
43
|
+
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
|
|
44
|
+
var self = Self{
|
|
45
|
+
.arena = arena,
|
|
46
|
+
.basePath = opts.base,
|
|
47
|
+
.packages = std.StringArrayHashMap(std.build.Pkg).init(arena.allocator()),
|
|
48
|
+
};
|
|
49
|
+
const api = "wasm-api";
|
|
50
|
+
self.packages.put(api, .{
|
|
51
|
+
.name = api,
|
|
52
|
+
.source = .{ .path = self.modulePath("@thi.ng/wasm-api/zig/lib.zig") },
|
|
53
|
+
}) catch unreachable;
|
|
54
|
+
const apiTypes = "wasm-api-bindgen";
|
|
55
|
+
self.packages.put(apiTypes, .{
|
|
56
|
+
.name = apiTypes,
|
|
57
|
+
.source = .{ .path = self.modulePath("@thi.ng/wasm-api-bindgen/zig/lib.zig") },
|
|
58
|
+
}) catch unreachable;
|
|
59
|
+
if (opts.packages) |pkgs| {
|
|
60
|
+
for (pkgs) |pkg| {
|
|
61
|
+
self.register(pkg.id, pkg.path, pkg.deps);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return self;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
pub fn deinit(self: *const Self) void {
|
|
68
|
+
self.arena.deinit();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/// Registers a single package and its deps (also injects core wasm-api deps)
|
|
72
|
+
pub fn register(
|
|
73
|
+
self: *Self,
|
|
74
|
+
name: []const u8,
|
|
75
|
+
path: []const u8,
|
|
76
|
+
dependencies: ?[]const []const u8,
|
|
77
|
+
) void {
|
|
78
|
+
var pkg = std.build.Pkg{
|
|
79
|
+
.name = name,
|
|
80
|
+
.source = .{ .path = self.modulePath(path) },
|
|
81
|
+
};
|
|
82
|
+
const num = if (dependencies) |deps| deps.len else 0;
|
|
83
|
+
var dpkgs = self.arena.allocator().alloc(std.build.Pkg, num + 2) catch unreachable;
|
|
84
|
+
dpkgs[0] = if (self.packages.get("wasm-api")) |p| p else unreachable;
|
|
85
|
+
dpkgs[1] = if (self.packages.get("wasm-api-bindgen")) |p| p else unreachable;
|
|
86
|
+
if (dependencies) |deps| {
|
|
87
|
+
var i: usize = 0;
|
|
88
|
+
while (i < deps.len) : (i += 1) {
|
|
89
|
+
if (self.packages.get(deps[i])) |p| {
|
|
90
|
+
dpkgs[i + 1] = p;
|
|
91
|
+
} else @panic("unknown dependency");
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
pkg.dependencies = dpkgs;
|
|
95
|
+
self.packages.put(name, pkg) catch unreachable;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/// Adds all registered packages to the given build step
|
|
99
|
+
pub fn addAllTo(self: *const Self, step: *std.build.LibExeObjStep) void {
|
|
100
|
+
for (self.packages.values()) |pkg| step.addPackage(pkg);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
fn modulePath(self: *Self, path: []const u8) []const u8 {
|
|
104
|
+
return std.fs.path.join(self.arena.allocator(), &.{ self.basePath, path }) catch unreachable;
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
/// Config options
|
|
109
|
+
pub const WasmLibOpts = struct {
|
|
110
|
+
/// Relative path to base directory for WASM API packages
|
|
111
|
+
base: []const u8 = "node_modules",
|
|
112
|
+
/// Relative path to root source file
|
|
113
|
+
root: []const u8 = "zig/main.zig",
|
|
114
|
+
/// Relative path to output directory
|
|
115
|
+
out: []const u8 = "src",
|
|
116
|
+
/// Package definitions for additional WASM API modules
|
|
117
|
+
packages: ?[]const Pkg = null,
|
|
118
|
+
/// Build mode override (else allows config via CLI args)
|
|
119
|
+
mode: ?std.builtin.Mode = null,
|
|
120
|
+
/// Additional WASM target features, e.g. `.simd128` to enable SIMD
|
|
121
|
+
features: ?[]const std.Target.wasm.Feature = null,
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/// Creates and returns a build step to build a dynamic WASM library, configured
|
|
125
|
+
/// with given options and package declarations. The given package specs will be inserted
|
|
126
|
+
pub fn wasmLib(b: *std.build.Builder, opts: WasmLibOpts) *std.build.LibExeObjStep {
|
|
127
|
+
const lib = b.addSharedLibrary("main", opts.root, .unversioned);
|
|
128
|
+
lib.setTarget(.{
|
|
129
|
+
.cpu_arch = .wasm32,
|
|
130
|
+
.os_tag = .freestanding,
|
|
131
|
+
.cpu_features_add = if (opts.features) |features| std.Target.wasm.featureSet(features) else std.Target.Cpu.Feature.Set.empty,
|
|
132
|
+
});
|
|
133
|
+
const mode = if (opts.mode) |m| m else b.standardReleaseOptions();
|
|
134
|
+
lib.setBuildMode(mode);
|
|
135
|
+
if (mode == .ReleaseSmall or mode == .ReleaseFast) lib.strip = true;
|
|
136
|
+
const pkgs = PkgGraph.init(.{ .base = opts.base, .packages = opts.packages });
|
|
137
|
+
defer pkgs.deinit();
|
|
138
|
+
pkgs.addAllTo(lib);
|
|
139
|
+
lib.setOutputDir(opts.out);
|
|
140
|
+
return lib;
|
|
141
|
+
}
|
package/zig/build.zig
CHANGED
|
@@ -1,141 +1,132 @@
|
|
|
1
1
|
//! Build helpers for using modules/packages distributed via NPM
|
|
2
2
|
//! Intended for use with https://thi.ng/wasm-api and support packages
|
|
3
3
|
//!
|
|
4
|
-
//! This version of the script is only compatible with
|
|
5
|
-
//!
|
|
4
|
+
//! This version of the script is only compatible with:
|
|
5
|
+
//! Zig v0.11.0-dev.2266+49e33a2f2 or newer
|
|
6
|
+
//!
|
|
7
|
+
//! Use build.zig (in this same directory) for earlier Zig versions
|
|
6
8
|
|
|
7
9
|
const std = @import("std");
|
|
8
|
-
|
|
9
|
-
/// Definition for a (usually hybrid) Zig package which will be distributed via NPM
|
|
10
|
-
pub const Pkg = struct {
|
|
11
|
-
/// Package ID used for @import
|
|
12
|
-
id: []const u8,
|
|
13
|
-
/// Package sub path (appended to base path)
|
|
14
|
-
path: []const u8,
|
|
15
|
-
/// Package dependencies aka other package IDs.
|
|
16
|
-
/// All of them must already have been registered
|
|
17
|
-
deps: ?[]const []const u8 = null,
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
pub const PkgOpts = struct {
|
|
21
|
-
/// Base path to common node_modules directory under which
|
|
22
|
-
/// all to be imported packages are located
|
|
23
|
-
base: []const u8 = "node_modules",
|
|
24
|
-
/// Additional WASM API support packages.
|
|
25
|
-
/// We don't need to specify core wasmapi, only custom/extra ones
|
|
26
|
-
/// `wasm-api` and `wasm-api-bindgen` are also auto-added
|
|
27
|
-
/// as dependency for each of these...
|
|
28
|
-
packages: ?[]const Pkg = null,
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
/// Dependency graph for WASM API packages
|
|
32
|
-
/// Expands & resolves the more compact/convenient/human friendly format of PkgOpts
|
|
33
|
-
/// into the data structures used by Zig's build system
|
|
34
|
-
/// Provides a `addAllTo()` function to add all declared packages to a build step
|
|
35
|
-
pub const PkgGraph = struct {
|
|
36
|
-
arena: std.heap.ArenaAllocator,
|
|
37
|
-
basePath: []const u8,
|
|
38
|
-
packages: std.StringArrayHashMap(std.build.Pkg),
|
|
39
|
-
|
|
40
|
-
const Self = @This();
|
|
41
|
-
|
|
42
|
-
pub fn init(opts: PkgOpts) Self {
|
|
43
|
-
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
|
|
44
|
-
var self = Self{
|
|
45
|
-
.arena = arena,
|
|
46
|
-
.basePath = opts.base,
|
|
47
|
-
.packages = std.StringArrayHashMap(std.build.Pkg).init(arena.allocator()),
|
|
48
|
-
};
|
|
49
|
-
const api = "wasm-api";
|
|
50
|
-
self.packages.put(api, .{
|
|
51
|
-
.name = api,
|
|
52
|
-
.source = .{ .path = self.modulePath("@thi.ng/wasm-api/zig/lib.zig") },
|
|
53
|
-
}) catch unreachable;
|
|
54
|
-
const apiTypes = "wasm-api-bindgen";
|
|
55
|
-
self.packages.put(apiTypes, .{
|
|
56
|
-
.name = apiTypes,
|
|
57
|
-
.source = .{ .path = self.modulePath("@thi.ng/wasm-api-bindgen/zig/lib.zig") },
|
|
58
|
-
}) catch unreachable;
|
|
59
|
-
if (opts.packages) |pkgs| {
|
|
60
|
-
for (pkgs) |pkg| {
|
|
61
|
-
self.register(pkg.id, pkg.path, pkg.deps);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
return self;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
pub fn deinit(self: *const Self) void {
|
|
68
|
-
self.arena.deinit();
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/// Registers a single package and its deps (also injects core wasm-api deps)
|
|
72
|
-
pub fn register(
|
|
73
|
-
self: *Self,
|
|
74
|
-
name: []const u8,
|
|
75
|
-
path: []const u8,
|
|
76
|
-
dependencies: ?[]const []const u8,
|
|
77
|
-
) void {
|
|
78
|
-
var pkg = std.build.Pkg{
|
|
79
|
-
.name = name,
|
|
80
|
-
.source = .{ .path = self.modulePath(path) },
|
|
81
|
-
};
|
|
82
|
-
const num = if (dependencies) |deps| deps.len else 0;
|
|
83
|
-
var dpkgs = self.arena.allocator().alloc(std.build.Pkg, num + 2) catch unreachable;
|
|
84
|
-
dpkgs[0] = if (self.packages.get("wasm-api")) |p| p else unreachable;
|
|
85
|
-
dpkgs[1] = if (self.packages.get("wasm-api-bindgen")) |p| p else unreachable;
|
|
86
|
-
if (dependencies) |deps| {
|
|
87
|
-
var i: usize = 0;
|
|
88
|
-
while (i < deps.len) : (i += 1) {
|
|
89
|
-
if (self.packages.get(deps[i])) |p| {
|
|
90
|
-
dpkgs[i + 1] = p;
|
|
91
|
-
} else @panic("unknown dependency");
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
pkg.dependencies = dpkgs;
|
|
95
|
-
self.packages.put(name, pkg) catch unreachable;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/// Adds all registered packages to the given build step
|
|
99
|
-
pub fn addAllTo(self: *const Self, step: *std.build.LibExeObjStep) void {
|
|
100
|
-
for (self.packages.values()) |pkg| step.addPackage(pkg);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
fn modulePath(self: *Self, path: []const u8) []const u8 {
|
|
104
|
-
return std.fs.path.join(self.arena.allocator(), &.{ self.basePath, path }) catch unreachable;
|
|
105
|
-
}
|
|
106
|
-
};
|
|
10
|
+
const Build = std.Build;
|
|
107
11
|
|
|
108
12
|
/// Config options
|
|
109
13
|
pub const WasmLibOpts = struct {
|
|
110
|
-
///
|
|
14
|
+
/// Base path to common node_modules directory under which
|
|
15
|
+
/// all to be imported modules are located
|
|
111
16
|
base: []const u8 = "node_modules",
|
|
112
17
|
/// Relative path to root source file
|
|
113
18
|
root: []const u8 = "zig/main.zig",
|
|
114
|
-
/// Relative path to output directory
|
|
19
|
+
/// CURRENTLY UNUSED - Relative path to output directory
|
|
115
20
|
out: []const u8 = "src",
|
|
116
|
-
///
|
|
117
|
-
|
|
21
|
+
/// Additional WASM API support modules.
|
|
22
|
+
/// Only need to specify custom/extra modules
|
|
23
|
+
/// `wasm-api` and `wasm-api-bindgen` are auto-added as dependency for all...
|
|
24
|
+
modules: ?[]const ModuleSpec = null,
|
|
118
25
|
/// Build mode override (else allows config via CLI args)
|
|
119
|
-
|
|
26
|
+
optimize: ?std.builtin.Mode = null,
|
|
120
27
|
/// Additional WASM target features, e.g. `.simd128` to enable SIMD
|
|
121
28
|
features: ?[]const std.Target.wasm.Feature = null,
|
|
29
|
+
/// Initial memory (in bytes, MUST be multiple of 0x10000)
|
|
30
|
+
initialMemory: ?u64 = null,
|
|
31
|
+
/// Max memory (in bytes, MUST be multiple of 0x10000)
|
|
32
|
+
maxMemory: ?u64 = null,
|
|
33
|
+
/// If true, build will also generate docs
|
|
34
|
+
docs: bool = false,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/// WASM API sub-module declaration
|
|
38
|
+
pub const ModuleSpec = struct {
|
|
39
|
+
/// module import name/ID
|
|
40
|
+
name: []const u8,
|
|
41
|
+
/// Relative path to configured base path
|
|
42
|
+
path: []const u8,
|
|
43
|
+
/// Module IDs of other modules this module depends on
|
|
44
|
+
/// Only need to specify custom/extra modules
|
|
45
|
+
/// `wasm-api` and `wasm-api-bindgen` are auto-added as dependency for all...
|
|
46
|
+
dependencies: ?[]const []const u8 = null,
|
|
122
47
|
};
|
|
123
48
|
|
|
49
|
+
const wasmapi = "wasm-api";
|
|
50
|
+
const wasmbind = "wasm-api-bindgen";
|
|
51
|
+
|
|
124
52
|
/// Creates and returns a build step to build a dynamic WASM library, configured
|
|
125
53
|
/// with given options and package declarations. The given package specs will be inserted
|
|
126
|
-
pub fn wasmLib(b: *
|
|
127
|
-
const lib = b.addSharedLibrary(
|
|
128
|
-
|
|
129
|
-
.
|
|
130
|
-
.
|
|
131
|
-
|
|
54
|
+
pub fn wasmLib(b: *Build, opts: WasmLibOpts) *Build.Step.Compile {
|
|
55
|
+
const lib = b.addSharedLibrary(.{
|
|
56
|
+
.name = "main",
|
|
57
|
+
.root_source_file = .{ .path = opts.root },
|
|
58
|
+
.target = .{
|
|
59
|
+
.cpu_arch = .wasm32,
|
|
60
|
+
.os_tag = .freestanding,
|
|
61
|
+
.cpu_features_add = if (opts.features) |features| std.Target.wasm.featureSet(features) else std.Target.Cpu.Feature.Set.empty,
|
|
62
|
+
},
|
|
63
|
+
.optimize = if (opts.optimize) |m| m else b.standardOptimizeOption(.{}),
|
|
132
64
|
});
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
lib.
|
|
65
|
+
if (lib.optimize == .ReleaseSmall or lib.optimize == .ReleaseFast) lib.strip = true;
|
|
66
|
+
|
|
67
|
+
// FIXME re-enable once workaround has been identified
|
|
68
|
+
// lib.setOutputDir(opts.out);
|
|
69
|
+
|
|
70
|
+
// build flags
|
|
71
|
+
lib.rdynamic = true;
|
|
72
|
+
lib.import_symbols = true;
|
|
73
|
+
lib.initial_memory = opts.initialMemory;
|
|
74
|
+
lib.max_memory = opts.maxMemory;
|
|
75
|
+
if (opts.docs) lib.emit_docs = .emit;
|
|
76
|
+
|
|
77
|
+
// add default dependencies
|
|
78
|
+
lib.addModule(
|
|
79
|
+
wasmapi,
|
|
80
|
+
b.createModule(.{
|
|
81
|
+
.source_file = modulePath(b.allocator, opts.base, "@thi.ng/wasm-api/zig/lib.zig"),
|
|
82
|
+
}),
|
|
83
|
+
);
|
|
84
|
+
lib.addModule(
|
|
85
|
+
wasmbind,
|
|
86
|
+
b.createModule(.{
|
|
87
|
+
.source_file = modulePath(b.allocator, opts.base, "@thi.ng/wasm-api-bindgen/zig/lib.zig"),
|
|
88
|
+
}),
|
|
89
|
+
);
|
|
90
|
+
if (opts.modules) |modules| {
|
|
91
|
+
for (modules) |mod| {
|
|
92
|
+
register(lib, mod, opts);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
140
95
|
return lib;
|
|
141
96
|
}
|
|
97
|
+
|
|
98
|
+
/// Registers a single package and its deps (also injects core wasm-api deps)
|
|
99
|
+
pub fn register(step: *Build.CompileStep, mod: ModuleSpec, opts: WasmLibOpts) void {
|
|
100
|
+
const num = if (mod.dependencies) |ids| ids.len else 0;
|
|
101
|
+
var dpkgs = step.step.owner.allocator.alloc(Build.ModuleDependency, num + 2) catch unreachable;
|
|
102
|
+
dpkgs[0] = if (step.modules.get(wasmapi)) |m| .{ .name = wasmapi, .module = m } else unreachable;
|
|
103
|
+
dpkgs[1] = if (step.modules.get(wasmbind)) |m| .{ .name = wasmbind, .module = m } else unreachable;
|
|
104
|
+
var i: usize = 2;
|
|
105
|
+
if (mod.dependencies) |ids| {
|
|
106
|
+
for (ids) |id| {
|
|
107
|
+
if (step.modules.get(id)) |m| {
|
|
108
|
+
if (isDuplicateId(dpkgs[0..i], id)) {
|
|
109
|
+
std.log.info("ignoring duplicate dependency: {s}", .{id});
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
dpkgs[i] = .{ .name = id, .module = m };
|
|
113
|
+
i += 1;
|
|
114
|
+
} else @panic("unknown dependency");
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
step.addModule(mod.name, step.step.owner.createModule(.{
|
|
118
|
+
.source_file = modulePath(step.step.owner.allocator, opts.base, mod.path),
|
|
119
|
+
.dependencies = dpkgs[0..i],
|
|
120
|
+
}));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
fn isDuplicateId(deps: []Build.ModuleDependency, name: []const u8) bool {
|
|
124
|
+
for (deps) |d| {
|
|
125
|
+
if (std.mem.eql(u8, d.name, name)) return true;
|
|
126
|
+
}
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
fn modulePath(allocator: std.mem.Allocator, base: []const u8, path: []const u8) Build.FileSource {
|
|
131
|
+
return .{ .path = std.fs.path.join(allocator, &.{ base, path }) catch unreachable };
|
|
132
|
+
}
|
package/zig/lib.zig
CHANGED
|
@@ -13,7 +13,7 @@ pub fn ptrCast(comptime T: type, ptr: ?*anyopaque) ?T {
|
|
|
13
13
|
if (ptr == null) return null;
|
|
14
14
|
const info = @typeInfo(T);
|
|
15
15
|
if (info != .Pointer) @compileError("require pointer type");
|
|
16
|
-
return @ptrCast(
|
|
16
|
+
return @ptrCast(@alignCast(ptr));
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/// JS external part of the custom panic handler
|
|
@@ -52,7 +52,7 @@ pub inline fn allocator() ?std.mem.Allocator {
|
|
|
52
52
|
pub export fn _wasm_allocate(numBytes: usize) usize {
|
|
53
53
|
if (allocator()) |alloc| {
|
|
54
54
|
var mem = alloc.alignedAlloc(u8, 16, numBytes) catch return 0;
|
|
55
|
-
return @
|
|
55
|
+
return @intFromPtr(mem.ptr);
|
|
56
56
|
}
|
|
57
57
|
return 0;
|
|
58
58
|
}
|
|
@@ -62,8 +62,8 @@ pub export fn _wasm_allocate(numBytes: usize) usize {
|
|
|
62
62
|
/// Note: This is a no-op if no allocator is configured (see `allocator()`)
|
|
63
63
|
pub export fn _wasm_free(addr: [*]u8, numBytes: usize) void {
|
|
64
64
|
if (allocator()) |alloc| {
|
|
65
|
-
var mem = [2]usize{ @
|
|
66
|
-
alloc.free(@
|
|
65
|
+
var mem = [2]usize{ @intFromPtr(addr), numBytes };
|
|
66
|
+
alloc.free(@as(*[]u8, @ptrCast(&mem)).*);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -102,7 +102,7 @@ pub extern "wasmapi" fn printF64(x: f64) void;
|
|
|
102
102
|
|
|
103
103
|
/// Prints pointer as hex number using configured JS logger
|
|
104
104
|
pub fn printPtr(ptr: *const anyopaque) void {
|
|
105
|
-
printU32Hex(@
|
|
105
|
+
printU32Hex(@intFromPtr(ptr));
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
/// Prints number array using configured JS logger
|
package/zig/managed-index.zig
CHANGED
|
@@ -68,12 +68,12 @@ pub fn ManagedIndex(comptime T: type, comptime I: type) type {
|
|
|
68
68
|
self.freeID = self.list.items[id].id;
|
|
69
69
|
self.list.items[id] = .{ .value = item };
|
|
70
70
|
self.used += 1;
|
|
71
|
-
return @intCast(
|
|
71
|
+
return @intCast(id);
|
|
72
72
|
} else {
|
|
73
73
|
const id = self.list.items.len;
|
|
74
74
|
try self.list.append(.{ .value = item });
|
|
75
75
|
self.used += 1;
|
|
76
|
-
return @intCast(
|
|
76
|
+
return @intCast(id);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
|
package/zig/build-v0.11.zig
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
//! Build helpers for using modules/packages distributed via NPM
|
|
2
|
-
//! Intended for use with https://thi.ng/wasm-api and support packages
|
|
3
|
-
//!
|
|
4
|
-
//! This version of the script is only compatible with:
|
|
5
|
-
//! Zig v0.11.0-dev.2266+49e33a2f2 or newer
|
|
6
|
-
//!
|
|
7
|
-
//! Use build.zig (in this same directory) for earlier Zig versions
|
|
8
|
-
|
|
9
|
-
const std = @import("std");
|
|
10
|
-
const Build = std.Build;
|
|
11
|
-
|
|
12
|
-
/// Config options
|
|
13
|
-
pub const WasmLibOpts = struct {
|
|
14
|
-
/// Base path to common node_modules directory under which
|
|
15
|
-
/// all to be imported modules are located
|
|
16
|
-
base: []const u8 = "node_modules",
|
|
17
|
-
/// Relative path to root source file
|
|
18
|
-
root: []const u8 = "zig/main.zig",
|
|
19
|
-
/// Relative path to output directory
|
|
20
|
-
out: []const u8 = "src",
|
|
21
|
-
/// Additional WASM API support modules.
|
|
22
|
-
/// Only need to specify custom/extra modules
|
|
23
|
-
/// `wasm-api` and `wasm-api-bindgen` are auto-added as dependency for all...
|
|
24
|
-
modules: ?[]const ModuleSpec = null,
|
|
25
|
-
/// Build mode override (else allows config via CLI args)
|
|
26
|
-
optimize: ?std.builtin.Mode = null,
|
|
27
|
-
/// Additional WASM target features, e.g. `.simd128` to enable SIMD
|
|
28
|
-
features: ?[]const std.Target.wasm.Feature = null,
|
|
29
|
-
/// Initial memory (in bytes, MUST be multiple of 0x10000)
|
|
30
|
-
initialMemory: ?u64 = null,
|
|
31
|
-
/// Max memory (in bytes, MUST be multiple of 0x10000)
|
|
32
|
-
maxMemory: ?u64 = null,
|
|
33
|
-
/// If true, build will also generate docs
|
|
34
|
-
docs: bool = false,
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
/// WASM API sub-module declaration
|
|
38
|
-
pub const ModuleSpec = struct {
|
|
39
|
-
/// module import name/ID
|
|
40
|
-
name: []const u8,
|
|
41
|
-
/// Relative path to configured base path
|
|
42
|
-
path: []const u8,
|
|
43
|
-
/// Module IDs of other modules this module depends on
|
|
44
|
-
/// Only need to specify custom/extra modules
|
|
45
|
-
/// `wasm-api` and `wasm-api-bindgen` are auto-added as dependency for all...
|
|
46
|
-
dependencies: ?[]const []const u8 = null,
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const wasmapi = "wasm-api";
|
|
50
|
-
const wasmbind = "wasm-api-bindgen";
|
|
51
|
-
|
|
52
|
-
/// Creates and returns a build step to build a dynamic WASM library, configured
|
|
53
|
-
/// with given options and package declarations. The given package specs will be inserted
|
|
54
|
-
pub fn wasmLib(b: *Build, opts: WasmLibOpts) *Build.CompileStep {
|
|
55
|
-
const lib = b.addSharedLibrary(.{
|
|
56
|
-
.name = "main",
|
|
57
|
-
.root_source_file = .{ .path = opts.root },
|
|
58
|
-
.target = .{
|
|
59
|
-
.cpu_arch = .wasm32,
|
|
60
|
-
.os_tag = .freestanding,
|
|
61
|
-
.cpu_features_add = if (opts.features) |features| std.Target.wasm.featureSet(features) else std.Target.Cpu.Feature.Set.empty,
|
|
62
|
-
},
|
|
63
|
-
.optimize = if (opts.optimize) |m| m else b.standardOptimizeOption(.{}),
|
|
64
|
-
});
|
|
65
|
-
if (lib.optimize == .ReleaseSmall or lib.optimize == .ReleaseFast) lib.strip = true;
|
|
66
|
-
lib.setOutputDir(opts.out);
|
|
67
|
-
// build flags
|
|
68
|
-
lib.rdynamic = true;
|
|
69
|
-
lib.import_symbols = true;
|
|
70
|
-
lib.initial_memory = opts.initialMemory;
|
|
71
|
-
lib.max_memory = opts.maxMemory;
|
|
72
|
-
if (opts.docs) lib.emit_docs = .emit;
|
|
73
|
-
// add default dependencies
|
|
74
|
-
lib.addModule(
|
|
75
|
-
wasmapi,
|
|
76
|
-
b.createModule(.{
|
|
77
|
-
.source_file = modulePath(b.allocator, opts.base, "@thi.ng/wasm-api/zig/lib.zig"),
|
|
78
|
-
}),
|
|
79
|
-
);
|
|
80
|
-
lib.addModule(
|
|
81
|
-
wasmbind,
|
|
82
|
-
b.createModule(.{
|
|
83
|
-
.source_file = modulePath(b.allocator, opts.base, "@thi.ng/wasm-api-bindgen/zig/lib.zig"),
|
|
84
|
-
}),
|
|
85
|
-
);
|
|
86
|
-
if (opts.modules) |modules| {
|
|
87
|
-
for (modules) |mod| {
|
|
88
|
-
register(lib, mod, opts);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return lib;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/// Registers a single package and its deps (also injects core wasm-api deps)
|
|
95
|
-
pub fn register(step: *Build.CompileStep, mod: ModuleSpec, opts: WasmLibOpts) void {
|
|
96
|
-
const num = if (mod.dependencies) |ids| ids.len else 0;
|
|
97
|
-
var dpkgs = step.step.owner.allocator.alloc(Build.ModuleDependency, num + 2) catch unreachable;
|
|
98
|
-
dpkgs[0] = if (step.modules.get(wasmapi)) |m| .{ .name = wasmapi, .module = m } else unreachable;
|
|
99
|
-
dpkgs[1] = if (step.modules.get(wasmbind)) |m| .{ .name = wasmbind, .module = m } else unreachable;
|
|
100
|
-
var i: usize = 2;
|
|
101
|
-
if (mod.dependencies) |ids| {
|
|
102
|
-
for (ids) |id| {
|
|
103
|
-
if (step.modules.get(id)) |m| {
|
|
104
|
-
if (isDuplicateId(dpkgs[0..i], id)) {
|
|
105
|
-
std.log.info("ignoring duplicate dependency: {s}", .{id});
|
|
106
|
-
continue;
|
|
107
|
-
}
|
|
108
|
-
dpkgs[i] = .{ .name = id, .module = m };
|
|
109
|
-
i += 1;
|
|
110
|
-
} else @panic("unknown dependency");
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
step.addModule(mod.name, step.step.owner.createModule(.{
|
|
114
|
-
.source_file = modulePath(step.step.owner.allocator, opts.base, mod.path),
|
|
115
|
-
.dependencies = dpkgs[0..i],
|
|
116
|
-
}));
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
fn isDuplicateId(deps: []Build.ModuleDependency, name: []const u8) bool {
|
|
120
|
-
for (deps) |d| {
|
|
121
|
-
if (std.mem.eql(u8, d.name, name)) return true;
|
|
122
|
-
}
|
|
123
|
-
return false;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
fn modulePath(allocator: std.mem.Allocator, base: []const u8, path: []const u8) Build.FileSource {
|
|
127
|
-
return .{ .path = std.fs.path.join(allocator, &.{ base, path }) catch unreachable };
|
|
128
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,115 +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(zig_version_string) catch unreachable;
|
|
5
|
-
pub const zig_version_string = "0.11.0-dev.2271+3a7fe0d01";
|
|
6
|
-
pub const zig_backend = std.builtin.CompilerBackend.stage2_llvm;
|
|
7
|
-
|
|
8
|
-
pub const output_mode = std.builtin.OutputMode.Exe;
|
|
9
|
-
pub const link_mode = std.builtin.LinkMode.Dynamic;
|
|
10
|
-
pub const is_test = false;
|
|
11
|
-
pub const single_threaded = false;
|
|
12
|
-
pub const abi = std.Target.Abi.none;
|
|
13
|
-
pub const cpu: std.Target.Cpu = .{
|
|
14
|
-
.arch = .aarch64,
|
|
15
|
-
.model = &std.Target.aarch64.cpu.apple_a14,
|
|
16
|
-
.features = std.Target.aarch64.featureSet(&[_]std.Target.aarch64.Feature{
|
|
17
|
-
.aes,
|
|
18
|
-
.aggressive_fma,
|
|
19
|
-
.alternate_sextload_cvt_f32_pattern,
|
|
20
|
-
.altnzcv,
|
|
21
|
-
.am,
|
|
22
|
-
.arith_bcc_fusion,
|
|
23
|
-
.arith_cbz_fusion,
|
|
24
|
-
.ccdp,
|
|
25
|
-
.ccidx,
|
|
26
|
-
.ccpp,
|
|
27
|
-
.complxnum,
|
|
28
|
-
.contextidr_el2,
|
|
29
|
-
.crc,
|
|
30
|
-
.crypto,
|
|
31
|
-
.disable_latency_sched_heuristic,
|
|
32
|
-
.dit,
|
|
33
|
-
.dotprod,
|
|
34
|
-
.el2vmsa,
|
|
35
|
-
.el3,
|
|
36
|
-
.flagm,
|
|
37
|
-
.fp16fml,
|
|
38
|
-
.fp_armv8,
|
|
39
|
-
.fptoint,
|
|
40
|
-
.fullfp16,
|
|
41
|
-
.fuse_address,
|
|
42
|
-
.fuse_adrp_add,
|
|
43
|
-
.fuse_aes,
|
|
44
|
-
.fuse_arith_logic,
|
|
45
|
-
.fuse_crypto_eor,
|
|
46
|
-
.fuse_csel,
|
|
47
|
-
.fuse_literals,
|
|
48
|
-
.jsconv,
|
|
49
|
-
.lor,
|
|
50
|
-
.lse,
|
|
51
|
-
.lse2,
|
|
52
|
-
.mpam,
|
|
53
|
-
.neon,
|
|
54
|
-
.nv,
|
|
55
|
-
.pan,
|
|
56
|
-
.pan_rwv,
|
|
57
|
-
.pauth,
|
|
58
|
-
.perfmon,
|
|
59
|
-
.predres,
|
|
60
|
-
.ras,
|
|
61
|
-
.rcpc,
|
|
62
|
-
.rcpc_immo,
|
|
63
|
-
.rdm,
|
|
64
|
-
.sb,
|
|
65
|
-
.sel2,
|
|
66
|
-
.sha2,
|
|
67
|
-
.sha3,
|
|
68
|
-
.specrestrict,
|
|
69
|
-
.ssbs,
|
|
70
|
-
.tlb_rmi,
|
|
71
|
-
.tracev8_4,
|
|
72
|
-
.uaops,
|
|
73
|
-
.v8_1a,
|
|
74
|
-
.v8_2a,
|
|
75
|
-
.v8_3a,
|
|
76
|
-
.v8_4a,
|
|
77
|
-
.v8a,
|
|
78
|
-
.vh,
|
|
79
|
-
.zcm,
|
|
80
|
-
.zcz,
|
|
81
|
-
.zcz_gp,
|
|
82
|
-
}),
|
|
83
|
-
};
|
|
84
|
-
pub const os = std.Target.Os{
|
|
85
|
-
.tag = .macos,
|
|
86
|
-
.version_range = .{ .semver = .{
|
|
87
|
-
.min = .{
|
|
88
|
-
.major = 12,
|
|
89
|
-
.minor = 6,
|
|
90
|
-
.patch = 0,
|
|
91
|
-
},
|
|
92
|
-
.max = .{
|
|
93
|
-
.major = 12,
|
|
94
|
-
.minor = 6,
|
|
95
|
-
.patch = 0,
|
|
96
|
-
},
|
|
97
|
-
}},
|
|
98
|
-
};
|
|
99
|
-
pub const target = std.Target{
|
|
100
|
-
.cpu = cpu,
|
|
101
|
-
.os = os,
|
|
102
|
-
.abi = abi,
|
|
103
|
-
.ofmt = object_format,
|
|
104
|
-
};
|
|
105
|
-
pub const object_format = std.Target.ObjectFormat.macho;
|
|
106
|
-
pub const mode = std.builtin.Mode.Debug;
|
|
107
|
-
pub const link_libc = true;
|
|
108
|
-
pub const link_libcpp = false;
|
|
109
|
-
pub const have_error_return_tracing = true;
|
|
110
|
-
pub const valgrind_support = false;
|
|
111
|
-
pub const sanitize_thread = false;
|
|
112
|
-
pub const position_independent_code = true;
|
|
113
|
-
pub const position_independent_executable = true;
|
|
114
|
-
pub const strip_debug_info = false;
|
|
115
|
-
pub const code_model = std.builtin.CodeModel.default;
|
|
@@ -1,115 +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(zig_version_string) catch unreachable;
|
|
5
|
-
pub const zig_version_string = "0.11.0-dev.2460+55a8b7e1f";
|
|
6
|
-
pub const zig_backend = std.builtin.CompilerBackend.stage2_llvm;
|
|
7
|
-
|
|
8
|
-
pub const output_mode = std.builtin.OutputMode.Exe;
|
|
9
|
-
pub const link_mode = std.builtin.LinkMode.Dynamic;
|
|
10
|
-
pub const is_test = false;
|
|
11
|
-
pub const single_threaded = false;
|
|
12
|
-
pub const abi = std.Target.Abi.none;
|
|
13
|
-
pub const cpu: std.Target.Cpu = .{
|
|
14
|
-
.arch = .aarch64,
|
|
15
|
-
.model = &std.Target.aarch64.cpu.apple_a14,
|
|
16
|
-
.features = std.Target.aarch64.featureSet(&[_]std.Target.aarch64.Feature{
|
|
17
|
-
.aes,
|
|
18
|
-
.aggressive_fma,
|
|
19
|
-
.alternate_sextload_cvt_f32_pattern,
|
|
20
|
-
.altnzcv,
|
|
21
|
-
.am,
|
|
22
|
-
.arith_bcc_fusion,
|
|
23
|
-
.arith_cbz_fusion,
|
|
24
|
-
.ccdp,
|
|
25
|
-
.ccidx,
|
|
26
|
-
.ccpp,
|
|
27
|
-
.complxnum,
|
|
28
|
-
.contextidr_el2,
|
|
29
|
-
.crc,
|
|
30
|
-
.crypto,
|
|
31
|
-
.disable_latency_sched_heuristic,
|
|
32
|
-
.dit,
|
|
33
|
-
.dotprod,
|
|
34
|
-
.el2vmsa,
|
|
35
|
-
.el3,
|
|
36
|
-
.flagm,
|
|
37
|
-
.fp16fml,
|
|
38
|
-
.fp_armv8,
|
|
39
|
-
.fptoint,
|
|
40
|
-
.fullfp16,
|
|
41
|
-
.fuse_address,
|
|
42
|
-
.fuse_adrp_add,
|
|
43
|
-
.fuse_aes,
|
|
44
|
-
.fuse_arith_logic,
|
|
45
|
-
.fuse_crypto_eor,
|
|
46
|
-
.fuse_csel,
|
|
47
|
-
.fuse_literals,
|
|
48
|
-
.jsconv,
|
|
49
|
-
.lor,
|
|
50
|
-
.lse,
|
|
51
|
-
.lse2,
|
|
52
|
-
.mpam,
|
|
53
|
-
.neon,
|
|
54
|
-
.nv,
|
|
55
|
-
.pan,
|
|
56
|
-
.pan_rwv,
|
|
57
|
-
.pauth,
|
|
58
|
-
.perfmon,
|
|
59
|
-
.predres,
|
|
60
|
-
.ras,
|
|
61
|
-
.rcpc,
|
|
62
|
-
.rcpc_immo,
|
|
63
|
-
.rdm,
|
|
64
|
-
.sb,
|
|
65
|
-
.sel2,
|
|
66
|
-
.sha2,
|
|
67
|
-
.sha3,
|
|
68
|
-
.specrestrict,
|
|
69
|
-
.ssbs,
|
|
70
|
-
.tlb_rmi,
|
|
71
|
-
.tracev8_4,
|
|
72
|
-
.uaops,
|
|
73
|
-
.v8_1a,
|
|
74
|
-
.v8_2a,
|
|
75
|
-
.v8_3a,
|
|
76
|
-
.v8_4a,
|
|
77
|
-
.v8a,
|
|
78
|
-
.vh,
|
|
79
|
-
.zcm,
|
|
80
|
-
.zcz,
|
|
81
|
-
.zcz_gp,
|
|
82
|
-
}),
|
|
83
|
-
};
|
|
84
|
-
pub const os = std.Target.Os{
|
|
85
|
-
.tag = .macos,
|
|
86
|
-
.version_range = .{ .semver = .{
|
|
87
|
-
.min = .{
|
|
88
|
-
.major = 13,
|
|
89
|
-
.minor = 3,
|
|
90
|
-
.patch = 1,
|
|
91
|
-
},
|
|
92
|
-
.max = .{
|
|
93
|
-
.major = 13,
|
|
94
|
-
.minor = 3,
|
|
95
|
-
.patch = 1,
|
|
96
|
-
},
|
|
97
|
-
}},
|
|
98
|
-
};
|
|
99
|
-
pub const target = std.Target{
|
|
100
|
-
.cpu = cpu,
|
|
101
|
-
.os = os,
|
|
102
|
-
.abi = abi,
|
|
103
|
-
.ofmt = object_format,
|
|
104
|
-
};
|
|
105
|
-
pub const object_format = std.Target.ObjectFormat.macho;
|
|
106
|
-
pub const mode = std.builtin.Mode.Debug;
|
|
107
|
-
pub const link_libc = true;
|
|
108
|
-
pub const link_libcpp = false;
|
|
109
|
-
pub const have_error_return_tracing = true;
|
|
110
|
-
pub const valgrind_support = false;
|
|
111
|
-
pub const sanitize_thread = false;
|
|
112
|
-
pub const position_independent_code = true;
|
|
113
|
-
pub const position_independent_executable = true;
|
|
114
|
-
pub const strip_debug_info = false;
|
|
115
|
-
pub const code_model = std.builtin.CodeModel.default;
|
|
Binary file
|
|
Binary file
|