Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
emscripten-core
GitHub Repository: emscripten-core/emscripten
Path: blob/main/src/settings.js
4128 views
1
// Settings that control the emscripten compiler. These are available to the
2
// python code and also as global variables when the JS compiler runs. They
3
// are set via the command line. For example:
4
//
5
// emcc -sOPTION1=VALUE1 -sOPTION2=ITEM1,ITEM2 [..other stuff..]
6
//
7
// For convenience and readability ``-sOPTION`` expands to ``-sOPTION=1``
8
// and ``-sNO_OPTION`` expands to ``-sOPTION=0`` (assuming OPTION is a valid
9
// option).
10
//
11
// See https://github.com/emscripten-core/emscripten/wiki/Code-Generation-Modes/
12
//
13
// Note that the values here are the defaults which can be affected either
14
// directly via ``-s`` flags or indirectly via other options (e.g. -O1,2,3)
15
//
16
// These flags should only have an effect when compiling to JS, so there
17
// should not be a need to have them when just compiling source to
18
// bitcode. However, there will also be no harm either, so it is ok to.
19
//
20
// Settings in this file can be directly set from the command line. Internal
21
// settings that are not part of the user ABI live in the settings_internal.js.
22
//
23
// In general it is best to pass the same arguments at both compile and link
24
// time, as whether wasm object files are used or not affects when codegen
25
// happens (without wasm object files, codegen is done entirely during
26
// link; otherwise, it is during compile). Flags affecting codegen must
27
// be passed when codegen happens, so to let a build easily switch when codegen
28
// happens (LTO vs normal), pass the flags at both times. The flags are also
29
// annotated in this file:
30
//
31
// [link] - Should be passed at link time. This is the case for all JS flags,
32
// as we emit JS at link (and that is most of the flags here, and
33
// hence the default).
34
// [compile+link] - A flag that has an effect at both compile and link time,
35
// basically any time emcc is invoked. The same flag should be
36
// passed at both times in most cases.
37
//
38
// If not otherwise specified, a flag is [link]. Note that no flag is only
39
// relevant during compile time, as during link we may do codegen for system
40
// libraries and other support code, so all flags are either link or
41
// compile+link.
42
//
43
44
// Tuning
45
46
// Whether we should add runtime assertions. This affects both JS and how
47
// system libraries are built.
48
// ASSERTIONS == 2 gives even more runtime checks, that may be very slow. That
49
// includes internal dlmalloc assertions, for example.
50
// ASSERTIONS defaults to 0 in optimized builds (-O1 and above).
51
// [link]
52
var ASSERTIONS = 1;
53
54
// Chooses what kind of stack smash checks to emit to generated code:
55
// Building with ASSERTIONS=1 causes STACK_OVERFLOW_CHECK default to 1.
56
// Since ASSERTIONS=1 is the default at -O0, which itself is the default
57
// optimization level this means that this setting also effectively
58
// defaults 1, absent any other settings:
59
//
60
// - 0: Stack overflows are not checked.
61
// - 1: Adds a security cookie at the top of the stack, which is checked at end
62
// of each tick and at exit (practically zero performance overhead)
63
// - 2: Same as above, but also runs a binaryen pass which adds a check to all
64
// stack pointer assignments. Has a small performance cost.
65
//
66
// [link]
67
var STACK_OVERFLOW_CHECK = 0;
68
69
// When STACK_OVERFLOW_CHECK is enabled we also check writes to address zero.
70
// This can help detect NULL pointer usage. If you want to skip this extra
71
// check (for example, if you want reads from the address zero to always return
72
// zero) you can disable this here. This setting has no effect when
73
// STACK_OVERFLOW_CHECK is disabled.
74
var CHECK_NULL_WRITES = true;
75
76
// When set to 1, will generate more verbose output during compilation.
77
// [general]
78
var VERBOSE = false;
79
80
// Whether we will run the main() function. Disable if you embed the generated
81
// code in your own, and will call main() yourself at the right time (which you
82
// can do with Module.callMain(), with an optional parameter of commandline args).
83
// [link]
84
var INVOKE_RUN = true;
85
86
// If 0, the runtime is not quit when main() completes (allowing code to
87
// run afterwards, for example from the browser main event loop). atexit()s
88
// are also not executed, and we can avoid including code for runtime shutdown,
89
// like flushing the stdio streams.
90
// Set this to 1 if you do want atexit()s or stdio streams to be flushed
91
// on exit.
92
// This setting is controlled automatically in STANDALONE_WASM mode:
93
//
94
// - For a command (has a main function) this is always 1
95
// - For a reactor (no a main function) this is always 0
96
//
97
// [link]
98
var EXIT_RUNTIME = false;
99
100
// The total stack size. There is no way to enlarge the stack, so this
101
// value must be large enough for the program's requirements. If
102
// assertions are on, we will assert on not exceeding this, otherwise,
103
// it will fail silently.
104
// [link]
105
var STACK_SIZE = 64*1024;
106
107
// What malloc()/free() to use, out of:
108
//
109
// - dlmalloc - a powerful general-purpose malloc
110
// - emmalloc - a simple and compact malloc designed for emscripten
111
// - emmalloc-debug - use emmalloc and add extra assertion checks
112
// - emmalloc-memvalidate - use emmalloc with assertions+heap consistency
113
// checking.
114
// - emmalloc-verbose - use emmalloc with assertions + verbose logging.
115
// - emmalloc-memvalidate-verbose - use emmalloc with assertions + heap
116
// consistency checking + verbose logging.
117
// - mimalloc - a powerful mulithreaded allocator. This is recommended in
118
// large applications that have malloc() contention, but it is
119
// larger and uses more memory.
120
// - none - no malloc() implementation is provided, but you must implement
121
// malloc() and free() yourself.
122
//
123
// dlmalloc is necessary for split memory and other special modes, and will be
124
// used automatically in those cases.
125
// In general, if you don't need one of those special modes, and if you don't
126
// allocate very many small objects, you should use emmalloc since it's
127
// smaller. Otherwise, if you do allocate many small objects, dlmalloc
128
// is usually worth the extra size. dlmalloc is also a good choice if you want
129
// the extra security checks it does (such as noticing metadata corruption in
130
// its internal data structures, which emmalloc does not do).
131
// [link]
132
var MALLOC = "dlmalloc";
133
134
// If 1, then when malloc would fail we abort(). This is nonstandard behavior,
135
// but makes sense for the web since we have a fixed amount of memory that
136
// must all be allocated up front, and so (a) failing mallocs are much more
137
// likely than on other platforms, and (b) people need a way to find out
138
// how big that initial allocation (INITIAL_MEMORY) must be.
139
// If you set this to 0, then you get the standard malloc behavior of
140
// returning NULL (0) when it fails.
141
//
142
// Setting ALLOW_MEMORY_GROWTH turns this off, as in that mode we default to
143
// the behavior of trying to grow and returning 0 from malloc on failure, like
144
// a standard system would. However, you can still set this flag to override
145
// that. This is a mostly-backwards-compatible change. Previously this option
146
// was ignored when growth was on. The current behavior is that growth turns it
147
// off by default, so for users that never specified the flag nothing changes.
148
// But if you do specify it, it will have an effect now, which it did not
149
// previously. If you don't want that, just stop passing it in at link time.
150
//
151
// Note that this setting does not affect the behavior of operator new in C++.
152
// This function will always abort on allocation failure if exceptions are disabled.
153
// If you want new to return 0 on failure, use it with std::nothrow.
154
//
155
// [link]
156
var ABORTING_MALLOC = true;
157
158
// The initial amount of heap memory available to the program. This is the
159
// memory region available for dynamic allocations via `sbrk`, `malloc` and `new`.
160
//
161
// Unlike INITIAL_MEMORY, this setting allows the static and dynamic regions of
162
// your programs memory to independently grow. In most cases we recommend using
163
// this setting rather than `INITIAL_MEMORY`. However, this setting does not work
164
// for imported memories (e.g. when dynamic linking is used).
165
//
166
// [link]
167
var INITIAL_HEAP = 16777216;
168
169
// The initial amount of memory to use. Using more memory than this will
170
// cause us to expand the heap, which can be costly with typed arrays:
171
// we need to copy the old heap into a new one in that case.
172
// If ALLOW_MEMORY_GROWTH is set, this initial amount of memory can increase
173
// later; if not, then it is the final and total amount of memory.
174
//
175
// By default, this value is calculated based on INITIAL_HEAP, STACK_SIZE,
176
// as well the size of static data in input modules.
177
//
178
// (This option was formerly called TOTAL_MEMORY.)
179
// [link]
180
var INITIAL_MEMORY = -1;
181
182
// Set the maximum size of memory in the wasm module (in bytes). This is only
183
// relevant when ALLOW_MEMORY_GROWTH is set, as without growth, the size of
184
// INITIAL_MEMORY is the final size of memory anyhow.
185
//
186
// Note that the default value here is 2GB, which means that by default if you
187
// enable memory growth then we can grow up to 2GB but no higher. 2GB is a
188
// natural limit for several reasons:
189
//
190
// * If the maximum heap size is over 2GB, then pointers must be unsigned in
191
// JavaScript, which increases code size. We don't want memory growth builds
192
// to be larger unless someone explicitly opts in to >2GB+ heaps.
193
// * Historically no VM has supported more >2GB+, and only recently (Mar 2020)
194
// has support started to appear. As support is limited, it's safer for
195
// people to opt into >2GB+ heaps rather than get a build that may not
196
// work on all VMs.
197
//
198
// To use more than 2GB, set this to something higher, like 4GB.
199
//
200
// (This option was formerly called WASM_MEM_MAX and BINARYEN_MEM_MAX.)
201
// [link]
202
var MAXIMUM_MEMORY = 2147483648;
203
204
// If false, we abort with an error if we try to allocate more memory than
205
// we can (INITIAL_MEMORY). If true, we will grow the memory arrays at
206
// runtime, seamlessly and dynamically.
207
// See https://code.google.com/p/v8/issues/detail?id=3907 regarding
208
// memory growth performance in chrome.
209
// Note that growing memory means we replace the JS typed array views, as
210
// once created they cannot be resized. (In wasm we can grow the Memory, but
211
// still need to create new views for JS.)
212
// Setting this option on will disable ABORTING_MALLOC, in other words,
213
// ALLOW_MEMORY_GROWTH enables fully standard behavior, of both malloc
214
// returning 0 when it fails, and also of being able to allocate more
215
// memory from the system as necessary.
216
// [link]
217
var ALLOW_MEMORY_GROWTH = false;
218
219
// If ALLOW_MEMORY_GROWTH is true, this variable specifies the geometric
220
// overgrowth rate of the heap at resize. Specify MEMORY_GROWTH_GEOMETRIC_STEP=0
221
// to disable overgrowing the heap at all, or e.g.
222
// MEMORY_GROWTH_GEOMETRIC_STEP=1.0 to double the heap (+100%) at every grow step.
223
// The larger this value is, the more memory the WebAssembly heap overreserves
224
// to reduce performance hiccups coming from memory resize, and the smaller
225
// this value is, the more memory is conserved, at the performance of more
226
// stuttering when the heap grows. (profiled to be on the order of ~20 msecs)
227
// [link]
228
var MEMORY_GROWTH_GEOMETRIC_STEP = 0.20;
229
230
// Specifies a cap for the maximum geometric overgrowth size, in bytes. Use
231
// this value to constrain the geometric grow to not exceed a specific rate.
232
// Pass MEMORY_GROWTH_GEOMETRIC_CAP=0 to disable the cap and allow unbounded
233
// size increases.
234
// [link]
235
var MEMORY_GROWTH_GEOMETRIC_CAP = 96*1024*1024;
236
237
// If ALLOW_MEMORY_GROWTH is true and MEMORY_GROWTH_LINEAR_STEP == -1, then
238
// geometric memory overgrowth is utilized (above variable). Set
239
// MEMORY_GROWTH_LINEAR_STEP to a multiple of WASM page size (64KB), eg. 16MB to
240
// replace geometric overgrowth rate with a constant growth step size. When
241
// MEMORY_GROWTH_LINEAR_STEP is used, the variables MEMORY_GROWTH_GEOMETRIC_STEP
242
// and MEMORY_GROWTH_GEOMETRIC_CAP are ignored.
243
// [link]
244
var MEMORY_GROWTH_LINEAR_STEP = -1;
245
246
// The "architecture" to compile for. 0 means the default wasm32, 1 is
247
// the full end-to-end wasm64 mode, and 2 is wasm64 for clang/lld but lowered to
248
// wasm32 in Binaryen (such that it can run on wasm32 engines, while internally
249
// using i64 pointers).
250
// Assumes WASM_BIGINT.
251
// [compile+link]
252
var MEMORY64 = 0;
253
254
// Sets the initial size of the table when MAIN_MODULE or SIDE_MODULE is use
255
// (and not otherwise). Normally Emscripten can determine the size of the table
256
// at link time, but in SPLIT_MODULE mode, wasm-split often needs to grow the
257
// table, so the table size baked into the JS for the instrumented build will be
258
// too small after the module is split. This is a hack to allow users to specify
259
// a large enough table size that can be consistent across both builds. This
260
// setting may be removed at any time and should not be used except in
261
// conjunction with SPLIT_MODULE and dynamic linking.
262
// [link]
263
var INITIAL_TABLE = -1;
264
265
// If true, allows more functions to be added to the table at runtime. This is
266
// necessary for dynamic linking, and set automatically in that mode.
267
// [link]
268
var ALLOW_TABLE_GROWTH = false;
269
270
// Where global data begins; the start of static memory.
271
// A GLOBAL_BASE of 1024 or above is useful for optimizing load/store offsets, as it
272
// enables the --low-memory-unused pass
273
// [link]
274
var GLOBAL_BASE = 1024;
275
276
// Where table slots (function addresses) are allocated.
277
// This must be at least 1 to reserve the zero slot for the null pointer.
278
// [link]
279
var TABLE_BASE = 1;
280
281
// Whether closure compiling is being run on this output
282
// [link]
283
var USE_CLOSURE_COMPILER = false;
284
285
// Deprecated: Use the standard warnings flags instead. e.g. ``-Wclosure``,
286
// ``-Wno-closure``, ``-Werror=closure``.
287
// options: 'quiet', 'warn', 'error'. If set to 'warn', Closure warnings are
288
// printed out to console. If set to 'error', Closure warnings are treated like
289
// errors, similar to -Werror compiler flag.
290
// [link]
291
// [deprecated]
292
var CLOSURE_WARNINGS = 'quiet';
293
294
// Ignore closure warnings and errors (like on duplicate definitions)
295
// [link]
296
var IGNORE_CLOSURE_COMPILER_ERRORS = false;
297
298
// If set to 1, each wasm module export is individually declared with a
299
// JavaScript "var" definition. This is the simple and recommended approach.
300
// However, this does increase code size (especially if you have many such
301
// exports), which can be avoided in an unsafe way by setting this to 0. In that
302
// case, no "var" is created for each export, and instead a loop (of small
303
// constant code size, no matter how many exports you have) writes all the
304
// exports received into the global scope. Doing so is dangerous since such
305
// modifications of the global scope can confuse external JS minifier tools, and
306
// also things can break if the scope the code is in is not the global scope
307
// (e.g. if you manually enclose them in a function scope).
308
// [link]
309
var DECLARE_ASM_MODULE_EXPORTS = true;
310
311
// If set to 1, prevents inlining. If 0, we will inline normally in LLVM.
312
// This does not affect the inlining policy in Binaryen.
313
// [compile]
314
var INLINING_LIMIT = false;
315
316
// If set to 1, perform acorn pass that converts each HEAP access into a
317
// function call that uses DataView to enforce LE byte order for HEAP buffer;
318
// This makes generated JavaScript run on BE as well as LE machines. (If 0, only
319
// LE systems are supported). Does not affect generated wasm.
320
// [experimental]
321
var SUPPORT_BIG_ENDIAN = false;
322
323
// Check each write to the heap, for example, this will give a clear
324
// error on what would be segfaults in a native build (like dereferencing
325
// 0). See runtime_safe_heap.js for the actual checks performed.
326
// Set to value 1 to test for safe behavior for both Wasm+Wasm2JS builds.
327
// Set to value 2 to test for safe behavior for only Wasm builds. (notably,
328
// Wasm-only builds allow unaligned memory accesses. Note, however, that
329
// on some architectures unaligned accesses can be very slow, so it is still
330
// a good idea to verify your code with the more strict mode 1)
331
// [link]
332
var SAFE_HEAP = 0;
333
334
// Log out all SAFE_HEAP operations
335
// [link]
336
var SAFE_HEAP_LOG = false;
337
338
// Allows function pointers to be cast, wraps each call of an incorrect type
339
// with a runtime correction. This adds overhead and should not be used
340
// normally. Aside from making calls not fail, this tries to convert values as
341
// best it can. We use 64 bits (i64) to represent values, as if we wrote the
342
// sent value to memory and loaded the received type from the same memory (using
343
// truncs/extends/ reinterprets). This means that when types do not match the
344
// emulated values may not match (this is true of native too, for that matter -
345
// this is all undefined behavior). This approaches appears good enough to
346
// support Python (the original motiviation for this feature) and Glib (the
347
// continued motivation).
348
// [link]
349
var EMULATE_FUNCTION_POINTER_CASTS = false;
350
351
// Print out exceptions in emscriptened code.
352
// [link]
353
var EXCEPTION_DEBUG = false;
354
355
// Print out when we enter a library call (library*.js). You can also unset
356
// runtimeDebug at runtime for logging to cease, and can set it when you want
357
// it back. A simple way to set it in C++ is::
358
//
359
// emscripten_run_script("runtimeDebug = ...;");
360
//
361
// [link]
362
var LIBRARY_DEBUG = false;
363
364
// Print out all musl syscalls, including translating their numeric index
365
// to the string name, which can be convenient for debugging. (Other system
366
// calls are not numbered and already have clear names; use LIBRARY_DEBUG
367
// to get logging for all of them.)
368
// [link]
369
var SYSCALL_DEBUG = false;
370
371
// Log out socket/network data transfer.
372
// [link]
373
var SOCKET_DEBUG = false;
374
375
// Log dynamic linker information
376
// [link]
377
var DYLINK_DEBUG = 0;
378
379
// Register file system callbacks using trackingDelegate in library_fs.js
380
// [link]
381
var FS_DEBUG = false;
382
383
// Select socket backend, either webrtc or websockets. XXX webrtc is not
384
// currently tested, may be broken
385
386
// As well as being configurable at compile time via the "-s" option the
387
// WEBSOCKET_URL and WEBSOCKET_SUBPROTOCOL
388
// settings may configured at run time via the Module object e.g.
389
// Module['websocket'] = {subprotocol: 'base64, binary, text'};
390
// Module['websocket'] = {url: 'wss://', subprotocol: 'base64'};
391
// You can set 'subprotocol' to null, if you don't want to specify it
392
// Run time configuration may be useful as it lets an application select
393
// multiple different services.
394
// [link]
395
var SOCKET_WEBRTC = false;
396
397
// A string containing either a WebSocket URL prefix (ws:// or wss://) or a complete
398
// RFC 6455 URL - "ws[s]:" "//" host [ ":" port ] path [ "?" query ].
399
// In the (default) case of only a prefix being specified the URL will be constructed from
400
// prefix + addr + ':' + port
401
// where addr and port are derived from the socket connect/bind/accept calls.
402
// [link]
403
var WEBSOCKET_URL = 'ws://';
404
405
// If 1, the POSIX sockets API uses a native bridge process server to proxy sockets calls
406
// from browser to native world.
407
// [link]
408
var PROXY_POSIX_SOCKETS = false;
409
410
// A string containing a comma separated list of WebSocket subprotocols
411
// as would be present in the Sec-WebSocket-Protocol header.
412
// You can set 'null', if you don't want to specify it.
413
// [link]
414
var WEBSOCKET_SUBPROTOCOL = 'binary';
415
416
// Print out debugging information from our OpenAL implementation.
417
// [link]
418
var OPENAL_DEBUG = false;
419
420
// If 1, prints out debugging related to calls from ``emscripten_web_socket_*``
421
// functions in ``emscripten/websocket.h``.
422
// If 2, additionally traces bytes communicated via the sockets.
423
// [link]
424
var WEBSOCKET_DEBUG = false;
425
426
// Adds extra checks for error situations in the GL library. Can impact
427
// performance.
428
// [link]
429
var GL_ASSERTIONS = false;
430
431
// If enabled, prints out all API calls to WebGL contexts. (*very* verbose)
432
// [link]
433
var TRACE_WEBGL_CALLS = false;
434
435
// Enables more verbose debug printing of WebGL related operations. As with
436
// LIBRARY_DEBUG, this is toggleable at runtime with option GL.debug.
437
// [link]
438
var GL_DEBUG = false;
439
440
// When enabled, sets preserveDrawingBuffer in the context, to allow tests to
441
// work (but adds overhead)
442
// [link]
443
var GL_TESTING = false;
444
445
// How large GL emulation temp buffers are
446
// [link]
447
var GL_MAX_TEMP_BUFFER_SIZE = 2097152;
448
449
// Enables some potentially-unsafe optimizations in GL emulation code
450
// [link]
451
var GL_UNSAFE_OPTS = true;
452
453
// Forces support for all GLES2 features, not just the WebGL-friendly subset.
454
// [link]
455
var FULL_ES2 = false;
456
457
// If true, glGetString() for GL_VERSION and GL_SHADING_LANGUAGE_VERSION will
458
// return strings OpenGL ES format "Open GL ES ... (WebGL ...)" rather than the
459
// WebGL format. If false, the direct WebGL format strings are returned. Set
460
// this to true to make GL contexts appear like an OpenGL ES context in these
461
// version strings (at the expense of a little bit of added code size), and to
462
// false to make GL contexts appear like WebGL contexts and to save some bytes
463
// from the output.
464
// [link]
465
var GL_EMULATE_GLES_VERSION_STRING_FORMAT = true;
466
467
// If true, all GL extensions are advertised in both unprefixed WebGL extension
468
// format, but also in desktop/mobile GLES/GL extension format with ``GL_``
469
// prefix.
470
// [link]
471
var GL_EXTENSIONS_IN_PREFIXED_FORMAT = true;
472
473
// If true, adds support for automatically enabling all GL extensions for
474
// GLES/GL emulation purposes. This takes up code size. If you set this to 0,
475
// you will need to manually enable the extensions you need.
476
// [link]
477
var GL_SUPPORT_AUTOMATIC_ENABLE_EXTENSIONS = true;
478
479
// If true, the function ``emscripten_webgl_enable_extension()`` can be called to
480
// enable any WebGL extension. If false, to save code size,
481
// ``emscripten_webgl_enable_extension()`` cannot be called to enable any of extensions
482
// 'ANGLE_instanced_arrays', 'OES_vertex_array_object', 'WEBGL_draw_buffers',
483
// 'WEBGL_multi_draw', 'WEBGL_draw_instanced_base_vertex_base_instance',
484
// or 'WEBGL_multi_draw_instanced_base_vertex_base_instance',
485
// but the dedicated functions ``emscripten_webgl_enable_*()``
486
// found in html5.h are used to enable each of those extensions.
487
// This way code size is increased only for the extensions that are actually used.
488
// N.B. if setting this to 0, GL_SUPPORT_AUTOMATIC_ENABLE_EXTENSIONS must be set
489
// to zero as well.
490
// [link]
491
var GL_SUPPORT_SIMPLE_ENABLE_EXTENSIONS = true;
492
493
// If set to 0, Emscripten GLES2->WebGL translation layer does not track the kind
494
// of GL errors that exist in GLES2 but do not exist in WebGL. Settings this to 0
495
// saves code size. (Good to keep at 1 for development)
496
// [link]
497
var GL_TRACK_ERRORS = true;
498
499
// If true, GL contexts support the explicitSwapControl context creation flag.
500
// Set to 0 to save a little bit of space on projects that do not need it.
501
// [link]
502
var GL_SUPPORT_EXPLICIT_SWAP_CONTROL = false;
503
504
// If true, calls to glUniform*fv and glUniformMatrix*fv utilize a pool of
505
// preallocated temporary buffers for common small sizes to avoid generating
506
// temporary garbage for WebGL 1. Disable this to optimize generated size of the
507
// GL library a little bit, at the expense of generating garbage in WebGL 1. If
508
// you are only using WebGL 2 and do not support WebGL 1, this is not needed and
509
// you can turn it off.
510
// [link]
511
var GL_POOL_TEMP_BUFFERS = true;
512
513
// If true, enables support for the EMSCRIPTEN_explicit_uniform_location WebGL
514
// extension. See docs/EMSCRIPTEN_explicit_uniform_location.txt
515
var GL_EXPLICIT_UNIFORM_LOCATION = false;
516
517
// If true, enables support for the EMSCRIPTEN_uniform_layout_binding WebGL
518
// extension. See docs/EMSCRIPTEN_explicit_uniform_binding.txt
519
var GL_EXPLICIT_UNIFORM_BINDING = false;
520
521
// Deprecated. Pass -sMAX_WEBGL_VERSION=2 to target WebGL 2.0.
522
// [link]
523
var USE_WEBGL2 = false;
524
525
// Specifies the lowest WebGL version to target. Pass -sMIN_WEBGL_VERSION=1
526
// to enable targeting WebGL 1, and -sMIN_WEBGL_VERSION=2 to drop support
527
// for WebGL 1.0
528
// [link]
529
var MIN_WEBGL_VERSION = 1;
530
531
// Specifies the highest WebGL version to target. Pass -sMAX_WEBGL_VERSION=2
532
// to enable targeting WebGL 2. If WebGL 2 is enabled, some APIs (EGL, GLUT, SDL)
533
// will default to creating a WebGL 2 context if no version is specified.
534
// Note that there is no automatic fallback to WebGL1 if WebGL2 is not supported
535
// by the user's device, even if you build with both WebGL1 and WebGL2
536
// support, as that may not always be what the application wants. If you want
537
// such a fallback, you can try to create a context with WebGL2, and if that
538
// fails try to create one with WebGL1.
539
// [link]
540
var MAX_WEBGL_VERSION = 1;
541
542
// If true, emulates some WebGL 1 features on WebGL 2 contexts, meaning that
543
// applications that use WebGL 1/GLES 2 can initialize a WebGL 2/GLES3 context,
544
// but still keep using WebGL1/GLES 2 functionality that no longer is supported
545
// in WebGL2/GLES3. Currently this emulates GL_EXT_shader_texture_lod extension
546
// in GLSLES 1.00 shaders, support for unsized internal texture formats, and the
547
// GL_HALF_FLOAT_OES != GL_HALF_FLOAT mixup.
548
// [link]
549
var WEBGL2_BACKWARDS_COMPATIBILITY_EMULATION = false;
550
551
// Forces support for all GLES3 features, not just the WebGL2-friendly subset.
552
// This automatically turns on FULL_ES2 and WebGL2 support.
553
// [link]
554
var FULL_ES3 = false;
555
556
// Includes code to emulate various desktop GL features. Incomplete but useful
557
// in some cases, see
558
// http://kripken.github.io/emscripten-site/docs/porting/multimedia_and_graphics/OpenGL-support.html
559
// [link]
560
var LEGACY_GL_EMULATION = false;
561
562
// If you specified LEGACY_GL_EMULATION = 1 and only use fixed function pipeline
563
// in your code, you can also set this to 1 to signal the GL emulation layer
564
// that it can perform extra optimizations by knowing that the user code does
565
// not use shaders at all. If LEGACY_GL_EMULATION = 0, this setting has no
566
// effect.
567
// [link]
568
var GL_FFP_ONLY = false;
569
570
// If you want to create the WebGL context up front in JS code, set this to 1
571
// and set Module['preinitializedWebGLContext'] to a precreated WebGL context.
572
// WebGL initialization afterwards will use this GL context to render.
573
// [link]
574
var GL_PREINITIALIZED_CONTEXT = false;
575
576
// Enables the built-in implementation of ``<webgpu/webgpu.h>``.
577
// Deprecated: Please try migrating to ``--use-port=emdawnwebgpu``,
578
// which implements a newer, incompatible version of webgpu.h (see
579
// tools/ports/emdawnwebgpu.py for more info).
580
// [link]
581
// [deprecated]
582
var USE_WEBGPU = false;
583
584
// Enables building of stb-image, a tiny public-domain library for decoding
585
// images, allowing decoding of images without using the browser's built-in
586
// decoders. The benefit is that this can be done synchronously, however, it
587
// will not be as fast as the browser itself. When enabled, stb-image will be
588
// used automatically from IMG_Load and IMG_Load_RW. You can also call the
589
// ``stbi_*`` functions directly yourself.
590
// [link]
591
var STB_IMAGE = false;
592
593
// From Safari 8 (where WebGL was introduced to Safari) onwards, OES_texture_half_float and OES_texture_half_float_linear extensions
594
// are broken and do not function correctly, when used as source textures.
595
// See https://bugs.webkit.org/show_bug.cgi?id=183321, https://bugs.webkit.org/show_bug.cgi?id=169999,
596
// https://stackoverflow.com/questions/54248633/cannot-create-half-float-oes-texture-from-uint16array-on-ipad
597
// [link]
598
var GL_DISABLE_HALF_FLOAT_EXTENSION_IF_BROKEN = false;
599
600
// Workaround Safari WebGL issue: After successfully acquiring WebGL context on a canvas,
601
// calling .getContext() will always return that context independent of which 'webgl' or 'webgl2'
602
// context version was passed. See https://bugs.webkit.org/show_bug.cgi?id=222758 and
603
// https://github.com/emscripten-core/emscripten/issues/13295.
604
// Set this to 0 to force-disable the workaround if you know the issue will not affect you.
605
// [link]
606
var GL_WORKAROUND_SAFARI_GETCONTEXT_BUG = true;
607
608
// If 1, link with support to glGetProcAddress() functionality.
609
// In WebGL, glGetProcAddress() causes a substantial code size and performance impact, since WebGL
610
// does not natively provide such functionality, and it must be emulated. Using glGetProcAddress()
611
// is not recommended. If you still need to use this, e.g. when porting an existing renderer,
612
// you can link with -sGL_ENABLE_GET_PROC_ADDRESS=1 to get support for this functionality.
613
// [link]
614
var GL_ENABLE_GET_PROC_ADDRESS = true;
615
616
// Use JavaScript math functions like Math.tan. This saves code size as we can avoid shipping
617
// compiled musl code. However, it can be significantly slower as it calls out to JS. It
618
// also may give different results as JS math is specced somewhat differently than libc, and
619
// can also vary between browsers.
620
// [link]
621
var JS_MATH = false;
622
623
// If set, enables polyfilling for Math.clz32, Math.trunc, Math.imul, Math.fround.
624
// [link]
625
var POLYFILL_OLD_MATH_FUNCTIONS = false;
626
627
// Set this to enable compatibility emulations for old JavaScript engines. This gives you
628
// the highest possible probability of the code working everywhere, even in rare old
629
// browsers and shell environments. Specifically:
630
//
631
// - Add polyfilling for Math.clz32, Math.trunc, Math.imul, Math.fround. (-sPOLYFILL_OLD_MATH_FUNCTIONS)
632
// - Disable WebAssembly. (Must be paired with -sWASM=0)
633
// - Adjusts MIN_X_VERSION settings to 0 to include support for all browser versions.
634
// - Avoid TypedArray.fill, if necessary, in zeroMemory utility function.
635
//
636
// You can also configure the above options individually.
637
// [link]
638
var LEGACY_VM_SUPPORT = false;
639
640
// Specify which runtime environments the JS output will be capable of running
641
// in. For maximum portability this can configured to support all environments
642
// or it can be limited to reduce overall code size. The supported environments
643
// are:
644
//
645
// - 'web' - the normal web environment.
646
// - 'webview' - just like web, but in a webview like Cordova; considered to be
647
// same as "web" in almost every place
648
// - 'worker' - a web worker environment.
649
// - 'node' - Node.js.
650
// - 'shell' - a JS shell like d8, js, or jsc.
651
//
652
// This setting can be a comma-separated list of these environments, e.g.,
653
// "web,worker". If this is the empty string, then all environments are
654
// supported.
655
//
656
// Note that the set of environments recognized here is not identical to the
657
// ones we identify at runtime using ``ENVIRONMENT_IS_*``. Specifically:
658
//
659
// - We detect whether we are a pthread at runtime, but that's set for workers
660
// and not for the main file so it wouldn't make sense to specify here.
661
// - The webview target is basically a subset of web. It must be specified
662
// alongside web (e.g. "web,webview") and we only use it for code generation
663
// at compile time, there is no runtime behavior change.
664
//
665
// Note that by default we do not include the 'shell' environment since direct
666
// usage of d8, spidermonkey and jsc is extremely rare.
667
// [link]
668
var ENVIRONMENT = ['web', 'webview', 'worker', 'node'];
669
670
// Enable this to support lz4-compressed file packages. They are stored compressed in memory, and
671
// decompressed on the fly, avoiding storing the entire decompressed data in memory at once.
672
// If you run the file packager separately, you still need to build the main program with this flag,
673
// and also pass --lz4 to the file packager.
674
// (You can also manually compress one on the client, using LZ4.loadPackage(), but that is less
675
// recommended.)
676
// Limitations:
677
//
678
// - LZ4-compressed files are only decompressed when needed, so they are not available
679
// for special preloading operations like pre-decoding of images using browser codecs,
680
// preloadPlugin stuff, etc.
681
// - LZ4 files are read-only.
682
//
683
// [link]
684
var LZ4 = false;
685
686
// Emscripten (JavaScript-based) exception handling options.
687
// The three options below (DISABLE_EXCEPTION_CATCHING,
688
// EXCEPTION_CATCHING_ALLOWED, and DISABLE_EXCEPTION_THROWING) only pertain to
689
// JavaScript-based exception handling and do not control the native Wasm
690
// exception handling option (-fwasm-exceptions, internal setting:
691
// WASM_EXCEPTIONS).
692
693
// Disables generating code to actually catch exceptions. This disabling is on
694
// by default as the overhead of exceptions is quite high in size and speed
695
// currently (in the future, wasm should improve that). When exceptions are
696
// disabled, if an exception actually happens then it will not be caught
697
// and the program will halt (so this will not introduce silent failures).
698
//
699
// .. note::
700
//
701
// This removes *catching* of exceptions, which is the main
702
// issue for speed, but you should build source files with
703
// -fno-exceptions to really get rid of all exceptions code overhead,
704
// as it may contain thrown exceptions that are never caught (e.g.
705
// just using std::vector can have that). -fno-rtti may help as well.
706
//
707
// This option is mutually exclusive with EXCEPTION_CATCHING_ALLOWED.
708
//
709
// This option only applies to Emscripten (JavaScript-based) exception handling
710
// and does not control the native Wasm exception handling.
711
//
712
// [compile+link] - affects user code at compile and system libraries at link
713
var DISABLE_EXCEPTION_CATCHING = 1;
714
715
// Enables catching exception but only in the listed functions. This
716
// option acts like a more precise version of ``DISABLE_EXCEPTION_CATCHING=0``.
717
//
718
// This option is mutually exclusive with DISABLE_EXCEPTION_CATCHING.
719
//
720
// This option only applies to Emscripten (JavaScript-based) exception handling
721
// and does not control the native Wasm exception handling.
722
//
723
// [compile+link] - affects user code at compile and system libraries at link
724
var EXCEPTION_CATCHING_ALLOWED = [];
725
726
// Internal: Tracks whether Emscripten should link in exception throwing (C++
727
// 'throw') support library. This does not need to be set directly, but pass
728
// -fno-exceptions to the build disable exceptions support. (This is basically
729
// -fno-exceptions, but checked at final link time instead of individual .cpp
730
// file compile time) If the program *does* contain throwing code (some source
731
// files were not compiled with ``-fno-exceptions``), and this flag is set at link
732
// time, then you will get errors on undefined symbols, as the exception
733
// throwing code is not linked in. If so you should either unset the option (if
734
// you do want exceptions) or fix the compilation of the source files so that
735
// indeed no exceptions are used).
736
// TODO(sbc): Move to settings_internal (current blocked due to use in test
737
// code).
738
//
739
// This option only applies to Emscripten (JavaScript-based) exception handling
740
// and does not control the native Wasm exception handling.
741
//
742
// [link]
743
var DISABLE_EXCEPTION_THROWING = false;
744
745
// Make the exception message printing function, 'getExceptionMessage' available
746
// in the JS library for use, by adding necessary symbols to EXPORTED_FUNCTIONS.
747
//
748
// This works with both Emscripten EH and Wasm EH. When you catch an exception
749
// from JS, that gives you a user-thrown value in case of Emscripten EH, and a
750
// WebAssembly.Exception object in case of Wasm EH. 'getExceptionMessage' takes
751
// the user-thrown value in case of Emscripten EH and the WebAssembly.Exception
752
// object in case of Wasm EH, meaning in both cases you can pass a caught
753
// exception directly to the function.
754
//
755
// When used with Wasm EH, this option additionally provides these functions in
756
// the JS library:
757
//
758
// - getCppExceptionTag: Returns the C++ tag
759
// - getCppExceptionThrownObjectFromWebAssemblyException:
760
// Given an WebAssembly.Exception object, returns the actual user-thrown C++
761
// object address in Wasm memory.
762
//
763
// Setting this option also adds refcount increasing and decreasing functions
764
// ('incrementExceptionRefcount' and 'decrementExceptionRefcount') in the JS
765
// library because if you catch an exception from JS, you may need to manipulate
766
// the refcount manually not to leak memory. What you need to do is different
767
// depending on the kind of EH you use
768
// (https://github.com/emscripten-core/emscripten/issues/17115).
769
//
770
// See test_EXPORT_EXCEPTION_HANDLING_HELPERS in test/test_core.py for an
771
// example usage.
772
var EXPORT_EXCEPTION_HANDLING_HELPERS = false;
773
774
// When this is enabled, exceptions will contain stack traces and uncaught
775
// exceptions will display stack traces upon exiting. This defaults to true when
776
// ASSERTIONS is enabled. This option is for users who want exceptions' stack
777
// traces but do not want other overheads ASSERTIONS can incur.
778
// This option implies EXPORT_EXCEPTION_HANDLING_HELPERS.
779
// [link]
780
var EXCEPTION_STACK_TRACES = false;
781
782
// If true, emit instructions for the legacy Wasm exception handling proposal:
783
// https://github.com/WebAssembly/exception-handling/blob/main/proposals/exception-handling/legacy/Exceptions.md
784
// If false, emit instructions for the standardized exception handling proposal:
785
// https://github.com/WebAssembly/exception-handling/blob/main/proposals/exception-handling/Exceptions.md
786
// [compile+link]
787
var WASM_LEGACY_EXCEPTIONS = true;
788
789
// Emscripten throws an ExitStatus exception to unwind when exit() is called.
790
// Without this setting enabled this can show up as a top level unhandled
791
// exception.
792
//
793
// With this setting enabled a global uncaughtException handler is used to
794
// catch and handle ExitStatus exceptions. However, this means all other
795
// uncaught exceptions are also caught and re-thrown, which is not always
796
// desirable.
797
//
798
// [link]
799
var NODEJS_CATCH_EXIT = false;
800
801
// Catch unhandled rejections in node. This only effect versions of node older
802
// than 15. Without this, old version node will print a warning, but exit
803
// with a zero return code. With this setting enabled, we handle any unhandled
804
// rejection and throw an exception, which will cause the process exit
805
// immediately with a non-0 return code.
806
// This not needed in Node 15+ so this setting will default to false if
807
// MIN_NODE_VERSION is 150000 or above.
808
// [link]
809
var NODEJS_CATCH_REJECTION = true;
810
811
// Whether to support async operations in the compiled code. This makes it
812
// possible to call JS functions from synchronous-looking code in C/C++.
813
//
814
// - 1 (default): Run binaryen's Asyncify pass to transform the code using
815
// asyncify. This emits a normal wasm file in the end, so it works everywhere,
816
// but it has a significant cost in terms of code size and speed.
817
// See https://emscripten.org/docs/porting/asyncify.html
818
// - 2 (deprecated): Use ``-sJSPI`` instead.
819
//
820
// [link]
821
var ASYNCIFY = 0;
822
823
// Imports which can do an async operation, in addition to the default ones that
824
// emscripten defines like emscripten_sleep. If you add more you will need to
825
// mention them to here, or else they will not work (in ASSERTIONS builds an
826
// error will be shown).
827
// Note that this list used to contain the default ones, which meant that you
828
// had to list them when adding your own; the default ones are now added
829
// automatically.
830
// [link]
831
var ASYNCIFY_IMPORTS = [];
832
833
// Whether indirect calls can be on the stack during an unwind/rewind.
834
// If you know they cannot, then setting this can be extremely helpful, as otherwise asyncify
835
// must assume an indirect call can reach almost everywhere.
836
// [link]
837
var ASYNCIFY_IGNORE_INDIRECT = false;
838
839
// The size of the asyncify stack - the region used to store unwind/rewind
840
// info. This must be large enough to store the call stack and locals. If it is too
841
// small, you will see a wasm trap due to executing an "unreachable" instruction.
842
// In that case, you should increase this size.
843
// [link]
844
var ASYNCIFY_STACK_SIZE = 4096;
845
846
// If the Asyncify remove-list is provided, then the functions in it will not
847
// be instrumented even if it looks like they need to. This can be useful
848
// if you know things the whole-program analysis doesn't, like if you
849
// know certain indirect calls are safe and won't unwind. But if you
850
// get the list wrong things will break (and in a production build user
851
// input might reach code paths you missed during testing, so it's hard
852
// to know you got this right), so this is not recommended unless you
853
// really know what are doing, and need to optimize every bit of speed
854
// and size.
855
//
856
// The names in this list are names from the WebAssembly Names section. The
857
// wasm backend will emit those names in *human-readable* form instead of
858
// typical C++ mangling. For example, you should write Struct::func()
859
// instead of _ZN6Struct4FuncEv. C is also different from C++, as C
860
// names don't end with parameters; as a result foo(int) in C++ would appear
861
// as just foo in C (C++ has parameters because it needs to differentiate
862
// overloaded functions). You will see warnings in the console if a name in the
863
// list is missing (these are not errors because inlining etc. may cause
864
// changes which would mean a single list couldn't work for both -O0 and -O1
865
// builds, etc.). You can inspect the wasm binary to look for the actual names,
866
// either directly or using wasm-objdump or wasm-dis, etc.
867
//
868
// Simple ``*`` wildcard matching is supported.
869
//
870
// To avoid dealing with limitations in operating system shells or build system
871
// escaping, the following substitutions can be made:
872
//
873
// - ' ' -> ``.``,
874
// - ``&`` -> ``#``,
875
// - ``,`` -> ``?``.
876
//
877
// That is, the function `"foo(char const*, int&)"` can be inputted as
878
// `"foo(char.const*?.int#)"` on the command line instead.
879
//
880
// Note: Whitespace is part of the function signature! I.e.
881
// "foo(char const *, int &)" will not match "foo(char const*, int&)", and
882
// neither would "foo(const char*, int &)".
883
//
884
// [link]
885
var ASYNCIFY_REMOVE = [];
886
887
// Functions in the Asyncify add-list are added to the list of instrumented
888
// functions, that is, they will be instrumented even if otherwise asyncify
889
// thinks they don't need to be. As by default everything will be instrumented
890
// in the safest way possible, this is only useful if you use IGNORE_INDIRECT
891
// and use this list to fix up some indirect calls that *do* need to be
892
// instrumented.
893
//
894
// See notes on ASYNCIFY_REMOVE about the names, including wildcard matching and
895
// character substitutions.
896
// [link]
897
var ASYNCIFY_ADD = [];
898
899
// If enabled, instrumentation status will be propagated from the add-list, ie.
900
// their callers, and their callers' callers, and so on. If disabled then all
901
// callers must be manually added to the add-list (like the only-list).
902
// [link]
903
var ASYNCIFY_PROPAGATE_ADD = true;
904
905
// If the Asyncify only-list is provided, then *only* the functions in the list
906
// will be instrumented. Like the remove-list, getting this wrong will break
907
// your application.
908
//
909
// See notes on ASYNCIFY_REMOVE about the names, including wildcard matching and
910
// character substitutions.
911
// [link]
912
var ASYNCIFY_ONLY = [];
913
914
// If enabled will output which functions have been instrumented and why.
915
// [link]
916
var ASYNCIFY_ADVISE = false;
917
918
// Allows lazy code loading: where emscripten_lazy_load_code() is written, we
919
// will pause execution, load the rest of the code, and then resume.
920
// [link]
921
// [deprecated]
922
var ASYNCIFY_LAZY_LOAD_CODE = false;
923
924
// Runtime debug logging from asyncify internals.
925
//
926
// - 1: Minimal logging.
927
// - 2: Verbose logging.
928
//
929
// [link]
930
var ASYNCIFY_DEBUG = 0;
931
932
// Deprecated, use JSPI_EXPORTS instead.
933
// [deprecated]
934
var ASYNCIFY_EXPORTS = [];
935
936
// Use VM support for the JavaScript Promise Integration proposal. This allows
937
// async operations to happen without the overhead of modifying the wasm. This
938
// is experimental atm while spec discussion is ongoing, see
939
// https://github.com/WebAssembly/js-promise-integration/ TODO: document which
940
// of the following flags are still relevant in this mode (e.g. IGNORE_INDIRECT
941
// etc. are not needed)
942
//
943
// [link]
944
var JSPI = 0;
945
946
// A list of exported module functions that will be asynchronous. Each export
947
// will return a ``Promise`` that will be resolved with the result. Any exports
948
// that will call an asynchronous import (listed in ``JSPI_IMPORTS``) must be
949
// included here.
950
//
951
// By default this includes ``main``.
952
// [link]
953
var JSPI_EXPORTS = [];
954
955
956
// A list of imported module functions that will potentially do asynchronous
957
// work. The imported function should return a ``Promise`` when doing
958
// asynchronous work.
959
//
960
// Note when using JS library files, the function can be marked with
961
// ``<function_name>_async:: true`` in the library instead of this setting.
962
// [link]
963
var JSPI_IMPORTS = [];
964
965
// Runtime elements that are exported on Module by default. We used to export
966
// quite a lot here, but have removed them all. You should use
967
// EXPORTED_RUNTIME_METHODS for things you want to export from the runtime.
968
// Note that the name may be slightly misleading, as this is for any JS library
969
// element, and not just methods. For example, we can export the FS object by
970
// having "FS" in this list.
971
// [link]
972
var EXPORTED_RUNTIME_METHODS = [];
973
974
// A list of incoming values on the Module object in JS that we care about. If
975
// a value is not in this list, then we don't emit code to check if you provide
976
// it on the Module object. For example, if
977
// you have this::
978
//
979
// var Module = {
980
// print: (x) => console.log('print: ' + x),
981
// preRun: [() => console.log('pre run')]
982
// };
983
//
984
// Then MODULE_JS_API must contain 'print' and 'preRun'; if it does not then
985
// we may not emit code to read and use that value. In other words, this
986
// option lets you set, statically at compile time, the list of which Module
987
// JS values you will be providing at runtime, so the compiler can better
988
// optimize.
989
//
990
// Setting this list to [], or at least a short and concise set of names you
991
// actually use, can be very useful for reducing code size. By default, the
992
// list contains a set of commonly used symbols.
993
//
994
// FIXME: should this just be 0 if we want everything?
995
// [link]
996
var INCOMING_MODULE_JS_API = [
997
'ENVIRONMENT', 'GL_MAX_TEXTURE_IMAGE_UNITS', 'SDL_canPlayWithWebAudio',
998
'SDL_numSimultaneouslyQueuedBuffers', 'INITIAL_MEMORY', 'wasmMemory', 'arguments',
999
'buffer', 'canvas', 'doNotCaptureKeyboard', 'dynamicLibraries',
1000
'elementPointerLock', 'extraStackTrace', 'forcedAspectRatio',
1001
'instantiateWasm', 'keyboardListeningElement', 'freePreloadedMediaOnUse',
1002
'loadSplitModule', 'locateFile', 'logReadFiles', 'mainScriptUrlOrBlob', 'mem',
1003
'monitorRunDependencies', 'noExitRuntime', 'noInitialRun', 'onAbort',
1004
'onCustomMessage', 'onExit', 'onFree', 'onFullScreen', 'onMalloc',
1005
'onRealloc', 'onRuntimeInitialized', 'postMainLoop', 'postRun', 'preInit',
1006
'preMainLoop', 'preRun',
1007
'preinitializedWebGLContext', 'preloadPlugins',
1008
'print', 'printErr', 'setStatus', 'statusMessage', 'stderr',
1009
'stdin', 'stdout', 'thisProgram', 'wasm', 'wasmBinary', 'websocket'
1010
];
1011
1012
// If set to nonzero, the provided virtual filesystem if treated
1013
// case-insensitive, like Windows and macOS do. If set to 0, the VFS is
1014
// case-sensitive, like on Linux.
1015
// [link]
1016
var CASE_INSENSITIVE_FS = false;
1017
1018
// If set to 0, does not build in any filesystem support. Useful if you are just
1019
// doing pure computation, but not reading files or using any streams (including
1020
// fprintf, and other stdio.h things) or anything related. The one exception is
1021
// there is partial support for printf, and puts, hackishly. The compiler will
1022
// automatically set this if it detects that syscall usage (which is static)
1023
// does not require a full filesystem. If you still want filesystem support, use
1024
// FORCE_FILESYSTEM
1025
// [link]
1026
var FILESYSTEM = true;
1027
1028
// Makes full filesystem support be included, even if statically it looks like
1029
// it is not used. For example, if your C code uses no files, but you include
1030
// some JS that does, you might need this.
1031
// [link]
1032
var FORCE_FILESYSTEM = false;
1033
1034
// Enables support for the NODERAWFS filesystem backend. This is a special
1035
// backend as it replaces all normal filesystem access with direct Node.js
1036
// operations, without the need to do ``FS.mount()``, and this backend only
1037
// works with Node.js. The initial working directory will be same as
1038
// process.cwd() instead of VFS root directory. Because this mode directly uses
1039
// Node.js to access the real local filesystem on your OS, the code will not
1040
// necessarily be portable between OSes - it will be as portable as a Node.js
1041
// program would be, which means that differences in how the underlying OS
1042
// handles permissions and errors and so forth may be noticeable.
1043
// [link]
1044
var NODERAWFS = false;
1045
1046
// This saves the compiled wasm module in a file with name
1047
// ``$WASM_BINARY_NAME.$V8_VERSION.cached``
1048
// and loads it on subsequent runs. This caches the compiled wasm code from
1049
// v8 in node, which saves compiling on subsequent runs, making them start up
1050
// much faster.
1051
// The V8 version used in node is included in the cache name so that we don't
1052
// try to load cached code from another version, which fails silently (it seems
1053
// to load ok, but we do actually recompile).
1054
//
1055
// - The only version known to work for sure is node 12.9.1, as this has
1056
// regressed, see
1057
// https://github.com/nodejs/node/issues/18265#issuecomment-622971547
1058
// - The default location of the .cached files is alongside the wasm binary,
1059
// as mentioned earlier. If that is in a read-only directory, you may need
1060
// to place them elsewhere. You can use the locateFile() hook to do so.
1061
//
1062
// [link]
1063
var NODE_CODE_CACHING = false;
1064
1065
// Symbols that are explicitly exported. These symbols are kept alive through
1066
// LLVM dead code elimination, and also made accessible outside of the
1067
// generated code even after running closure compiler (on "Module"). Native
1068
// symbols listed here require an ``_`` prefix.
1069
//
1070
// By default if this setting is not specified on the command line the
1071
// ``_main`` function will be implicitly exported. In STANDALONE_WASM mode the
1072
// default export is ``__start`` (or ``__initialize`` if --no-entry is specified).
1073
//
1074
// JS Library symbols can also be added to this list (without the leading `$`).
1075
// [link]
1076
var EXPORTED_FUNCTIONS = [];
1077
1078
// If true, we export all the symbols that are present in JS onto the Module
1079
// object. This does not affect which symbols will be present - it does not
1080
// prevent DCE or cause anything to be included in linking. It only does
1081
// ``Module['X'] = X;``
1082
// for all X that end up in the JS file. This is useful to export the JS
1083
// library functions on Module, for things like dynamic linking.
1084
// [link]
1085
var EXPORT_ALL = false;
1086
1087
// If true, we export the symbols that are present in JS onto the Module
1088
// object.
1089
// It only does ``Module['X'] = X;``
1090
var EXPORT_KEEPALIVE = true;
1091
1092
// Remembers the values of these settings, and makes them accessible
1093
// through getCompilerSetting and emscripten_get_compiler_setting.
1094
// To see what is retained, look for compilerSettings in the generated code.
1095
// [link]
1096
var RETAIN_COMPILER_SETTINGS = false;
1097
1098
// JS library elements (C functions implemented in JS) that we include by
1099
// default. If you want to make sure something is included by the JS compiler,
1100
// add it here. For example, if you do not use some ``emscripten_*`` C API call
1101
// from C, but you want to call it from JS, add it here.
1102
// Note that the name may be slightly misleading, as this is for any JS
1103
// library element, and not just functions. For example, you can include the
1104
// Browser object by adding "$Browser" to this list.
1105
//
1106
// If you want to both include and export a JS library symbol, it is enough to
1107
// simply add it to EXPORTED_FUNCTIONS, without also adding it to
1108
// DEFAULT_LIBRARY_FUNCS_TO_INCLUDE.
1109
// [link]
1110
var DEFAULT_LIBRARY_FUNCS_TO_INCLUDE = [];
1111
1112
// Include all JS library functions instead of the sum of
1113
// DEFAULT_LIBRARY_FUNCS_TO_INCLUDE + any functions used by the generated code.
1114
// This is needed when dynamically loading (i.e. dlopen) modules that make use
1115
// of runtime library functions that are not used in the main module. Note that
1116
// this only applies to js libraries, *not* C. You will need the main file to
1117
// include all needed C libraries. For example, if a module uses malloc or new,
1118
// you will need to use those in the main file too to pull in malloc for use by
1119
// the module.
1120
// [link]
1121
var INCLUDE_FULL_LIBRARY = false;
1122
1123
// If set to 1, we emit relocatable code from the LLVM backend; both
1124
// globals and function pointers are all offset (by gb and fp, respectively)
1125
// Automatically set for SIDE_MODULE or MAIN_MODULE.
1126
// [compile+link]
1127
var RELOCATABLE = false;
1128
1129
// A main module is a file compiled in a way that allows us to link it to
1130
// a side module at runtime.
1131
//
1132
// - 1: Normal main module.
1133
// - 2: DCE'd main module. We eliminate dead code normally. If a side
1134
// module needs something from main, it is up to you to make sure
1135
// it is kept alive.
1136
//
1137
// [compile+link]
1138
var MAIN_MODULE = 0;
1139
1140
// Corresponds to MAIN_MODULE (also supports modes 1 and 2)
1141
// [compile+link]
1142
var SIDE_MODULE = 0;
1143
1144
// Deprecated, list shared libraries directly on the command line instead.
1145
// [link]
1146
// [deprecated]
1147
var RUNTIME_LINKED_LIBS = [];
1148
1149
// If set to 1, this is a worker library, a special kind of library that is run
1150
// in a worker. See emscripten.h
1151
// [link]
1152
var BUILD_AS_WORKER = false;
1153
1154
// If set to 1, we build the project into a js file that will run in a worker,
1155
// and generate an html file that proxies input and output to/from it.
1156
// [link]
1157
var PROXY_TO_WORKER = false;
1158
1159
// If set, the script file name the main thread loads. Useful if your project
1160
// doesn't run the main emscripten- generated script immediately but does some
1161
// setup before
1162
// [link]
1163
var PROXY_TO_WORKER_FILENAME = '';
1164
1165
// If set to 1, compiles in a small stub main() in between the real main() which
1166
// calls pthread_create() to run the application main() in a pthread. This is
1167
// something that applications can do manually as well if they wish, this option
1168
// is provided as convenience.
1169
//
1170
// The pthread that main() runs on is a normal pthread in all ways, with the one
1171
// difference that its stack size is the same as the main thread would normally
1172
// have, that is, STACK_SIZE. This makes it easy to flip between
1173
// PROXY_TO_PTHREAD and non-PROXY_TO_PTHREAD modes with main() always getting
1174
// the same amount of stack.
1175
//
1176
// This proxies Module['canvas'], if present, and if OFFSCREENCANVAS_SUPPORT
1177
// is enabled. This has to happen because this is the only chance - this browser
1178
// main thread does the only pthread_create call that happens on
1179
// that thread, so it's the only chance to transfer the canvas from there.
1180
// [link]
1181
var PROXY_TO_PTHREAD = false;
1182
1183
// If set to 1, this file can be linked with others, either as a shared library
1184
// or as the main file that calls a shared library. To enable that, we will not
1185
// internalize all symbols and cull the unused ones, in other words, we will not
1186
// remove unused functions and globals, which might be used by another module we
1187
// are linked with.
1188
//
1189
// MAIN_MODULE and SIDE_MODULE both imply this, so it not normally necessary
1190
// to set this explicitly. Note that MAIN_MODULE and SIDE_MODULE mode 2 do
1191
// *not* set this, so that we still do normal DCE on them, and in that case
1192
// you must keep relevant things alive yourself using exporting.
1193
// [link]
1194
var LINKABLE = false;
1195
1196
// Emscripten 'strict' build mode: Drop supporting any deprecated build options.
1197
// Set the environment variable EMCC_STRICT=1 or pass -sSTRICT to test that a
1198
// codebase builds nicely in forward compatible manner.
1199
// Changes enabled by this:
1200
//
1201
// - The C define EMSCRIPTEN is not defined (__EMSCRIPTEN__ always is, and
1202
// is the correct thing to use).
1203
// - STRICT_JS is enabled.
1204
// - IGNORE_MISSING_MAIN is disabled.
1205
// - AUTO_JS_LIBRARIES is disabled.
1206
// - AUTO_NATIVE_LIBRARIES is disabled.
1207
// - DEFAULT_TO_CXX is disabled.
1208
// - USE_GLFW is set to 0 rather than 2 by default.
1209
// - ALLOW_UNIMPLEMENTED_SYSCALLS is disabled.
1210
// - INCOMING_MODULE_JS_API is set to empty by default.
1211
// [compile+link]
1212
var STRICT = false;
1213
1214
// Allow program to link with or without ``main`` symbol.
1215
// If this is disabled then one must provide a ``main`` symbol or explicitly
1216
// opt out by passing ``--no-entry`` or an EXPORTED_FUNCTIONS list that doesn't
1217
// include ``_main``.
1218
// [link]
1219
var IGNORE_MISSING_MAIN = true;
1220
1221
// Add ``"use strict;"`` to generated JS
1222
// [link]
1223
var STRICT_JS = false;
1224
1225
// If set to 1, we will warn on any undefined symbols that are not resolved by
1226
// the ``library_*.js`` files. Note that it is common in large projects to not
1227
// implement everything, when you know what is not going to actually be called
1228
// (and don't want to mess with the existing buildsystem), and functions might
1229
// be implemented later on, say in --pre-js, so you may want to build with -s
1230
// WARN_ON_UNDEFINED_SYMBOLS=0 to disable the warnings if they annoy you. See
1231
// also ERROR_ON_UNDEFINED_SYMBOLS. Any undefined symbols that are listed in-
1232
// EXPORTED_FUNCTIONS will also be reported.
1233
// [link]
1234
var WARN_ON_UNDEFINED_SYMBOLS = true;
1235
1236
// If set to 1, we will give a link-time error on any undefined symbols (see
1237
// WARN_ON_UNDEFINED_SYMBOLS). To allow undefined symbols at link time set this
1238
// to 0, in which case if an undefined function is called a runtime error will
1239
// occur. Any undefined symbols that are listed in EXPORTED_FUNCTIONS will also
1240
// be reported.
1241
// [link]
1242
var ERROR_ON_UNDEFINED_SYMBOLS = true;
1243
1244
// Use small chunk size for binary synchronous XHR's in Web Workers. Used for
1245
// testing. See test_chunked_synchronous_xhr in runner.py and library.js.
1246
// [link]
1247
var SMALL_XHR_CHUNKS = false;
1248
1249
// If 1, we force Date.now(), Math.random, etc. to return deterministic results.
1250
// This also tries to make execution deterministic across machines and
1251
// environments, for example, not doing anything different based on the
1252
// browser's language setting (which would mean you can get different results
1253
// in different browsers, or in the browser and in node).
1254
// Good for comparing builds for debugging purposes (and nothing else).
1255
// [link]
1256
var DETERMINISTIC = false;
1257
1258
// By default we emit all code in a straightforward way into the output
1259
// .js file. That means that if you load that in a script tag in a web
1260
// page, it will use the global scope. With ``MODULARIZE`` set, we instead emit
1261
// the code wrapped in an async function. This function returns a promise that
1262
// resolves to a module instance once it is safe to run the compiled code
1263
// (similar to the ``onRuntimeInitialized`` callback).
1264
//
1265
// The default name of the function is ``Module``, but can be changed using the
1266
// ``EXPORT_NAME`` option. We recommend renaming it to a more typical name for a
1267
// factory function, e.g. ``createModule``.
1268
//
1269
// You use the factory function like so::
1270
//
1271
// const module = await EXPORT_NAME();
1272
//
1273
// or::
1274
//
1275
// let module;
1276
// EXPORT_NAME().then(instance => {
1277
// module = instance;
1278
// });
1279
//
1280
//
1281
// The factory function accepts 1 parameter, an object with default values for
1282
// the module instance::
1283
//
1284
// const module = await EXPORT_NAME({ option: value, ... });
1285
//
1286
// Note the parentheses - we are calling EXPORT_NAME in order to instantiate
1287
// the module. This allows you to create multiple instances of the module.
1288
//
1289
// Note that in MODULARIZE mode we do *not* look for a global ``Module`` object
1290
// for default values. Default values must be passed as a parameter to the
1291
// factory function.
1292
//
1293
// The default .html shell file provided in MINIMAL_RUNTIME mode will create
1294
// a singleton instance automatically, to run the application on the page.
1295
// (Note that it does so without using the Promise API mentioned earlier, and
1296
// so code for the Promise is not even emitted in the .js file if you tell
1297
// emcc to emit an .html output.)
1298
// The default .html shell file provided by traditional runtime mode is only
1299
// compatible with MODULARIZE=0 mode, so when building with traditional
1300
// runtime, you should provided your own html shell file to perform the
1301
// instantiation when building with MODULARIZE=1. (For more details, see
1302
// https://github.com/emscripten-core/emscripten/issues/7950)
1303
//
1304
// If you add --pre-js or --post-js files, they will be included inside
1305
// the factory function with the rest of the emitted code in order to be
1306
// optimized together with it.
1307
//
1308
// If you want to include code outside all of the generated code, including the
1309
// factory function, you can use --extern-pre-js or --extern-post-js. While
1310
// --pre-js and --post-js happen to do that in non-MODULARIZE mode, their
1311
// intended usage is to add code that is optimized with the rest of the emitted
1312
// code, allowing better dead code elimination and minification.
1313
//
1314
// Experimental Feature - Instance ES Modules:
1315
//
1316
// Note this feature is still under active development and is subject to change!
1317
//
1318
// To enable this feature use -sMODULARIZE=instance. Enabling this mode will
1319
// produce an ES module that is a singleton with ES module exports. The
1320
// module will export a default value that is an async init function and will
1321
// also export named values that correspond to the Wasm exports and runtime
1322
// exports. The init function must be called before any of the exports can be
1323
// used. An example of using the module is below.
1324
//
1325
// import init, { foo, bar } from "./my_module.mjs"
1326
// await init(optionalArguments);
1327
// foo();
1328
// bar();
1329
//
1330
// [link]
1331
var MODULARIZE = false;
1332
1333
// Export using an ES6 Module export rather than a UMD export. MODULARIZE must
1334
// be enabled for ES6 exports and is implicitly enabled if not already set.
1335
//
1336
// This is implicitly enabled if the output suffix is set to 'mjs'.
1337
//
1338
// [link]
1339
var EXPORT_ES6 = false;
1340
1341
// Global variable to export the module as for environments without a
1342
// standardized module loading system (e.g. the browser and SM shell).
1343
// [link]
1344
var EXPORT_NAME = 'Module';
1345
1346
// When set to 0, we do not emit eval() and new Function(), which disables some
1347
// functionality (causing runtime errors if attempted to be used), but allows
1348
// the emitted code to be acceptable in places that disallow dynamic code
1349
// execution (chrome packaged app, privileged firefox app, etc.). Pass this flag
1350
// when developing an Emscripten application that is targeting a privileged or a
1351
// certified execution environment, see Firefox Content Security Policy (CSP)
1352
// webpage for details:
1353
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src
1354
// in particular the 'unsafe-eval' and 'wasm-unsafe-eval' policies.
1355
//
1356
// When this flag is set, the following features (linker flags) are unavailable:
1357
//
1358
// - RELOCATABLE: the function loadDynamicLibrary would need to eval().
1359
//
1360
// and some features may fall back to slower code paths when they need to:
1361
// Embind: uses eval() to jit functions for speed.
1362
//
1363
// Additionally, the following Emscripten runtime functions are unavailable when
1364
// DYNAMIC_EXECUTION=0 is set, and an attempt to call them will throw an exception:
1365
//
1366
// - emscripten_run_script(),
1367
// - emscripten_run_script_int(),
1368
// - emscripten_run_script_string(),
1369
// - dlopen(),
1370
// - the functions ccall() and cwrap() are still available, but they are
1371
// restricted to only being able to call functions that have been exported in
1372
// the Module object in advance.
1373
//
1374
// When -sDYNAMIC_EXECUTION=2 is set, attempts to call to eval() are demoted to
1375
// warnings instead of throwing an exception.
1376
// [link]
1377
var DYNAMIC_EXECUTION = 1;
1378
1379
// whether we are in the generate struct_info bootstrap phase
1380
// [link]
1381
var BOOTSTRAPPING_STRUCT_INFO = false;
1382
1383
// Add some calls to emscripten tracing APIs
1384
// [compile+link]
1385
var EMSCRIPTEN_TRACING = false;
1386
1387
// Specify the GLFW version that is being linked against. Only relevant, if you
1388
// are linking against the GLFW library. Valid options are 2 for GLFW2 and 3
1389
// for GLFW3.
1390
// [link]
1391
var USE_GLFW = 0;
1392
1393
// Whether to use compile code to WebAssembly. Set this to 0 to compile to JS
1394
// instead of wasm.
1395
//
1396
// Specify -sWASM=2 to target both WebAssembly and JavaScript at the same time.
1397
// In that build mode, two files a.wasm and a.wasm.js are produced, and at runtime
1398
// the WebAssembly file is loaded if browser/shell supports it. Otherwise the
1399
// .wasm.js fallback will be used.
1400
//
1401
// If WASM=2 is enabled and the browser fails to compile the WebAssembly module,
1402
// the page will be reloaded in Wasm2JS mode.
1403
// [link]
1404
var WASM = 1;
1405
1406
// STANDALONE_WASM indicates that we want to emit a wasm file that can run
1407
// without JavaScript. The file will use standard APIs such as wasi as much as
1408
// possible to achieve that.
1409
//
1410
// This option does not guarantee that the wasm can be used by itself - if you
1411
// use APIs with no non-JS alternative, we will still use those (e.g., OpenGL
1412
// at the time of writing this). This gives you the option to see which APIs
1413
// are missing, and if you are compiling for a custom wasi embedding, to add
1414
// those to your embedding.
1415
//
1416
// We may still emit JS with this flag, but the JS should only be a convenient
1417
// way to run the wasm on the Web or in Node.js, and you can run the wasm by
1418
// itself without that JS (again, unless you use APIs for which there is no
1419
// non-JS alternative) in a wasm runtime like wasmer or wasmtime.
1420
//
1421
// Note that even without this option we try to use wasi etc. syscalls as much
1422
// as possible. What this option changes is that we do so even when it means
1423
// a tradeoff with JS size. For example, when this option is set we do not
1424
// import the Memory - importing it is useful for JS, so that JS can start to
1425
// use it before the wasm is even loaded, but in wasi and other wasm-only
1426
// environments the expectation is to create the memory in the wasm itself.
1427
// Doing so prevents some possible JS optimizations, so we only do it behind
1428
// this flag.
1429
//
1430
// When this flag is set we do not legalize the JS interface, since the wasm is
1431
// meant to run in a wasm VM, which can handle i64s directly. If we legalized it
1432
// the wasm VM would not recognize the API. However, this means that the
1433
// optional JS emitted won't run if you use a JS API with an i64. You can use
1434
// the WASM_BIGINT option to avoid that problem by using BigInts for i64s which
1435
// means we don't need to legalize for JS (but this requires a new enough JS
1436
// VM).
1437
//
1438
// Standalone builds require a ``main`` entry point by default. If you want to
1439
// build a library (also known as a reactor) instead you can pass ``--no-entry``.
1440
// [link]
1441
var STANDALONE_WASM = false;
1442
1443
// Whether to ignore implicit traps when optimizing in binaryen. Implicit
1444
// traps are the traps that happen in a load that is out of bounds, or
1445
// div/rem of 0, etc. With this option set, the optimizer assumes that loads
1446
// cannot trap, and therefore that they have no side effects at all. This
1447
// is *not* safe in general, as you may have a load behind a condition which
1448
// ensures it it is safe; but if the load is assumed to not have side effects it
1449
// could be executed unconditionally. For that reason this option is generally
1450
// not useful on large and complex projects, but in a small and simple enough
1451
// codebase it may help reduce code size a little bit.
1452
// [link]
1453
var BINARYEN_IGNORE_IMPLICIT_TRAPS = false;
1454
1455
// A comma-separated list of extra passes to run in the binaryen optimizer,
1456
// Setting this does not override/replace the default passes. It is appended at
1457
// the end of the list of passes.
1458
// [link]
1459
var BINARYEN_EXTRA_PASSES = "";
1460
1461
// Whether to compile the wasm asynchronously, which is more efficient and does
1462
// not block the main thread. This is currently required for all but the
1463
// smallest modules to run in chrome.
1464
//
1465
// (This option was formerly called BINARYEN_ASYNC_COMPILATION)
1466
// [link]
1467
var WASM_ASYNC_COMPILATION = true;
1468
1469
// If set to 1, the dynCall() and dynCall_sig() API is made available
1470
// to caller.
1471
// [link]
1472
var DYNCALLS = false;
1473
1474
// WebAssembly integration with JavaScript BigInt. When enabled we don't need to
1475
// legalize i64s into pairs of i32s, as the wasm VM will use a BigInt where an
1476
// i64 is used.
1477
// [link]
1478
var WASM_BIGINT = true;
1479
1480
// WebAssembly defines a "producers section" which compilers and tools can
1481
// annotate themselves in, and LLVM emits this by default.
1482
// Emscripten will strip that out so that it is *not* emitted because it
1483
// increases code size, and also some users may not want information
1484
// about their tools to be included in their builds for privacy or security
1485
// reasons, see
1486
// https://github.com/WebAssembly/tool-conventions/issues/93.
1487
// [link]
1488
var EMIT_PRODUCERS_SECTION = false;
1489
1490
// Emits emscripten license info in the JS output.
1491
// [link]
1492
var EMIT_EMSCRIPTEN_LICENSE = false;
1493
1494
// Whether to legalize the JS FFI interfaces (imports/exports) by wrapping them
1495
// to automatically demote i64 to i32 and promote f32 to f64. This is necessary
1496
// in order to interface with JavaScript. For non-web/non-JS embeddings, setting
1497
// this to 0 may be desirable.
1498
// [link]
1499
// [deprecated]
1500
var LEGALIZE_JS_FFI = true;
1501
1502
// Ports
1503
1504
// Specify the SDL version that is being linked against.
1505
// 1, the default, is 1.3, which is implemented in JS
1506
// 2 is a port of the SDL C code on emscripten-ports
1507
// When AUTO_JS_LIBRARIES is set to 0 this defaults to 0 and SDL
1508
// is not linked in.
1509
// Alternate syntax for using the port: --use-port=sdl2
1510
// [compile+link]
1511
var USE_SDL = 0;
1512
1513
// Specify the SDL_gfx version that is being linked against. Must match USE_SDL
1514
// [compile+link]
1515
var USE_SDL_GFX = 0;
1516
1517
// Specify the SDL_image version that is being linked against. Must match USE_SDL
1518
// [compile+link]
1519
var USE_SDL_IMAGE = 1;
1520
1521
// Specify the SDL_ttf version that is being linked against. Must match USE_SDL
1522
// [compile+link]
1523
var USE_SDL_TTF = 1;
1524
1525
// Specify the SDL_net version that is being linked against. Must match USE_SDL
1526
// [compile+link]
1527
var USE_SDL_NET = 1;
1528
1529
// 1 = use icu from emscripten-ports
1530
// Alternate syntax: --use-port=icu
1531
// [compile+link]
1532
var USE_ICU = false;
1533
1534
// 1 = use zlib from emscripten-ports
1535
// Alternate syntax: --use-port=zlib
1536
// [compile+link]
1537
var USE_ZLIB = false;
1538
1539
// 1 = use bzip2 from emscripten-ports
1540
// Alternate syntax: --use-port=bzip2
1541
// [compile+link]
1542
var USE_BZIP2 = false;
1543
1544
// 1 = use giflib from emscripten-ports
1545
// Alternate syntax: --use-port=giflib
1546
// [compile+link]
1547
var USE_GIFLIB = false;
1548
1549
// 1 = use libjpeg from emscripten-ports
1550
// Alternate syntax: --use-port=libjpeg
1551
// [compile+link]
1552
var USE_LIBJPEG = false;
1553
1554
// 1 = use libpng from emscripten-ports
1555
// Alternate syntax: --use-port=libpng
1556
// [compile+link]
1557
var USE_LIBPNG = false;
1558
1559
// 1 = use Regal from emscripten-ports
1560
// Alternate syntax: --use-port=regal
1561
// [compile+link]
1562
var USE_REGAL = false;
1563
1564
// 1 = use Boost headers from emscripten-ports
1565
// Alternate syntax: --use-port=boost_headers
1566
// [compile+link]
1567
var USE_BOOST_HEADERS = false;
1568
1569
// 1 = use bullet from emscripten-ports
1570
// Alternate syntax: --use-port=bullet
1571
// [compile+link]
1572
var USE_BULLET = false;
1573
1574
// 1 = use vorbis from emscripten-ports
1575
// Alternate syntax: --use-port=vorbis
1576
// [compile+link]
1577
var USE_VORBIS = false;
1578
1579
// 1 = use ogg from emscripten-ports
1580
// Alternate syntax: --use-port=ogg
1581
// [compile+link]
1582
var USE_OGG = false;
1583
1584
// 1 = use mpg123 from emscripten-ports
1585
// Alternate syntax: --use-port=mpg123
1586
// [compile+link]
1587
var USE_MPG123 = false;
1588
1589
// 1 = use freetype from emscripten-ports
1590
// Alternate syntax: --use-port=freetype
1591
// [compile+link]
1592
var USE_FREETYPE = false;
1593
1594
// Specify the SDL_mixer version that is being linked against.
1595
// Doesn't *have* to match USE_SDL, but a good idea.
1596
// [compile+link]
1597
var USE_SDL_MIXER = 1;
1598
1599
// 1 = use harfbuzz from harfbuzz upstream
1600
// Alternate syntax: --use-port=harfbuzz
1601
// [compile+link]
1602
var USE_HARFBUZZ = false;
1603
1604
// 3 = use cocos2d v3 from emscripten-ports
1605
// Alternate syntax: --use-port=cocos2d
1606
// [compile+link]
1607
var USE_COCOS2D = 0;
1608
1609
// 1 = use libmodplug from emscripten-ports
1610
// Alternate syntax: --use-port=libmodplug
1611
// [compile+link]
1612
var USE_MODPLUG = false;
1613
1614
// Formats to support in SDL2_image. Valid values: bmp, gif, lbm, pcx, png, pnm,
1615
// tga, xcf, xpm, xv
1616
// [link]
1617
var SDL2_IMAGE_FORMATS = [];
1618
1619
// Formats to support in SDL2_mixer. Valid values: ogg, mp3, mod, mid
1620
// [link]
1621
var SDL2_MIXER_FORMATS = ["ogg"];
1622
1623
// 1 = use sqlite3 from emscripten-ports
1624
// Alternate syntax: --use-port=sqlite3
1625
// [compile+link]
1626
var USE_SQLITE3 = false;
1627
1628
// If 1, target compiling a shared Wasm Memory.
1629
// [compile+link] - affects user code at compile and system libraries at link.
1630
var SHARED_MEMORY = false;
1631
1632
// Enables support for Wasm Workers. Wasm Workers enable applications
1633
// to create threads using a lightweight web-specific API that builds on top
1634
// of Wasm SharedArrayBuffer + Atomics API.
1635
// [compile+link] - affects user code at compile and system libraries at link.
1636
var WASM_WORKERS = 0;
1637
1638
// If true, enables targeting Wasm Web Audio AudioWorklets. Check out the
1639
// full documentation in site/source/docs/api_reference/wasm_audio_worklets.rst
1640
// [link]
1641
var AUDIO_WORKLET = 0;
1642
1643
// If true, enables deep debugging of Web Audio backend.
1644
// [link]
1645
var WEBAUDIO_DEBUG = 0;
1646
1647
// In web browsers, Workers cannot be created while the main browser thread
1648
// is executing JS/Wasm code, but the main thread must regularly yield back
1649
// to the browser event loop for Worker initialization to occur.
1650
// This means that pthread_create() is essentially an asynchronous operation
1651
// when called from the main browser thread, and the main thread must
1652
// repeatedly yield back to the JS event loop in order for the thread to
1653
// actually start.
1654
// If your application needs to be able to synchronously create new threads,
1655
// you can pre-create a pthread pool by specifying -sPTHREAD_POOL_SIZE=x,
1656
// in which case the specified number of Workers will be preloaded into a pool
1657
// before the application starts, and that many threads can then be available
1658
// for synchronous creation.
1659
// Note that this setting is a string, and will be emitted in the JS code
1660
// (directly, with no extra quotes) so that if you set it to '5' then 5 workers
1661
// will be used in the pool, and so forth. The benefit of this being a string
1662
// is that you can set it to something like
1663
// 'navigator.hardwareConcurrency' (which will use the number of cores the
1664
// browser reports, and is how you can get exactly enough workers for a
1665
// threadpool equal to the number of cores).
1666
// [link] - affects generated JS runtime code at link time
1667
var PTHREAD_POOL_SIZE = 0;
1668
1669
// Normally, applications can create new threads even when the pool is empty.
1670
// When application breaks out to the JS event loop before trying to block on
1671
// the thread via ``pthread_join`` or any other blocking primitive,
1672
// an extra Worker will be created and the thread callback will be executed.
1673
// However, breaking out to the event loop requires custom modifications to
1674
// the code to adapt it to the Web, and not something that works for
1675
// off-the-shelf apps. Those apps without any modifications are most likely
1676
// to deadlock. This setting ensures that, instead of a risking a deadlock,
1677
// they get a runtime EAGAIN error instead that can at least be gracefully
1678
// handled from the C / C++ side.
1679
// Values:
1680
//
1681
// - ``0`` - disable warnings on thread pool exhaustion
1682
// - ``1`` - enable warnings on thread pool exhaustion (default)
1683
// - ``2`` - make thread pool exhaustion a hard error
1684
//
1685
// [link]
1686
var PTHREAD_POOL_SIZE_STRICT = 1;
1687
1688
// If your application does not need the ability to synchronously create
1689
// threads, but it would still like to opportunistically speed up initial thread
1690
// startup time by prewarming a pool of Workers, you can specify the size of
1691
// the pool with -sPTHREAD_POOL_SIZE=x, but then also specify
1692
// -sPTHREAD_POOL_DELAY_LOAD, which will cause the runtime to not wait up at
1693
// startup for the Worker pool to finish loading. Instead, the runtime will
1694
// immediately start up and the Worker pool will asynchronously spin up in
1695
// parallel on the background. This can shorten the time that pthread_create()
1696
// calls take to actually start a thread, but without actually slowing down
1697
// main application startup speed. If PTHREAD_POOL_DELAY_LOAD=0 (default),
1698
// then the runtime will wait for the pool to start up before running main().
1699
// If you do need to synchronously wait on the created threads
1700
// (e.g. via pthread_join), you must wait on the Module.pthreadPoolReady
1701
// promise before doing so or you're very likely to run into deadlocks.
1702
// [link] - affects generated JS runtime code at link time
1703
var PTHREAD_POOL_DELAY_LOAD = false;
1704
1705
// Default stack size to use for newly created pthreads. When not set, this
1706
// defaults to STACK_SIZE (which in turn defaults to 64k). Can also be set at
1707
// runtime using pthread_attr_setstacksize(). Note that the wasm control flow
1708
// stack is separate from this stack. This stack only contains certain function
1709
// local variables, such as those that have their addresses taken, or ones that
1710
// are too large to fit as local vars in wasm code.
1711
// [link]
1712
var DEFAULT_PTHREAD_STACK_SIZE = 0;
1713
1714
// True when building with --threadprofiler
1715
// [link]
1716
var PTHREADS_PROFILING = false;
1717
1718
// It is dangerous to call pthread_join or pthread_cond_wait
1719
// on the main thread, as doing so can cause deadlocks on the Web (and also
1720
// it works using a busy-wait which is expensive). See
1721
// https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread
1722
// This may become set to 0 by default in the future; for now, this just
1723
// warns in the console.
1724
// [link]
1725
var ALLOW_BLOCKING_ON_MAIN_THREAD = true;
1726
1727
// If true, add in debug traces for diagnosing pthreads related issues.
1728
// [link]
1729
var PTHREADS_DEBUG = false;
1730
1731
// This tries to evaluate code at compile time. The main use case is to eval
1732
// global ctor functions, which are those that run before main(), but main()
1733
// itself or parts of it can also be evalled. Evaluating code this way can avoid
1734
// work at runtime, as it applies the results of the execution to memory and
1735
// globals and so forth, "snapshotting" the wasm and then just running it from
1736
// there when it is loaded.
1737
//
1738
// This will stop when it sees something it cannot eval at compile time, like a
1739
// call to an import. When running with this option you will see logging that
1740
// indicates what is evalled and where it stops.
1741
//
1742
// This optimization can either reduce or increase code size. If a small amount
1743
// of code generates many changes in memory, for example, then overall size may
1744
// increase.
1745
//
1746
// LLVM's GlobalOpt *almost* does this operation. It does in simple cases, where
1747
// LLVM IR is not too complex for its logic to evaluate, but it isn't powerful
1748
// enough for e.g. libc++ iostream ctors. It is just hard to do at the LLVM IR
1749
// level - LLVM IR is complex and getting more complex, so this would require
1750
// GlobalOpt to have a full interpreter, plus a way to write back into LLVM IR
1751
// global objects. At the wasm level, however, everything has been lowered
1752
// into a simple low level, and we also just need to write bytes into an array,
1753
// so this is easy for us to do. A further issue for LLVM is that it doesn't
1754
// know that we will not link in further code, so it only tries to optimize
1755
// ctors with lowest priority (while we do know explicitly if dynamic linking is
1756
// enabled or not).
1757
//
1758
// If set to a value of 2, this also makes some "unsafe" assumptions,
1759
// specifically that there is no input received while evalling ctors. That means
1760
// we ignore args to main() as well as assume no environment vars are readable.
1761
// This allows more programs to be optimized, but you need to make sure your
1762
// program does not depend on those features - even just checking the value of
1763
// argc can lead to problems.
1764
//
1765
// [link]
1766
var EVAL_CTORS = 0;
1767
1768
// The default value or 1 means the generated code will use TextDecoder if
1769
// available and fall back to custom decoder code when not available.
1770
// If set to 2, we assume TextDecoder is present and usable, and do not emit
1771
// any JS code to fall back if it is missing. Setting this zero to avoid even
1772
// conditional usage of TextDecoder is no longer supported.
1773
// Note: In -Oz builds, the default value of TEXTDECODER is set to 2, to save on
1774
// code size (except when AUDIO_WORKLET is specified, or when `shell` is part
1775
// of ENVIRONMENT since TextDecoder is not available in those environments).
1776
// [link]
1777
var TEXTDECODER = 1;
1778
1779
// Embind specific: If enabled, assume UTF-8 encoded data in std::string binding.
1780
// Disable this to support binary data transfer.
1781
// [link]
1782
var EMBIND_STD_STRING_IS_UTF8 = true;
1783
1784
// Embind specific: If enabled, generate Embind's JavaScript invoker functions
1785
// at compile time and include them in the JS output file. When used with
1786
// DYNAMIC_EXECUTION=0 this allows exported bindings to be just as fast as
1787
// DYNAMIC_EXECUTION=1 mode, but without the need for eval(). If there are many
1788
// bindings the JS output size may be larger though.
1789
var EMBIND_AOT = false;
1790
1791
// If set to 1, enables support for transferring canvases to pthreads and
1792
// creating WebGL contexts in them, as well as explicit swap control for GL
1793
// contexts. This needs browser support for the OffscreenCanvas specification.
1794
// [link]
1795
var OFFSCREENCANVAS_SUPPORT = false;
1796
1797
// If you are using PROXY_TO_PTHREAD with OFFSCREENCANVAS_SUPPORT, then specify
1798
// here a comma separated list of CSS ID selectors to canvases to proxy over
1799
// to the pthread at program startup, e.g. '#canvas1, #canvas2'.
1800
// [link]
1801
var OFFSCREENCANVASES_TO_PTHREAD = "#canvas";
1802
1803
// If set to 1, enables support for WebGL contexts to render to an offscreen
1804
// render target, to avoid the implicit swap behavior of WebGL where exiting any
1805
// event callback would automatically perform a "flip" to present rendered
1806
// content on screen. When an Emscripten GL context has Offscreen Framebuffer
1807
// enabled, a single frame can be composited from multiple event callbacks, and
1808
// the swap function emscripten_webgl_commit_frame() is then explicitly called
1809
// to present the rendered content on screen.
1810
//
1811
// The OffscreenCanvas feature also enables explicit GL frame swapping support,
1812
// and also, -sOFFSCREEN_FRAMEBUFFER feature can be used to polyfill support
1813
// for accessing WebGL in multiple threads in the absence of OffscreenCanvas
1814
// support in browser, at the cost of some performance and latency.
1815
// OffscreenCanvas and Offscreen Framebuffer support can be enabled at the same
1816
// time, and allows one to utilize OffscreenCanvas where available, and to fall
1817
// back to Offscreen Framebuffer otherwise.
1818
// [link]
1819
var OFFSCREEN_FRAMEBUFFER = false;
1820
1821
// If nonzero, Fetch API supports backing to IndexedDB. If 0, IndexedDB is not
1822
// utilized. Set to 0 if IndexedDB support is not interesting for target
1823
// application, to save a few kBytes.
1824
// [link]
1825
var FETCH_SUPPORT_INDEXEDDB = true;
1826
1827
// If nonzero, prints out debugging information in library_fetch.js
1828
// [link]
1829
var FETCH_DEBUG = false;
1830
1831
// If nonzero, enables emscripten_fetch API.
1832
// [link]
1833
var FETCH = false;
1834
1835
// ATTENTION [WIP]: Experimental feature. Please use at your own risk.
1836
// This will eventually replace the current JS file system implementation.
1837
// If set to 1, uses new filesystem implementation.
1838
// [link]
1839
// [experimental]
1840
var WASMFS = false;
1841
1842
// If set to 1, embeds all subresources in the emitted file as base64 string
1843
// literals. Embedded subresources may include (but aren't limited to) wasm,
1844
// asm.js, and static memory initialization code.
1845
//
1846
// When using code that depends on this option, your Content Security Policy may
1847
// need to be updated. Specifically, embedding asm.js requires the script-src
1848
// directive to allow 'unsafe-inline', and using a Worker requires the
1849
// child-src directive to allow blob:. If you aren't using Content Security
1850
// Policy, or your CSP header doesn't include either script-src or child-src,
1851
// then you can safely ignore this warning.
1852
// [link]
1853
var SINGLE_FILE = false;
1854
1855
// If set to 1, all JS libraries will be automatically available at link time.
1856
// This gets set to 0 in STRICT mode (or with MINIMAL_RUNTIME) which mean you
1857
// need to explicitly specify -lfoo.js in at link time in order to access
1858
// library function in library_foo.js.
1859
// [link]
1860
var AUTO_JS_LIBRARIES = true;
1861
1862
// Like AUTO_JS_LIBRARIES but for the native libraries such as libgl, libal
1863
// and libhtml5. If this is disabled it is necessary to explicitly add
1864
// e.g. -lhtml5 and also to first build the library using ``embuilder``.
1865
// [link]
1866
var AUTO_NATIVE_LIBRARIES = true;
1867
1868
// Specifies the oldest major version of Firefox to target. I.e. all Firefox
1869
// versions >= MIN_FIREFOX_VERSION
1870
// are desired to work. Pass -sMIN_FIREFOX_VERSION=majorVersion to drop support
1871
// for Firefox versions older than < majorVersion.
1872
// Firefox 79 was released on 2020-07-28.
1873
// MAX_INT (0x7FFFFFFF, or -1) specifies that target is not supported.
1874
// Minimum supported value is 55 which was released on 2017-08-08 (see
1875
// feature_matrix.py)
1876
// [link]
1877
var MIN_FIREFOX_VERSION = 79;
1878
1879
// Specifies the oldest version of desktop Safari to target. Version is encoded
1880
// in MMmmVV, e.g. 70101 denotes Safari 7.1.1.
1881
// Safari 14.1.0 was released on April 26, 2021, bundled with macOS 11.0 Big
1882
// Sur and iOS 14.5.
1883
// The previous default, Safari 12.0.0 was released on September 17, 2018,
1884
// bundled with macOS 10.14.0 Mojave.
1885
// NOTE: Emscripten is unable to produce code that would work in iOS 9.3.5 and
1886
// older, i.e. iPhone 4s, iPad 2, iPad 3, iPad Mini 1, Pod Touch 5 and older,
1887
// see https://github.com/emscripten-core/emscripten/pull/7191.
1888
// Multithreaded Emscripten code will need Safari 12.2 (iPhone 5s+) at minimum,
1889
// with support for DedicatedWorkerGlobalScope.name parameter.
1890
// MAX_INT (0x7FFFFFFF, or -1) specifies that target is not supported.
1891
// Minimum supported value is 120200 which was released on 2019-03-25 (see
1892
// feature_matrix.py).
1893
// [link]
1894
var MIN_SAFARI_VERSION = 150000;
1895
1896
// Specifies the oldest version of Chrome. E.g. pass -sMIN_CHROME_VERSION=58 to
1897
// drop support for Chrome 57 and older.
1898
// This setting also applies to modern Chromium-based Edge, which shares version
1899
// numbers with Chrome.
1900
// Chrome 85 was released on 2020-08-25.
1901
// MAX_INT (0x7FFFFFFF, or -1) specifies that target is not supported.
1902
// Minimum supported value is 70, which was released on 2018-10-16 (see
1903
// feature_matrix.py).
1904
// [link]
1905
var MIN_CHROME_VERSION = 85;
1906
1907
// Specifies minimum node version to target for the generated code. This is
1908
// distinct from the minimum version required run the emscripten compiler.
1909
// This version aligns with the current Ubuuntu TLS 20.04 (Focal).
1910
// Version is encoded in MMmmVV, e.g. 181401 denotes Node 18.14.01.
1911
// Minimum supported value is 101900, which was released 2020-02-05 (see
1912
// feature_matrix.py).
1913
var MIN_NODE_VERSION = 160000;
1914
1915
// If true, uses minimal sized runtime without POSIX features, Module,
1916
// preRun/preInit/etc., Emscripten built-in XHR loading or library_browser.js.
1917
// Enable this setting to target the smallest code size possible. Set
1918
// MINIMAL_RUNTIME=2 to further enable even more code size optimizations. These
1919
// opts are quite hacky, and work around limitations in Closure and other parts
1920
// of the build system, so they may not work in all generated programs (But can
1921
// be useful for really small programs).
1922
//
1923
// By default, no symbols will be exported on the ``Module`` object. In order
1924
// to export kept alive symbols, please use ``-sEXPORT_KEEPALIVE=1``.
1925
// [link]
1926
var MINIMAL_RUNTIME = 0;
1927
1928
// If set to 1, MINIMAL_RUNTIME will utilize streaming WebAssembly compilation,
1929
// where WebAssembly module is compiled already while it is being downloaded.
1930
// In order for this to work, the web server MUST properly serve the .wasm file
1931
// with a HTTP response header "Content-Type: application/wasm". If this HTTP
1932
// header is not present, e.g. Firefox 73 will fail with an error message
1933
// ``TypeError: Response has unsupported MIME type``
1934
// and Chrome 78 will fail with an error message
1935
// `Uncaught (in promise) TypeError: Failed to execute 'compile' on
1936
// 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'`.
1937
// If set to 0 (default), streaming WebAssembly compilation is disabled, which
1938
// means that the WebAssembly Module will first be downloaded fully, and only
1939
// then compilation starts.
1940
// For large .wasm modules and production environments, this should be set to 1
1941
// for faster startup speeds. However this setting is disabled by default
1942
// since it requires server side configuration and for really small pages there
1943
// is no observable difference (also has a ~100 byte impact to code size)
1944
// This setting is only compatible with html output.
1945
// [link]
1946
var MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION = false;
1947
1948
// If set to 1, MINIMAL_RUNTIME will utilize streaming WebAssembly instantiation,
1949
// where WebAssembly module is compiled+instantiated already while it is being
1950
// downloaded. Same restrictions/requirements apply as with
1951
// MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION.
1952
// MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION and
1953
// MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION cannot be simultaneously active.
1954
// Which one of these two is faster depends on the size of the wasm module,
1955
// the size of the JS runtime file, and the size of the preloaded data file
1956
// to download, and the browser in question.
1957
// [link]
1958
var MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION = false;
1959
1960
// If set to 'emscripten' or 'wasm', compiler supports setjmp() and longjmp().
1961
// If set to 0, these APIs are not available. If you are using C++ exceptions,
1962
// but do not need setjmp()+longjmp() API, then you can set this to 0 to save a
1963
// little bit of code size and performance when catching exceptions.
1964
//
1965
// 'emscripten': (default) Emscripten setjmp/longjmp handling using JavaScript
1966
// 'wasm': setjmp/longjmp handling using Wasm EH instructions (experimental)
1967
//
1968
// - 0: No setjmp/longjmp handling
1969
// - 1: Default setjmp/longjmp/handling, depending on the mode of exceptions.
1970
// 'wasm' if '-fwasm-exceptions' is used, 'emscripten' otherwise.
1971
//
1972
// [compile+link] - at compile time this enables the transformations needed for
1973
// longjmp support at codegen time, while at link it allows linking in the
1974
// library support.
1975
var SUPPORT_LONGJMP = true;
1976
1977
// If set to 1, disables old deprecated HTML5 API event target lookup behavior.
1978
// When enabled, there is no "Module.canvas" object, no magic "null" default
1979
// handling, and DOM element 'target' parameters are taken to refer to CSS
1980
// selectors, instead of referring to DOM IDs.
1981
// [link]
1982
var DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR = true;
1983
1984
// Certain browser DOM API operations, such as requesting fullscreen mode
1985
// transition or pointer lock require that the request originates from within
1986
// an user initiated event, such as mouse click or keyboard press. Refactoring
1987
// an application to follow this kind of program structure can be difficult, so
1988
// HTML5_SUPPORT_DEFERRING_USER_SENSITIVE_REQUESTS allows transparent emulation
1989
// of this by deferring such requests until a suitable event callback is
1990
// generated. Set this to 0 to disable support for deferring to on save code
1991
// size if your application does not need support for deferred calls.
1992
// [link]
1993
var HTML5_SUPPORT_DEFERRING_USER_SENSITIVE_REQUESTS = true;
1994
1995
// Specifies whether the generated .html file is run through html-minifier. The
1996
// set of optimization passes run by html-minifier depends on debug and
1997
// optimization levels. In -g2 and higher, no minification is performed. In -g1,
1998
// minification is done, but whitespace is retained. Minification requires at
1999
// least -O1 or -Os to be used. Pass -sMINIFY_HTML=0 to explicitly choose to
2000
// disable HTML minification altogether.
2001
// [link]
2002
var MINIFY_HTML = true;
2003
2004
// This option is no longer used. The appropriate shadow memory size is now
2005
// calculated from INITIAL_MEMORY and MAXIMUM_MEMORY. Will be removed in a
2006
// future release.
2007
// [link]
2008
var ASAN_SHADOW_SIZE = -1;
2009
2010
// List of path substitutions to apply in the "sources" field of the source map.
2011
// Corresponds to the ``--prefix`` option used in ``tools/wasm-sourcemap.py``.
2012
// Must be used with ``-gsource-map``.
2013
//
2014
// This setting allows to map path prefixes to the proper ones so that the final
2015
// (possibly relative) URLs point to the correct locations :
2016
// ``-sSOURCE_MAP_PREFIXES=/old/path=/new/path``
2017
//
2018
// [link]
2019
var SOURCE_MAP_PREFIXES = [];
2020
2021
// Default to c++ mode even when run as ``emcc`` rather then ``emc++``.
2022
// When this is disabled ``em++`` is required linking C++ programs. Disabling
2023
// this will match the behaviour of gcc/g++ and clang/clang++.
2024
// [link]
2025
var DEFAULT_TO_CXX = true;
2026
2027
// While LLVM's wasm32 has long double = float128, we don't support printing
2028
// that at full precision by default. Instead we print as 64-bit doubles, which
2029
// saves libc code size. You can flip this option on to get a libc with full
2030
// long double printing precision.
2031
// [link]
2032
var PRINTF_LONG_DOUBLE = false;
2033
2034
// Setting this affects the path emitted in the wasm that refers to the DWARF
2035
// file, in -gseparate-dwarf mode. This allows the debugging file to be hosted
2036
// in a custom location.
2037
// [link]
2038
var SEPARATE_DWARF_URL = '';
2039
2040
// Emscripten runs wasm-ld to link, and in some cases will do further changes to
2041
// the wasm afterwards, like running wasm-opt to optimize the binary in
2042
// optimized builds. However, in some builds no wasm changes are necessary after
2043
// link. This can make the entire link step faster, and can also be important
2044
// for other reasons, like in debugging if the wasm is not modified then the
2045
// DWARF info from LLVM is preserved (wasm-opt can rewrite it in some cases, but
2046
// not in others like split-dwarf).
2047
// When this flag is turned on, we error at link time if the build requires any
2048
// changes to the wasm after link. This can be useful in testing, for example.
2049
// Some example of features that require post-link wasm changes are:
2050
// - Lowering i64 to i32 pairs at the JS boundary (See WASM_BIGINT)
2051
// - Lowering sign-extension operation when targeting older browsers.
2052
var ERROR_ON_WASM_CHANGES_AFTER_LINK = false;
2053
2054
// Abort on unhandled excptions that occur when calling exported WebAssembly
2055
// functions. This makes the program behave more like a native program where the
2056
// OS would terminate the process and no further code can be executed when an
2057
// unhandled exception (e.g. out-of-bounds memory access) happens.
2058
// This will instrument all exported functions to catch thrown exceptions and
2059
// call abort() when they happen. Once the program aborts any exported function
2060
// calls will fail with a "program has already aborted" exception to prevent
2061
// calls into code with a potentially corrupted program state.
2062
// This adds a small fixed amount to code size in optimized builds and a slight
2063
// overhead for the extra instrumented function indirection. Enable this if you
2064
// want Emscripten to handle unhandled exceptions nicely at the cost of a few
2065
// bytes extra.
2066
// Exceptions that occur within the ``main`` function are already handled via an
2067
// alternative mechanimsm.
2068
// [link]
2069
var ABORT_ON_WASM_EXCEPTIONS = false;
2070
2071
// Build binaries that use as many WASI APIs as possible, and include additional
2072
// JS support libraries for those APIs. This allows emscripten to produce binaries
2073
// are more WASI compliant and also allows it to process and execute WASI
2074
// binaries built with other SDKs (e.g. wasi-sdk).
2075
// This setting is experimental and subject to change or removal.
2076
// Implies STANDALONE_WASM.
2077
// [link]
2078
// [experimental]
2079
var PURE_WASI = false;
2080
2081
// Set to 1 to define the WebAssembly.Memory object outside of the wasm
2082
// module. By default the wasm module defines the memory and exports
2083
// it to JavaScript.
2084
// Use of the following settings will enable this settings since they
2085
// depend on being able to define the memory in JavaScript:
2086
// - -pthread
2087
// - RELOCATABLE
2088
// - ASYNCIFY_LAZY_LOAD_CODE
2089
// - WASM2JS (WASM=0)
2090
// [link]
2091
var IMPORTED_MEMORY = false;
2092
2093
// Generate code to loading split wasm modules.
2094
// This option will automatically generate two wasm files as output, one
2095
// with the ``.orig`` suffix and one without. The default file (without
2096
// the suffix) when run will generate instrumentation data can later be
2097
// fed into wasm-split (the binaryen tool).
2098
// As well as this the generated JS code will contains help functions
2099
// to loading split modules.
2100
// [link]
2101
var SPLIT_MODULE = false;
2102
2103
// For MAIN_MODULE builds, automatically load any dynamic library dependencies
2104
// on startup, before loading the main module.
2105
var AUTOLOAD_DYLIBS = true;
2106
2107
// Include unimplemented JS syscalls to be included in the final output. This
2108
// allows programs that depend on these syscalls at runtime to be compiled, even
2109
// though these syscalls will fail (or do nothing) at runtime.
2110
var ALLOW_UNIMPLEMENTED_SYSCALLS = true;
2111
2112
// Allow calls to Worker(...) and importScripts(...) to be Trusted Types compatible.
2113
// Trusted Types is a Web Platform feature designed to mitigate DOM XSS by restricting
2114
// the usage of DOM sink APIs. See https://w3c.github.io/webappsec-trusted-types/.
2115
// [link]
2116
var TRUSTED_TYPES = false;
2117
2118
// When targeting older browsers emscripten will sometimes require that
2119
// polyfills be included in the output. If you would prefer to take care of
2120
// polyfilling yourself via some other mechanism you can prevent emscripten
2121
// from generating these by passing ``-sNO_POLYFILL`` or ``-sPOLYFILL=0``
2122
// With default browser targets emscripten does not need any polyfills so this
2123
// settings is *only* needed when also explicitly targeting older browsers.
2124
var POLYFILL = true;
2125
2126
// If non-zero, add tracing to core runtime functions. Can be set to 2 for
2127
// extra tracing (for example, tracing that occurs on each turn of the event
2128
// loop or each user callback, which can flood the console).
2129
// This setting is enabled by default if any of the following debugging settings
2130
// are enabled:
2131
// - PTHREADS_DEBUG
2132
// - DYLINK_DEBUG
2133
// - LIBRARY_DEBUG
2134
// - GL_DEBUG
2135
// - OPENAL_DEBUG
2136
// - EXCEPTION_DEBUG
2137
// - SYSCALL_DEBUG
2138
// - WEBSOCKET_DEBUG
2139
// - SOCKET_DEBUG
2140
// - FETCH_DEBUG
2141
// [link]
2142
var RUNTIME_DEBUG = 0;
2143
2144
// Include JS library symbols that were previously part of the default runtime.
2145
// Without this, such symbols can be made available by adding them to
2146
// DEFAULT_LIBRARY_FUNCS_TO_INCLUDE, or via the dependencies of another JS
2147
// library symbol.
2148
var LEGACY_RUNTIME = false;
2149
2150
// User-defined functions to wrap with signature conversion, which take or return
2151
// pointer argument. Only affects MEMORY64=1 builds, see create_pointer_conversion_wrappers
2152
// in emscripten.py for details.
2153
// Use _ for non-pointer arguments, p for pointer/i53 arguments, and P for optional pointer/i53 values.
2154
// Example use -sSIGNATURE_CONVERSIONS=someFunction:_p,anotherFunction:p
2155
// [link]
2156
var SIGNATURE_CONVERSIONS = [];
2157
2158
// Experimental support for wasm source phase imports.
2159
// This is only currently implemented in the pre-release/nightly version of node,
2160
// and not yet supported by browsers.
2161
// Requires EXPORT_ES6
2162
// [link]
2163
var SOURCE_PHASE_IMPORTS = false;
2164
2165
// Experimental support for wasm ESM integration.
2166
// Requires EXPORT_ES6 and MODULARIZE=instance
2167
// [link]
2168
var WASM_ESM_INTEGRATION = false;
2169
2170
// Enable use of the JS arraybuffer-base64 API:
2171
// https://github.com/tc39/proposal-arraybuffer-base64
2172
// To run the resulting code currently requires passing `--js_base_64` to node
2173
// or chrome.
2174
// [experimental]
2175
// [link]
2176
var JS_BASE64_API = false;
2177
2178
// Enable support for GrowableSharedArrayBuffer.
2179
// This features is only available behind a flag in recent versions of
2180
// node/chrome.
2181
// [experimental]
2182
// [link]
2183
var GROWABLE_ARRAYBUFFERS = false;
2184
2185
// Experimental support for WebAssembly js-types proposal.
2186
// It's currently only available under a flag in certain browsers,
2187
// so we disable it by default to save on code size.
2188
var WASM_JS_TYPES = false;
2189
2190
// For renamed settings the format is:
2191
// [OLD_NAME, NEW_NAME]
2192
// For removed settings (which now effectively have a fixed value and can no
2193
// longer be changed) the format is:
2194
// [OPTION_NAME, POSSIBLE_VALUES, ERROR_EXPLANATION], where POSSIBLE_VALUES is
2195
// an array of values that will still be silently accepted by the compiler.
2196
// First element in the list is the canonical/fixed value going forward.
2197
// This allows existing build systems to keep specifying one of the supported
2198
// settings, for backwards compatibility.
2199
// When a setting has been removed, and we want to error on all values of it,
2200
// we can set POSSIBLE_VALUES to an impossible value (like "disallowed" for a
2201
// numeric setting, or -1 for a string setting).
2202
var LEGACY_SETTINGS = [
2203
['BINARYEN', 'WASM'],
2204
['TOTAL_STACK', 'STACK_SIZE'],
2205
['BINARYEN_ASYNC_COMPILATION', 'WASM_ASYNC_COMPILATION'],
2206
['UNALIGNED_MEMORY', [0], 'forced unaligned memory not supported in fastcomp'],
2207
['FORCE_ALIGNED_MEMORY', [0], 'forced aligned memory is not supported in fastcomp'],
2208
['PGO', [0], 'pgo no longer supported'],
2209
['QUANTUM_SIZE', [4], 'altering the QUANTUM_SIZE is not supported'],
2210
['FUNCTION_POINTER_ALIGNMENT', [2], 'Starting from Emscripten 1.37.29, no longer available (https://github.com/emscripten-core/emscripten/pull/6091)'],
2211
// Reserving function pointers is not needed - allowing table growth allows any number of new functions to be added.
2212
['RESERVED_FUNCTION_POINTERS', 'ALLOW_TABLE_GROWTH'],
2213
['BUILD_AS_SHARED_LIB', [0], 'Starting from Emscripten 1.38.16, no longer available (https://github.com/emscripten-core/emscripten/pull/7433)'],
2214
['SAFE_SPLIT_MEMORY', [0], 'Starting from Emscripten 1.38.19, SAFE_SPLIT_MEMORY codegen is no longer available (https://github.com/emscripten-core/emscripten/pull/7465)'],
2215
['SPLIT_MEMORY', [0], 'Starting from Emscripten 1.38.19, SPLIT_MEMORY codegen is no longer available (https://github.com/emscripten-core/emscripten/pull/7465)'],
2216
['BINARYEN_METHOD', ['native-wasm'], 'Starting from Emscripten 1.38.23, Emscripten now always builds either to Wasm (-sWASM - default), or to JavaScript (-sWASM=0), other methods are not supported (https://github.com/emscripten-core/emscripten/pull/7836)'],
2217
['BINARYEN_TRAP_MODE', [-1], 'The wasm backend does not support a trap mode (it always clamps, in effect)'],
2218
['PRECISE_I64_MATH', [1, 2], 'Starting from Emscripten 1.38.26, PRECISE_I64_MATH is always enabled (https://github.com/emscripten-core/emscripten/pull/7935)'],
2219
['MEMFS_APPEND_TO_TYPED_ARRAYS', [1], 'Starting from Emscripten 1.38.26, MEMFS_APPEND_TO_TYPED_ARRAYS=0 is no longer supported. MEMFS no longer supports using JS arrays for file data (https://github.com/emscripten-core/emscripten/pull/7918)'],
2220
['ERROR_ON_MISSING_LIBRARIES', [1], 'missing libraries are always an error now'],
2221
['EMITTING_JS', [1], 'The new STANDALONE_WASM flag replaces this (replace EMITTING_JS=0 with STANDALONE_WASM=1)'],
2222
['SKIP_STACK_IN_SMALL', [0, 1], 'SKIP_STACK_IN_SMALL is no longer needed as the backend can optimize it directly'],
2223
['SAFE_STACK', [0], 'Replace SAFE_STACK=1 with STACK_OVERFLOW_CHECK=2'],
2224
['MEMORY_GROWTH_STEP', 'MEMORY_GROWTH_LINEAR_STEP'],
2225
['ELIMINATE_DUPLICATE_FUNCTIONS', [0, 1], 'Duplicate function elimination for wasm is handled automatically by binaryen'],
2226
['ELIMINATE_DUPLICATE_FUNCTIONS_DUMP_EQUIVALENT_FUNCTIONS', [0], 'Duplicate function elimination for wasm is handled automatically by binaryen'],
2227
['ELIMINATE_DUPLICATE_FUNCTIONS_PASSES', [5], 'Duplicate function elimination for wasm is handled automatically by binaryen'],
2228
// WASM_OBJECT_FILES is handled in emcc.py, supporting both 0 and 1 for now.
2229
['WASM_OBJECT_FILES', [0, 1], 'For LTO, use -flto or -fto=thin instead; to disable LTO, just do not pass WASM_OBJECT_FILES=1 as 1 is the default anyhow'],
2230
['TOTAL_MEMORY', 'INITIAL_MEMORY'],
2231
['WASM_MEM_MAX', 'MAXIMUM_MEMORY'],
2232
['BINARYEN_MEM_MAX', 'MAXIMUM_MEMORY'],
2233
['BINARYEN_PASSES', [''], 'Use BINARYEN_EXTRA_PASSES to add additional passes'],
2234
['SWAPPABLE_ASM_MODULE', [0], 'Fully swappable asm modules are no longer supported'],
2235
['ASM_JS', [1], 'asm.js output is not supported anymore'],
2236
['FINALIZE_ASM_JS', [0, 1], 'asm.js output is not supported anymore'],
2237
['ASYNCIFY_WHITELIST', 'ASYNCIFY_ONLY'],
2238
['ASYNCIFY_BLACKLIST', 'ASYNCIFY_REMOVE'],
2239
['EXCEPTION_CATCHING_WHITELIST', 'EXCEPTION_CATCHING_ALLOWED'],
2240
['SEPARATE_ASM', [0], 'Separate asm.js only made sense for fastcomp with asm.js output'],
2241
['SEPARATE_ASM_MODULE_NAME', [''], 'Separate asm.js only made sense for fastcomp with asm.js output'],
2242
['FAST_UNROLLED_MEMCPY_AND_MEMSET', [0, 1], 'The wasm backend implements memcpy/memset in C'],
2243
['DOUBLE_MODE', [0, 1], 'The wasm backend always implements doubles normally'],
2244
['PRECISE_F32', [0, 1, 2], 'The wasm backend always implements floats normally'],
2245
['ALIASING_FUNCTION_POINTERS', [0, 1], 'The wasm backend always uses a single index space for function pointers, in a single Table'],
2246
['AGGRESSIVE_VARIABLE_ELIMINATION', [0, 1], 'Wasm ignores asm.js-specific optimization flags'],
2247
['SIMPLIFY_IFS', [1], 'Wasm ignores asm.js-specific optimization flags'],
2248
['DEAD_FUNCTIONS', [[]], 'The wasm backend does not support dead function removal'],
2249
['WASM_BACKEND', [-1], 'Only the wasm backend is now supported (note that setting it as -s has never been allowed anyhow)'],
2250
['EXPORT_BINDINGS', [0, 1], 'No longer needed'],
2251
['RUNNING_JS_OPTS', [0], 'Fastcomp cared about running JS which could alter asm.js validation, but not upstream'],
2252
['EXPORT_FUNCTION_TABLES', [0], 'No longer needed'],
2253
['BINARYEN_SCRIPTS', [''], 'No longer needed'],
2254
['WARN_UNALIGNED', [0, 1], 'No longer needed'],
2255
['ASM_PRIMITIVE_VARS', [[]], 'No longer needed'],
2256
['WORKAROUND_IOS_9_RIGHT_SHIFT_BUG', [0], 'Wasm2JS does not support iPhone 4s, iPad 2, iPad 3, iPad Mini 1, Pod Touch 5 (devices with end-of-life at iOS 9.3.5) and older'],
2257
['RUNTIME_FUNCS_TO_IMPORT', [[]], 'No longer needed'],
2258
['LIBRARY_DEPS_TO_AUTOEXPORT', [[]], 'No longer needed'],
2259
['EMIT_EMSCRIPTEN_METADATA', [0], 'No longer supported'],
2260
['SHELL_FILE', [''], 'No longer supported'],
2261
['LLD_REPORT_UNDEFINED', [1], 'Disabling is no longer supported'],
2262
['MEM_INIT_METHOD', [0], 'No longer supported'],
2263
['USE_PTHREADS', [0, 1], 'No longer needed. Use -pthread instead'],
2264
['USES_DYNAMIC_ALLOC', [1], 'No longer supported. Use -sMALLOC=none'],
2265
['REVERSE_DEPS', ['auto', 'all', 'none'], 'No longer needed'],
2266
['RUNTIME_LOGGING', 'RUNTIME_DEBUG'],
2267
['MIN_EDGE_VERSION', [0x7FFFFFFF], 'No longer supported'],
2268
['MIN_IE_VERSION', [0x7FFFFFFF], 'No longer supported'],
2269
['WORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG', [0], 'No longer supported'],
2270
['AUTO_ARCHIVE_INDEXES', [0, 1], 'No longer needed'],
2271
['USE_ES6_IMPORT_META', [1], 'Disabling is no longer supported'],
2272
['EXTRA_EXPORTED_RUNTIME_METHODS', [[]], 'No longer supported, use EXPORTED_RUNTIME_METHODS'],
2273
['SUPPORT_ERRNO', [0], 'No longer supported'],
2274
['DEMANGLE_SUPPORT', [0], 'No longer supported'],
2275
['MAYBE_WASM2JS', [0], 'No longer supported (use -sWASM=2)'],
2276
['HEADLESS', [0], 'No longer supported, use headless browsers or Node.js with JSDOM'],
2277
['USE_OFFSET_COVERTER', [0], 'No longer supported, not needed with modern v8 versions'],
2278
];
2279
2280