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