@@ -105,10 +105,12 @@ pub fn activateEmsdkStep(b: *std.Build) *std.Build.Step {
105105
106106pub const EmccFlags = std .StringHashMap (void );
107107
108- pub fn emccDefaultFlags ( allocator : std.mem.Allocator , options : struct {
108+ pub const EmccDefaultFlagsOverrides = struct {
109109 optimize : std.builtin.OptimizeMode ,
110110 fsanitize : bool ,
111- }) EmccFlags {
111+ };
112+
113+ pub fn emccDefaultFlags (allocator : std.mem.Allocator , options : EmccDefaultFlagsOverrides ) EmccFlags {
112114 var args = EmccFlags .init (allocator );
113115 switch (options .optimize ) {
114116 .Debug = > {
@@ -136,22 +138,23 @@ pub fn emccDefaultFlags(allocator: std.mem.Allocator, options: struct {
136138
137139pub const EmccSettings = std .StringHashMap ([]const u8 );
138140
139- pub fn emccDefaultSettings (
140- allocator : std.mem.Allocator ,
141- options : struct {
142- optimize : std.builtin.OptimizeMode ,
143- emsdk_allocator : enum {
144- none ,
145- dlmalloc ,
146- emmalloc ,
147- @"emmalloc-debug" ,
148- @"emmalloc-memvalidate" ,
149- @"emmalloc-verbose" ,
150- mimalloc ,
151- } = .emmalloc ,
152- shell_file : ? []const u8 = null ,
153- },
154- ) EmccSettings {
141+ pub const EmsdkAllocator = enum {
142+ none ,
143+ dlmalloc ,
144+ emmalloc ,
145+ @"emmalloc-debug" ,
146+ @"emmalloc-memvalidate" ,
147+ @"emmalloc-verbose" ,
148+ mimalloc ,
149+ };
150+
151+ pub const EmccDefaultSettingsOverrides = struct {
152+ optimize : std.builtin.OptimizeMode ,
153+ emsdk_allocator : EmsdkAllocator = .emmalloc ,
154+ shell_file : ? []const u8 = null ,
155+ };
156+
157+ pub fn emccDefaultSettings (allocator : std.mem.Allocator , options : EmccDefaultSettingsOverrides ) EmccSettings {
155158 var settings = EmccSettings .init (allocator );
156159 switch (options .optimize ) {
157160 .Debug , .ReleaseSafe = > {
@@ -171,19 +174,21 @@ pub const EmccFilePath = struct {
171174 virtual_path : ? []const u8 = null ,
172175};
173176
177+ pub const StepOptions = struct {
178+ optimize : std.builtin.OptimizeMode ,
179+ flags : EmccFlags ,
180+ settings : EmccSettings ,
181+ use_preload_plugins : bool = false ,
182+ embed_paths : ? []const EmccFilePath = null ,
183+ preload_paths : ? []const EmccFilePath = null ,
184+ shell_file_path : ? std.Build.LazyPath = null ,
185+ install_dir : std.Build.InstallDir ,
186+ };
187+
174188pub fn emccStep (
175189 b : * std.Build ,
176190 wasm : * std.Build.Step.Compile ,
177- options : struct {
178- optimize : std.builtin.OptimizeMode ,
179- flags : EmccFlags ,
180- settings : EmccSettings ,
181- use_preload_plugins : bool = false ,
182- embed_paths : ? []const EmccFilePath = null ,
183- preload_paths : ? []const EmccFilePath = null ,
184- shell_file_path : ? std.Build.LazyPath = null ,
185- install_dir : std.Build.InstallDir ,
186- },
191+ options : StepOptions ,
187192) * std.Build.Step {
188193 var emcc = b .addSystemCommand (&.{emccPath (b )});
189194
0 commit comments