File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -89,16 +89,31 @@ pub fn activateEmsdkStep(b: *std.Build) *std.Build.Step {
89
89
90
90
pub const EmccFlags = std .StringHashMap (void );
91
91
92
- pub fn emccDefaultFlags (allocator : std.mem.Allocator , optimize : std.builtin.OptimizeMode ) EmccFlags {
92
+ pub fn emccDefaultFlags (allocator : std.mem.Allocator , options : struct {
93
+ optimize : std.builtin.OptimizeMode ,
94
+ fsanitize : bool ,
95
+ }) EmccFlags {
93
96
var args = EmccFlags .init (allocator );
94
- switch (optimize ) {
97
+ switch (options . optimize ) {
95
98
.Debug = > {
99
+ args .put ("-O0" , {}) catch unreachable ;
96
100
args .put ("-gsource-map" , {}) catch unreachable ;
101
+ if (options .fsanitize )
102
+ args .put ("-fsanitize=undefined" , {}) catch unreachable ;
97
103
},
98
- .ReleaseSmall , .ReleaseFast = > {
104
+ .ReleaseSafe = > {
99
105
args .put ("-O3" , {}) catch unreachable ;
106
+ if (options .fsanitize ) {
107
+ args .put ("-fsanitize=undefined" , {}) catch unreachable ;
108
+ args .put ("-fsanitize-minimal-runtime" , {}) catch unreachable ;
109
+ }
110
+ },
111
+ .ReleaseFast = > {
112
+ args .put ("-O3" , {}) catch unreachable ;
113
+ },
114
+ .ReleaseSmall = > {
115
+ args .put ("-Oz" , {}) catch unreachable ;
100
116
},
101
- else = > {},
102
117
}
103
118
return args ;
104
119
}
You can’t perform that action at this time.
0 commit comments