@@ -120,10 +120,12 @@ pub fn activateEmsdkStep(b: *std.Build) *std.Build.Step {
120120
121121pub const EmccFlags = std .StringHashMap (void );
122122
123- pub fn emccDefaultFlags ( allocator : std.mem.Allocator , options : struct {
123+ pub const FlagsOptions = struct {
124124 optimize : std.builtin.OptimizeMode ,
125125 fsanitize : bool ,
126- }) EmccFlags {
126+ };
127+
128+ pub fn emccDefaultFlags (allocator : std.mem.Allocator , options : FlagsOptions ) EmccFlags {
127129 var args = EmccFlags .init (allocator );
128130 switch (options .optimize ) {
129131 .Debug = > {
@@ -151,22 +153,22 @@ pub fn emccDefaultFlags(allocator: std.mem.Allocator, options: struct {
151153
152154pub const EmccSettings = std .StringHashMap ([]const u8 );
153155
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 {
170172 var settings = EmccSettings .init (allocator );
171173 switch (options .optimize ) {
172174 .Debug , .ReleaseSafe = > {
@@ -186,19 +188,21 @@ pub const EmccFilePath = struct {
186188 virtual_path : ? []const u8 = null ,
187189};
188190
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+
189202pub fn emccStep (
190203 b : * std.Build ,
191204 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 ,
202206) * std.Build.Step {
203207 var emcc = b .addSystemCommand (&.{emccPath (b )});
204208
0 commit comments