@@ -120,10 +120,12 @@ pub fn activateEmsdkStep(b: *std.Build) *std.Build.Step {
120
120
121
121
pub const EmccFlags = std .StringHashMap (void );
122
122
123
- pub fn emccDefaultFlags ( allocator : std.mem.Allocator , options : struct {
123
+ pub const FlagsOptions = struct {
124
124
optimize : std.builtin.OptimizeMode ,
125
125
fsanitize : bool ,
126
- }) EmccFlags {
126
+ };
127
+
128
+ pub fn emccDefaultFlags (allocator : std.mem.Allocator , options : FlagsOptions ) EmccFlags {
127
129
var args = EmccFlags .init (allocator );
128
130
switch (options .optimize ) {
129
131
.Debug = > {
@@ -151,22 +153,22 @@ pub fn emccDefaultFlags(allocator: std.mem.Allocator, options: struct {
151
153
152
154
pub const EmccSettings = std .StringHashMap ([]const u8 );
153
155
154
- pub fn emccDefaultSettings (
155
- allocator : std.mem.Allocator ,
156
- options : struct {
157
- optimize : std.builtin.OptimizeMode ,
158
- emsdk_allocator : enum {
159
- none ,
160
- dlmalloc ,
161
- emmalloc ,
162
- @ "emmalloc-debug" ,
163
- @ "emmalloc-memvalidate" ,
164
- @ "emmalloc-verbose" ,
165
- mimalloc ,
166
- } = .emmalloc ,
167
- shell_file : ? [] const u8 = null ,
168
- },
169
- ) EmccSettings {
156
+ pub const EmsdkAllocator = enum {
157
+ none ,
158
+ dlmalloc ,
159
+ emmalloc ,
160
+ @ "emmalloc-debug" ,
161
+ @ "emmalloc-memvalidate" ,
162
+ @ "emmalloc-verbose" ,
163
+ mimalloc ,
164
+ };
165
+
166
+ pub const SettingsOptions = struct {
167
+ optimize : std.builtin.OptimizeMode ,
168
+ emsdk_allocator : EmsdkAllocator = .emmalloc ,
169
+ };
170
+
171
+ pub fn emccDefaultSettings ( allocator : std.mem.Allocator , options : SettingsOptions ) EmccSettings {
170
172
var settings = EmccSettings .init (allocator );
171
173
switch (options .optimize ) {
172
174
.Debug , .ReleaseSafe = > {
@@ -186,19 +188,21 @@ pub const EmccFilePath = struct {
186
188
virtual_path : ? []const u8 = null ,
187
189
};
188
190
191
+ pub const StepOptions = struct {
192
+ optimize : std.builtin.OptimizeMode ,
193
+ flags : EmccFlags ,
194
+ settings : EmccSettings ,
195
+ use_preload_plugins : bool = false ,
196
+ embed_paths : ? []const EmccFilePath = null ,
197
+ preload_paths : ? []const EmccFilePath = null ,
198
+ shell_file_path : ? []const u8 = null ,
199
+ install_dir : std.Build.InstallDir ,
200
+ };
201
+
189
202
pub fn emccStep (
190
203
b : * std.Build ,
191
204
wasm : * std.Build.Step.Compile ,
192
- options : struct {
193
- optimize : std.builtin.OptimizeMode ,
194
- flags : EmccFlags ,
195
- settings : EmccSettings ,
196
- use_preload_plugins : bool = false ,
197
- embed_paths : ? []const EmccFilePath = null ,
198
- preload_paths : ? []const EmccFilePath = null ,
199
- shell_file_path : ? []const u8 = null ,
200
- install_dir : std.Build.InstallDir ,
201
- },
205
+ options : StepOptions ,
202
206
) * std.Build.Step {
203
207
var emcc = b .addSystemCommand (&.{emccPath (b )});
204
208
0 commit comments