Jessibuca是一款开源的纯H5直播流播放器,通过Emscripten将音视频解码库编译成Js(ams.js/wasm)运行于浏览器之中。兼容几乎所有浏览器,可以运行在PC、手机、微信中,无需额外安装插件。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1254 lines
58 KiB

  1. // Copyright 2010 The Emscripten Authors. All rights reserved.
  2. // Emscripten is available under two separate licenses, the MIT license and the
  3. // University of Illinois/NCSA Open Source License. Both these licenses can be
  4. // found in the LICENSE file.
  5. //
  6. // Various compiling-to-JS parameters. These are simply variables present when the
  7. // JS compiler runs. To set them, do something like
  8. //
  9. // emcc -s OPTION1=VALUE1 -s OPTION2=VALUE2 [..other stuff..]
  10. //
  11. // See https://github.com/kripken/emscripten/wiki/Code-Generation-Modes/
  12. //
  13. // Note that the values here are the defaults in -O0, that is, unoptimized
  14. // mode. See apply_opt_level in tools/shared.py for how -O1,2,3 affect these
  15. // flags.
  16. //
  17. // These flags should only have an effect when compiling to JS, so there
  18. // should not be a need to have them when just compiling source to
  19. // bitcode. However, there will also be no harm either, so it is ok to.
  20. //
  21. // Tuning
  22. // This is the size of an individual field in a structure. 1 would
  23. // lead to e.g. doubles and chars both taking 1 memory address. This
  24. // is a form of 'compressed' memory, with shrinking and stretching
  25. // according to the type, when compared to C/C++. On the other hand
  26. // the normal value of 4 means all fields take 4 memory addresses,
  27. // as per the norm on a 32-bit machine.
  28. //
  29. // Changing this from the default of 4 is deprecated.
  30. var QUANTUM_SIZE = 4;
  31. // Whether we should add runtime assertions, for example to
  32. // check that each allocation to the stack does not
  33. // exceed its size, whether all allocations (stack and static) are
  34. // of positive size, etc., whether we should throw if we encounter a bad __label__, i.e.,
  35. // if code flow runs into a fault
  36. // ASSERTIONS == 2 gives even more runtime checks
  37. var ASSERTIONS = 1;
  38. // Whether extra logging should be enabled.
  39. // This logging isn't quite assertion-quality in that it isn't necessarily a
  40. // symptom that something is wrong.
  41. var RUNTIME_LOGGING = 0;
  42. // Chooses what kind of stack smash checks to emit to generated code:
  43. // 0: Stack overflows are not checked.
  44. // 1: Adds a security cookie at the top of the stack, which is checked at end of
  45. // each tick and at exit (practically zero performance overhead)
  46. // 2: Same as above, but also adds an explicit check for allocate() calls which
  47. // call ALLOC_STACK. Has a small performance cost.
  48. // -s ASSERTIONS=1 automatically enables -s STACK_OVERFLOW_CHECK=2.
  49. var STACK_OVERFLOW_CHECK = 0;
  50. // When set to 1, will generate more verbose output during compilation.
  51. var VERBOSE = 0;
  52. // Whether we will run the main() function. Disable if you embed the generated
  53. // code in your own, and will call main() yourself at the right time (which you
  54. // can do with Module.callMain(), with an optional parameter of commandline args).
  55. var INVOKE_RUN = 1;
  56. // If 0, the runtime is not quit when main() completes (allowing code to
  57. // run afterwards, for example from the browser main event loop). atexit()s
  58. // are also not executed, and we can avoid including code for runtime shutdown,
  59. // like flushing the stdio streams.
  60. // Set this to 1 if you do want atexit()s or stdio streams to be flushed
  61. // on exit.
  62. var EXIT_RUNTIME = 0;
  63. // How to represent the initial memory content.
  64. // 0: embed a base64 string literal representing the initial memory data
  65. // 1: create a *.mem file containing the binary data of the initial memory;
  66. // use the --memory-init-file command line switch to select this method
  67. // 2: embed a string literal representing that initial memory data
  68. var MEM_INIT_METHOD = 0;
  69. // The total stack size. There is no way to enlarge the stack, so this
  70. // value must be large enough for the program's requirements. If
  71. // assertions are on, we will assert on not exceeding this, otherwise,
  72. // it will fail silently.
  73. var TOTAL_STACK = 5*1024*1024;
  74. // The total amount of memory to use. Using more memory than this will
  75. // cause us to expand the heap, which can be costly with typed arrays:
  76. // we need to copy the old heap into a new one in that case.
  77. var TOTAL_MEMORY = 16777216;
  78. // What malloc()/free() to use, out of
  79. // * dlmalloc - a powerful general-purpose malloc
  80. // * emmalloc - a simple and compact malloc designed for emscripten
  81. // dlmalloc is necessary for multithreading, split memory, and other special
  82. // modes, and will be used automatically in those cases.
  83. // In general, if you don't need one of those special modes, and if you don't
  84. // allocate very many small objects, you should use emmalloc since it's
  85. // smaller. Otherwise, if you do allocate many small objects, dlmalloc
  86. // is usually worth the extra size.
  87. var MALLOC = "dlmalloc";
  88. // If 1, then when malloc would fail we abort(). This is nonstandard behavior,
  89. // but makes sense for the web since we have a fixed amount of memory that
  90. // must all be allocated up front, and so (a) failing mallocs are much more
  91. // likely than on other platforms, and (b) people need a way to find out
  92. // how big that initial allocation (TOTAL_MEMORY) must be.
  93. // If you set this to 0, then you get the standard malloc behavior of
  94. // returning NULL (0) when it fails.
  95. var ABORTING_MALLOC = 1;
  96. // If false, we abort with an error if we try to allocate more memory than
  97. // we can (TOTAL_MEMORY). If true, we will grow the memory arrays at
  98. // runtime, seamlessly and dynamically. This has a performance cost in asm.js,
  99. // both during the actual growth and in general (the latter is because in
  100. // that case we must be careful about optimizations, in particular the
  101. // eliminator), but in wasm it is efficient and should be used whenever relevant.
  102. // See https://code.google.com/p/v8/issues/detail?id=3907 regarding
  103. // memory growth performance in chrome.
  104. // Note that growing memory means we replace the JS typed array views, as
  105. // once created they cannot be resized. (This happens both in asm.js and in
  106. // wasm - in wasm we can grow the Memory, but still need to create new
  107. // views for JS.)
  108. // Setting this option on will disable ABORTING_MALLOC, in other words,
  109. // ALLOW_MEMORY_GROWTH enables fully standard behavior, of both malloc
  110. // returning 0 when it fails, and also of being able to allocate more
  111. // memory from the system as necessary.
  112. var ALLOW_MEMORY_GROWTH = 0;
  113. // where global data begins; the start of static memory. -1 means use the
  114. // default, any other value will be used as an override
  115. var GLOBAL_BASE = -1;
  116. // where the stack will begin. -1 means use the default. if the stack cannot
  117. // start at the value specified here, it may start at a higher location.
  118. // this is useful when debugging two builds that may differ in their static
  119. // allocations, by forcing the stack to start in the same place their
  120. // memory usage patterns would be the same.
  121. // Code embetterments
  122. var STACK_START = -1;
  123. // How to load and store 64-bit doubles. A potential risk is that doubles may
  124. // be only 32-bit aligned. Forcing 64-bit alignment in Clang itself should be
  125. // able to solve that, or as a workaround in DOUBLE_MODE 1 we will carefully
  126. // load in parts, in a way that requires only 32-bit alignment. In DOUBLE_MODE 0
  127. // we will simply store and load doubles as 32-bit floats, so when they are
  128. // stored/loaded they will truncate from 64 to 32 bits, and lose precision. This
  129. // is faster, and might work for some code (but probably that code should just
  130. // use floats and not doubles anyhow). Note that a downside of DOUBLE_MODE 1 is
  131. // that we currently store the double in parts, then load it aligned, and that
  132. // load-store will make JS engines alter it if it is being stored to a typed
  133. // array for security reasons. That will 'fix' the number from being a NaN or an
  134. // infinite number.
  135. var DOUBLE_MODE = 1;
  136. // If enabled, all memory accesses are assumed to be unaligned. In unaligned
  137. // memory mode, you can run nonportable code that typically would break in JS
  138. // (or on ARM for that matter, which also cannot do unaligned reads/writes), at
  139. // the cost of slowness
  140. var UNALIGNED_MEMORY = 0;
  141. // If enabled, assumes all reads and writes are fully aligned for the type they
  142. // use. This is true in proper C code (no undefined behavior), but is sadly
  143. // common enough that we can't do it by default. See SAFE_HEAP. For ways to
  144. // help find places in your code where unaligned reads/writes are done - you
  145. // might be able to refactor your codebase to prevent them, which leads to
  146. // smaller and faster code, or even the option to turn this flag on.
  147. var FORCE_ALIGNED_MEMORY = 0;
  148. // Warn at compile time about instructions that LLVM tells us are not fully
  149. // aligned. This is useful to find places in your code where you might refactor
  150. // to ensure proper alignment. This is currently only supported in asm.js, not
  151. // wasm.
  152. var WARN_UNALIGNED = 0;
  153. // If enabled, i64 addition etc. is emulated - which is slow but precise. If
  154. // disabled, we use the 'double trick' which is fast but incurs rounding at high
  155. // values. If set to 2, we always include the i64 math code, which is necessary
  156. // in the case that we can't know at compile time that 64-bit math is needed.
  157. // For example, if you print 64-bit values with printf, but never add them, we
  158. // can't know at compile time and you need to set this to 2.
  159. var PRECISE_I64_MATH = 1;
  160. // 0: Use JS numbers for floating-point values. These are 64-bit and do not model C++
  161. // floats exactly, which are 32-bit.
  162. // 1: Model C++ floats precisely, using Math.fround, polyfilling when necessary. This
  163. // can be slow if the polyfill is used on heavy float32 computation. See note on
  164. // browser support below.
  165. // 2: Model C++ floats precisely using Math.fround if available in the JS engine, otherwise
  166. // use an empty polyfill. This will have much less of a speed penalty than using the full
  167. // polyfill in cases where engine support is not present. In addition, we can
  168. // remove the empty polyfill calls themselves on the client when generating html,
  169. // which should mean that this gives you the best of both worlds of 0 and 1, and is
  170. // therefore recommended, *unless* you need a guarantee of proper float32 precision
  171. // (in that case, use option 1).
  172. // XXX Note: To optimize float32-using code, we use the 'const' keyword in the emitted
  173. // code. This allows us to avoid unnecessary calls to Math.fround, which would
  174. // slow down engines not yet supporting that function. 'const' is present in
  175. // all modern browsers, including Firefox, Chrome and Safari, but in IE is only
  176. // present in IE11 and above. Therefore if you need to support legacy versions of
  177. // IE, you should not enable PRECISE_F32 1 or 2.
  178. var PRECISE_F32 = 0;
  179. // Whether to allow autovectorized SIMD code
  180. // (https://github.com/johnmccutchan/ecmascript_simd). SIMD intrinsics are
  181. // always compiled to SIMD code, so you only need this option if you also want
  182. // the autovectorizer to run. Note that SIMD support in browsers is not yet
  183. // there (as of Sep 2, 2014), so you will be running in a polyfill, which is not
  184. // fast.
  185. var SIMD = 0;
  186. // Whether closure compiling is being run on this output
  187. var USE_CLOSURE_COMPILER = 0;
  188. // Ignore closure warnings and errors (like on duplicate definitions)
  189. var IGNORE_CLOSURE_COMPILER_ERRORS = 0;
  190. // When enabled, does not push/pop the stack at all in functions that have no
  191. // basic stack usage. But, they may allocate stack later, and in a loop, this
  192. // can be very bad. In particular, when debugging, printf()ing a lot can exhaust
  193. // the stack very fast, with this option. In particular, be careful with the
  194. // autodebugger! (We do turn this off automatically in that case, though.)
  195. var SKIP_STACK_IN_SMALL = 1;
  196. // A limit on inlining. If 0, we will inline normally in LLVM and closure. If
  197. // greater than 0, we will *not* inline in LLVM, and we will prevent inlining of
  198. // functions of this size or larger in closure. 50 is a reasonable setting if
  199. // you do not want inlining
  200. var INLINING_LIMIT = 0;
  201. // A function size above which we try to automatically break up functions into
  202. // smaller ones, to avoid the downsides of very large functions (JS engines
  203. // often compile them very slowly, compile them with lower optimizations, or do
  204. // not optimize them at all). If 0, we do not perform outlining at all. To see
  205. // which funcs are large, you can inspect the source in a debug build (-g2 or -g
  206. // for example), and can run tools/find_bigfuncs.py on that to get a sorted list
  207. // by size. Another possibility is to look in the web console in firefox, which
  208. // will note slowly-compiling functions. You will probably want to experiment
  209. // with various values to see the impact on compilation time, code size and
  210. // runtime throughput. It is hard to say what values to start testing with, but
  211. // something around 20,000 to 100,000 might make sense. (The unit size is
  212. // number of AST nodes.) Outlining decreases maximum function size, but does so
  213. // at the cost of increasing overall code size as well as performance (outlining
  214. // itself makes code less optimized, and requires emscripten to disable some
  215. // passes that are incompatible with it).
  216. // Note: For wasm there is usually no need to set OUTLINING_LIMIT, as VMs can
  217. // handle large functions well anyhow.
  218. var OUTLINING_LIMIT = 0;
  219. // Run aggressiveVariableElimination in js-optimizer.js
  220. var AGGRESSIVE_VARIABLE_ELIMINATION = 0;
  221. // Whether to simplify ifs in js-optimizer.js
  222. // Generated code debugging options
  223. var SIMPLIFY_IFS = 1;
  224. // Check each write to the heap, for example, this will give a clear
  225. // error on what would be segfaults in a native build (like dereferencing
  226. // 0). See preamble.js for the actual checks performed.
  227. var SAFE_HEAP = 0;
  228. // Log out all SAFE_HEAP operations
  229. var SAFE_HEAP_LOG = 0;
  230. // In asm.js mode, we cannot simply add function pointers to function tables, so
  231. // we reserve some slots for them. An alternative to this is to use
  232. // EMULATED_FUNCTION_POINTERS, in which case we don't need to reserve.
  233. var RESERVED_FUNCTION_POINTERS = 0;
  234. // Whether to allow function pointers to alias if they have a different type.
  235. // This can greatly decrease table sizes in asm.js, but can break code that
  236. // compares function pointers across different types.
  237. var ALIASING_FUNCTION_POINTERS = 0;
  238. // asm.js: By default we implement function pointers using asm.js function
  239. // tables, which is very fast. With this option, we implement them more flexibly
  240. // by emulating them: we call out into JS, which handles the function tables.
  241. // 1: Full emulation. This means you can modify the
  242. // table in JS fully dynamically, not just add to
  243. // the end.
  244. // 2: Optimized emulation. Assumes once something is
  245. // added to the table, it will not change. This allows
  246. // dynamic linking while keeping performance fast,
  247. // as we can do a fast call into the internal table
  248. // if the fp is in the right range. Shared modules
  249. // (MAIN_MODULE, SIDE_MODULE) do this by default.
  250. // This requires RELOCATABLE to be set.
  251. // wasm:
  252. // By default we use a wasm Table for function pointers, which is fast and
  253. // efficient. When enabling emulation, we also use the Table *outside* the wasm
  254. // module, exactly as when emulating in asm.js, just replacing the plain JS
  255. // array with a Table. However, Tables have some limitations currently, like not
  256. // being able to assign an arbitrary JS method to them, which we have yet to
  257. // work around.
  258. var EMULATED_FUNCTION_POINTERS = 0;
  259. // Allows function pointers to be cast, wraps each call of an incorrect type
  260. // with a runtime correction. This adds overhead and should not be used
  261. // normally. It also forces ALIASING_FUNCTION_POINTERS to 0. Aside from making
  262. // calls not fail, this tries to convert values as best it can. In asm.js, this
  263. // uses doubles as the JS number type, so if you send a double to a parameter
  264. // accepting an int, it will be |0-d into a (signed) int. In wasm, we have i64s
  265. // so that is not valid, and instead we use 64 bits to represent values, as if
  266. // we wrote the sent value to memory and loaded the received type from the same
  267. // memory (using truncs/extends/ reinterprets). This means that when types do
  268. // not match the emulated values may differ between asm.js and wasm (and native,
  269. // for that matter - this is all undefined behavior). In any case, both
  270. // approaches appear good enough to support Python, which is the main use case
  271. // motivating this feature.
  272. var EMULATE_FUNCTION_POINTER_CASTS = 0;
  273. // Print out exceptions in emscriptened code. Does not work in asm.js mode
  274. var EXCEPTION_DEBUG = 0;
  275. // If 1, build in libcxxabi's full c++ demangling code, to allow stackTrace()
  276. // to emit fully proper demangled c++ names
  277. var DEMANGLE_SUPPORT = 0;
  278. // Print out when we enter a library call (library*.js). You can also unset
  279. // Runtime.debug at runtime for logging to cease, and can set it when you want
  280. // it back. A simple way to set it in C++ is
  281. // emscripten_run_script("Runtime.debug = ...;");
  282. var LIBRARY_DEBUG = 0;
  283. // Print out all syscalls
  284. var SYSCALL_DEBUG = 0;
  285. // Log out socket/network data transfer.
  286. var SOCKET_DEBUG = 0;
  287. // Select socket backend, either webrtc or websockets. XXX webrtc is not
  288. // currently tested, may be broken
  289. // As well as being configurable at compile time via the "-s" option the
  290. // WEBSOCKET_URL and WEBSOCKET_SUBPROTOCOL
  291. // settings may configured at run time via the Module object e.g.
  292. // Module['websocket'] = {subprotocol: 'base64, binary, text'};
  293. // Module['websocket'] = {url: 'wss://', subprotocol: 'base64'};
  294. // You can set 'subprotocol' to null, if you don't want to specify it
  295. // Run time configuration may be useful as it lets an application select
  296. // multiple different services.
  297. var SOCKET_WEBRTC = 0;
  298. // A string containing either a WebSocket URL prefix (ws:// or wss://) or a complete
  299. // RFC 6455 URL - "ws[s]:" "//" host [ ":" port ] path [ "?" query ].
  300. // In the (default) case of only a prefix being specified the URL will be constructed from
  301. // prefix + addr + ':' + port
  302. // where addr and port are derived from the socket connect/bind/accept calls.
  303. var WEBSOCKET_URL = 'ws://';
  304. // A string containing a comma separated list of WebSocket subprotocols
  305. // as would be present in the Sec-WebSocket-Protocol header.
  306. var WEBSOCKET_SUBPROTOCOL = 'binary';
  307. // Print out debugging information from our OpenAL implementation.
  308. var OPENAL_DEBUG = 0;
  309. // Adds extra checks for error situations in the GL library. Can impact
  310. // performance.
  311. var GL_ASSERTIONS = 0;
  312. // If enabled, prints out all API calls to WebGL contexts. (*very* verbose)
  313. var TRACE_WEBGL_CALLS = 0;
  314. // Enables more verbose debug printing of WebGL related operations. As with
  315. // LIBRARY_DEBUG, this is toggleable at runtime with option GL.debug.
  316. var GL_DEBUG = 0;
  317. // When enabled, sets preserveDrawingBuffer in the context, to allow tests to
  318. // work (but adds overhead)
  319. var GL_TESTING = 0;
  320. // How large GL emulation temp buffers are
  321. var GL_MAX_TEMP_BUFFER_SIZE = 2097152;
  322. // Enables some potentially-unsafe optimizations in GL emulation code
  323. var GL_UNSAFE_OPTS = 1;
  324. // Forces support for all GLES2 features, not just the WebGL-friendly subset.
  325. var FULL_ES2 = 0;
  326. // Enables WebGL2 native functions. This mode will also create a WebGL2
  327. // context by default if no version is specified.
  328. var USE_WEBGL2 = 0;
  329. // If true, emulates some WebGL 1 features on WebGL 2 contexts, meaning that
  330. // applications that use WebGL 1/GLES 2 can initialize a WebGL 2/GLES3 context,
  331. // but still keep using WebGL1/GLES 2 functionality that no longer is supported
  332. // in WebGL2/GLES3. Currently this emulates GL_EXT_shader_texture_lod extension
  333. // in GLSLES 1.00 shaders, support for unsized internal texture formats, and the
  334. // GL_HALF_FLOAT_OES != GL_HALF_FLOAT mixup.
  335. var WEBGL2_BACKWARDS_COMPATIBILITY_EMULATION = 0;
  336. // Forces support for all GLES3 features, not just the WebGL2-friendly subset.
  337. var FULL_ES3 = 0;
  338. // Includes code to emulate various desktop GL features. Incomplete but useful
  339. // in some cases, see
  340. // http://kripken.github.io/emscripten-site/docs/porting/multimedia_and_graphics/OpenGL-support.html
  341. var LEGACY_GL_EMULATION = 0;
  342. // If you specified LEGACY_GL_EMULATION = 1 and only use fixed function pipeline
  343. // in your code, you can also set this to 1 to signal the GL emulation layer
  344. // that it can perform extra optimizations by knowing that the user code does
  345. // not use shaders at all. If LEGACY_GL_EMULATION = 0, this setting has no
  346. // effect.
  347. var GL_FFP_ONLY = 0;
  348. // If you want to create the WebGL context up front in JS code, set this to 1
  349. // and set Module['preinitializedWebGLContext'] to a precreated WebGL context.
  350. // WebGL initialization afterwards will use this GL context to render.
  351. var GL_PREINITIALIZED_CONTEXT = 0;
  352. // Enables building of stb-image, a tiny public-domain library for decoding
  353. // images, allowing decoding of images without using the browser's built-in
  354. // decoders. The benefit is that this can be done synchronously, however, it
  355. // will not be as fast as the browser itself. When enabled, stb-image will be
  356. // used automatically from IMG_Load and IMG_Load_RW. You can also call the
  357. // stbi_* functions directly yourself.
  358. var STB_IMAGE = 0;
  359. // Enable this to get support for non-modern browsers, node.js, etc. This gives you
  360. // the highest possible probability of the code working everywhere, even in rare old
  361. // browsers and shell environments. Specifically:
  362. // * Add polyfilling for Math.clz32, Math.trunc, Math.imul, Math.fround.
  363. // * Disable WebAssembly.
  364. var LEGACY_VM_SUPPORT = 0;
  365. // By default, emscripten output will run on the web, in a web worker,
  366. // in node.js, or in a JS shell like d8, js, or jsc. You can set this option to
  367. // specify that the output should only run in one particular environment, which
  368. // must be one of
  369. // 'web' - the normal web environment.
  370. // 'worker' - a web worker environment.
  371. // 'node' - Node.js.
  372. // 'shell' - a JS shell like d8, js, or jsc.
  373. // (There is also a 'pthread' environment, see shell.js, but it cannot be specified
  374. // manually yet TODO)
  375. var ENVIRONMENT = '';
  376. // Enable this to support lz4-compressed file packages. They are stored compressed in memory, and
  377. // decompressed on the fly, avoiding storing the entire decompressed data in memory at once.
  378. // If you run the file packager separately, you still need to build the main program with this flag,
  379. // and also pass --lz4 to the file packager.
  380. // (You can also manually compress one on the client, using LZ4.loadPackage(), but that is less
  381. // recommended.)
  382. // Limitations:
  383. // * LZ4-compressed files are only decompressed when needed, so they are not available
  384. // for special preloading operations like pre-decoding of images using browser codecs,
  385. // preloadPlugin stuff, etc.
  386. // * LZ4 files are read-only.
  387. var LZ4 = 0;
  388. // Disables generating code to actually catch exceptions. This disabling is on
  389. // by default as the overhead of exceptions is quite high in size and speed
  390. // currently (in the future, wasm should improve that). When exceptions are
  391. // disabled, if an exception actually happens then it will not be caught
  392. // and the program will halt (so this will not introduce silent failures).
  393. // There are 3 specific modes here:
  394. // DISABLE_EXCEPTION_CATCHING = 0 - generate code to actually catch exceptions
  395. // DISABLE_EXCEPTION_CATCHING = 1 - disable exception catching at all
  396. // DISABLE_EXCEPTION_CATCHING = 2 - disable exception catching, but enables
  397. // catching in whitelist
  398. // XXX note that this removes *catching* of exceptions, which is the main
  399. // issue for speed, but you should build source files with
  400. // -fno-exceptions to really get rid of all exceptions code overhead,
  401. // as it may contain thrown exceptions that are never caught (e.g.
  402. // just using std::vector can have that). -fno-rtti may help as well.
  403. var DISABLE_EXCEPTION_CATCHING = 1;
  404. // Enables catching exception in the listed functions only, if
  405. // DISABLE_EXCEPTION_CATCHING = 2 is set
  406. var EXCEPTION_CATCHING_WHITELIST = [];
  407. // By default we handle exit() in node, by catching the Exit exception. However,
  408. // this means we catch all process exceptions. If you disable this, then we no
  409. // longer do that, and exceptions work normally, which can be useful for libraries
  410. // or programs that don't need exit() to work.
  411. // For more explanations of this option, please visit
  412. // https://github.com/kripken/emscripten/wiki/Asyncify
  413. var NODEJS_CATCH_EXIT = 1;
  414. // Whether to enable asyncify transformation
  415. // This allows to inject some async functions to the C code that appear to be sync
  416. // e.g. emscripten_sleep
  417. var ASYNCIFY = 0;
  418. // Functions that call any function in the list, directly or indirectly
  419. var ASYNCIFY_FUNCTIONS = ['emscripten_sleep',
  420. 'emscripten_wget', // will be transformed
  421. 'emscripten_yield'];
  422. // Functions in this list are never considered async, even if they appear in ASYNCIFY_FUNCTIONS
  423. var ASYNCIFY_WHITELIST = ['qsort',
  424. 'trinkle', // In the asyncify transformation, any function that calls a function pointer is considered async
  425. '__toread', // This whitelist is useful when a function is known to be sync
  426. '__uflow', // currently this link contains some functions in libc
  427. '__fwritex',
  428. 'MUSL_vfprintf'];
  429. // Runtime elements that are exported on Module by default. We used to export
  430. // quite a lot here, but have removed them all, so this option is redundant
  431. // given that EXTRA_EXPORTED_RUNTIME_METHODS exists, and so this option exists
  432. // only for backwards compatibility. You should use
  433. // EXTRA_EXPORTED_RUNTIME_METHODS for things you want to export from the
  434. // runtime. Note that methods on this list are only exported if they are
  435. // included (either automatically from linking, or due to being in
  436. // DEFAULT_LIBRARY_FUNCS_TO_INCLUDE).
  437. // Note that the name may be slightly misleading, as this is for any JS library
  438. // element, and not just methods. For example, we export the Runtime object by
  439. // having "Runtime" in this list.
  440. var EXPORTED_RUNTIME_METHODS = [];
  441. // Additional methods to those in EXPORTED_RUNTIME_METHODS. Adjusting that list
  442. // lets you remove methods that would be exported by default; setting values in
  443. // this list lets you add to the default list without modifying it.
  444. var EXTRA_EXPORTED_RUNTIME_METHODS = [];
  445. // Log all FS operations. This is especially helpful when you're porting a new
  446. // project and want to see a list of file system operations happening so that
  447. // you can create a virtual file system with all of the required files.
  448. var FS_LOG = 0;
  449. // If set to nonzero, the provided virtual filesystem if treated
  450. // case-insensitive, like Windows and OSX do. If set to 0, the VFS is
  451. // case-sensitive, like on Linux.
  452. var CASE_INSENSITIVE_FS = 0;
  453. // If set to nonzero, MEMFS will always utilize typed arrays as the backing
  454. // store for appending data to files. The default behavior is to use typed
  455. // arrays for files when the file size doesn't change after initial creation,
  456. // and for files that do change size, use normal JS arrays instead.
  457. var MEMFS_APPEND_TO_TYPED_ARRAYS = 0;
  458. // If set to 0, does not build in any filesystem support. Useful if you are just
  459. // doing pure computation, but not reading files or using any streams (including
  460. // fprintf, and other stdio.h things) or anything related. The one exception is
  461. // there is partial support for printf, and puts, hackishly. The compiler will
  462. // automatically set this if it detects that syscall usage (which is static)
  463. // does not require a full filesystem. If you still want filesystem support, use
  464. // FORCE_FILESYSTEM
  465. var FILESYSTEM = 1;
  466. // Makes full filesystem support be included, even if statically it looks like
  467. // it is not used. For example, if your C code uses no files, but you include
  468. // some JS that does, you might need this.
  469. var FORCE_FILESYSTEM = 0;
  470. // This mode is intended for use with Node.js (and will throw if the build runs
  471. // in other engines). The File System API will directly use Node.js API without
  472. // requiring `FS.mount()`. The initial working directory will be same as
  473. // process.cwd() instead of VFS root directory. Because this mode directly uses
  474. // Node.js to access the real local filesystem on your OS, the code will not
  475. // necessarily be portable between OSes - it will be as portable as a Node.js
  476. // program would be, which means that differences in how the underlying OS
  477. // handles permissions and errors and so forth may be noticeable. This has
  478. // mostly been tested on Linux so far.
  479. var NODERAWFS = 0;
  480. // Functions that are explicitly exported. These functions are kept alive
  481. // through LLVM dead code elimination, and also made accessible outside of the
  482. // generated code even after running closure compiler (on "Module"). Note the
  483. // necessary prefix of "_".
  484. //
  485. // Note also that this is the full list of exported functions - if you have a
  486. // main() function and want it to run, you must include it in this list (as
  487. // _main is by default in this value, and if you override it without keeping it
  488. // there, you are in effect removing it).
  489. var EXPORTED_FUNCTIONS = ['_main'];
  490. // If true, we export all the symbols. Note that this does *not* affect LLVM, so
  491. // it can still eliminate functions as dead. This just exports them on the
  492. // Module object.
  493. var EXPORT_ALL = 0;
  494. // Export all bindings generator functions (prefixed with emscripten_bind_). This
  495. // is necessary to use the WebIDL binder with asm.js
  496. var EXPORT_BINDINGS = 0;
  497. // If true, export all the functions appearing in a function table, and the
  498. // tables themselves.
  499. var EXPORT_FUNCTION_TABLES = 0;
  500. // Remembers the values of these settings, and makes them accessible
  501. // through Runtime.getCompilerSetting and emscripten_get_compiler_setting.
  502. // To see what is retained, look for compilerSettings in the generated code.
  503. var RETAIN_COMPILER_SETTINGS = 0;
  504. // this will contain the emscripten version. you should not modify it. This
  505. // and the following few settings are useful in combination with
  506. // RETAIN_COMPILER_SETTINGS
  507. var EMSCRIPTEN_VERSION = '';
  508. // this will contain the optimization level (-Ox). you should not modify it.
  509. var OPT_LEVEL = 0;
  510. // this will contain the debug level (-gx). you should not modify it.
  511. var DEBUG_LEVEL = 0;
  512. // Whether we are profiling functions. you should not modify it.
  513. var PROFILING_FUNCS = 0;
  514. // JS library elements (C functions implemented in JS) that we include by
  515. // default. If you want to make sure something is included by the JS compiler,
  516. // add it here. For example, if you do not use some emscripten_* C API call
  517. // from C, but you want to call it from JS, add it here (and in EXPORTED
  518. // FUNCTIONS with prefix "_", if you use closure compiler). Note that the name
  519. // may be slightly misleading, as this is for any JS library element, and not
  520. // just functions. For example, you can include the Browser object by adding
  521. // "$Browser" to this list.
  522. var DEFAULT_LIBRARY_FUNCS_TO_INCLUDE = ['memcpy', 'memset', 'malloc', 'free'];
  523. // This list is also used to determine auto-exporting of library dependencies
  524. // (i.e., functions that might be dependencies of JS library functions, that if
  525. // so we must export so that if they are implemented in C they will be
  526. // accessible, in ASM_JS mode).
  527. var LIBRARY_DEPS_TO_AUTOEXPORT = ['memcpy'];
  528. // Include all JS library functions instead of the sum of
  529. // DEFAULT_LIBRARY_FUNCS_TO_INCLUDE + any functions used by the generated code.
  530. // This is needed when dynamically loading (i.e. dlopen) modules that make use
  531. // of runtime library functions that are not used in the main module. Note that
  532. // this only applies to js libraries, *not* C. You will need the main file to
  533. // include all needed C libraries. For example, if a module uses malloc or new,
  534. // you will need to use those in the main file too to pull in malloc for use by
  535. // the module.
  536. var INCLUDE_FULL_LIBRARY = 0;
  537. // Set this to a string to override the shell file used
  538. var SHELL_FILE = 0;
  539. // If set to 1, we emit relocatable code from the LLVM backend; both
  540. // globals and function pointers are all offset (by gb and fp, respectively)
  541. var RELOCATABLE = 0;
  542. // A main module is a file compiled in a way that allows us to link it to
  543. // a side module using emlink.py.
  544. // 1: Normal main module.
  545. // 2: DCE'd main module. We eliminate dead code normally. If a side
  546. // module needs something from main, it is up to you to make sure
  547. // it is kept alive.
  548. var MAIN_MODULE = 0;
  549. // Corresponds to MAIN_MODULE (also supports modes 1 and 2)
  550. var SIDE_MODULE = 0;
  551. // If this is a main module (MAIN_MODULE == 1), then
  552. // we will link these at runtime. They must have been built with
  553. // SIDE_MODULE == 1.
  554. var RUNTIME_LINKED_LIBS = [];
  555. // (deprecated option TODO: remove)
  556. var BUILD_AS_SHARED_LIB = 0;
  557. // If set to 1, this is a worker library, a special kind of library that is run
  558. // in a worker. See emscripten.h
  559. var BUILD_AS_WORKER = 0;
  560. // If set to 1, we build the project into a js file that will run in a worker,
  561. // and generate an html file that proxies input and output to/from it.
  562. var PROXY_TO_WORKER = 0;
  563. // If set, the script file name the main thread loads. Useful if your project
  564. // doesn't run the main emscripten- generated script immediately but does some
  565. // setup before
  566. var PROXY_TO_WORKER_FILENAME = '';
  567. // If set to 1, compiles in a small stub main() in between the real main() which
  568. // calls pthread_create() to run the application main() in a pthread. This is
  569. // something that applications can do manually as well if they wish, this option
  570. // is provided as convenience.
  571. var PROXY_TO_PTHREAD = 0;
  572. // If set to 1, this file can be linked with others, either as a shared library
  573. // or as the main file that calls a shared library. To enable that, we will not
  574. // internalize all symbols and cull the unused ones, in other words, we will not
  575. // remove unused functions and globals, which might be used by another module we
  576. // are linked with.
  577. //
  578. // BUILD_AS_SHARED_LIB > 0 implies this, so it is only important to set this to
  579. // 1 when building the main file, and *if* that main file has symbols that the
  580. // library it will open will then access through an extern. LINKABLE of 0 is
  581. // very useful in that we can reduce the size of the generated code very
  582. // significantly, by removing everything not actually used.
  583. var LINKABLE = 0;
  584. // Emscripten 'strict' build mode: Drop supporting any deprecated build options.
  585. // Set the environment variable EMCC_STRICT=1 or pass -s STRICT=1 to test that a
  586. // codebase builds nicely in forward compatible manner.
  587. var STRICT = 0;
  588. // If set to 1, we will warn on any undefined symbols that are not resolved by
  589. // the library_*.js files. Note that it is common in large projects to not
  590. // implement everything, when you know what is not going to actually be called
  591. // (and don't want to mess with the existing buildsystem), and functions might
  592. // be implemented later on, say in --pre-js, so you may want to build with -s
  593. // WARN_ON_UNDEFINED_SYMBOLS=0 to disable the warnings if they annoy you. See
  594. // also ERROR_ON_UNDEFINED_SYMBOLS. Any undefined symbols that are listed in-
  595. // EXPORTED_FUNCTIONS will also be reported.
  596. var WARN_ON_UNDEFINED_SYMBOLS = 1;
  597. // If set to 1, we will give a link-time error on any undefined symbols (see
  598. // WARN_ON_UNDEFINED_SYMBOLS). The default value is 1. To allow undefined
  599. // symbols at link time set this to 0, in which case if an undefined function is
  600. // called a runtime error will occur. Any undefined symbols that are listed in
  601. // EXPORTED_FUNCTIONS will also be reported.
  602. var ERROR_ON_UNDEFINED_SYMBOLS = 1;
  603. // If set to 1, any -lfoo directives pointing to nonexisting library files will
  604. // issue a linker error.
  605. // The default value for this is currently 0, but will be transitioned to 1 in
  606. // the future. To keep relying on building with -s ERROR_ON_MISSING_LIBRARIES=0
  607. // setting, prefer to set that option explicitly in your build system.
  608. var ERROR_ON_MISSING_LIBRARIES = 0;
  609. // Specifies a list of Emscripten-provided JS libraries to link against.
  610. // (internal, use -lfoo or -lfoo.js to link to Emscripten system JS libraries)
  611. var SYSTEM_JS_LIBRARIES = [];
  612. // Use small chunk size for binary synchronous XHR's in Web Workers. Used for
  613. // testing. See test_chunked_synchronous_xhr in runner.py and library.js.
  614. var SMALL_XHR_CHUNKS = 0;
  615. // If 1, will include shim code that tries to 'fake' a browser environment, in
  616. // order to let you run a browser program (say, using SDL) in the shell.
  617. // Obviously nothing is rendered, but this can be useful for benchmarking and
  618. // debugging if actual rendering is not the issue. Note that the shim code is
  619. // very partial - it is hard to fake a whole browser! - so keep your
  620. // expectations low for this to work.
  621. var HEADLESS = 0;
  622. // If 1, we force Date.now(), Math.random, etc. to return deterministic results.
  623. // Good for comparing builds for debugging purposes (and nothing else)
  624. var DETERMINISTIC = 0;
  625. // By default we emit all code in a straightforward way into the output
  626. // .js file. That means that if you load that in a script tag in a web
  627. // page, it will use the global scope. With MODULARIZE set, we will instead emit
  628. //
  629. // var EXPORT_NAME = function(Module) {
  630. // Module = Module || {};
  631. // // .. all the emitted code from emscripten ..
  632. // return Module;
  633. // };
  634. //
  635. // where EXPORT_NAME is from the option of the same name (so, by default
  636. // it will be var Module = ..., and so you should change EXPORT_NAME if
  637. // you want more than one module in the same web page).
  638. //
  639. // You can then use this by something like
  640. //
  641. // var instance = EXPORT_NAME();
  642. //
  643. // or
  644. //
  645. // var instance = EXPORT_NAME({ option: value, ... });
  646. //
  647. // Note the parentheses - we are calling EXPORT_NAME in order to instantiate
  648. // the module. (This allows, in particular, for you to create multiple
  649. // instantiations, etc.)
  650. //
  651. // If you add --pre-js or --post-js files, they will be included inside
  652. // the module with the rest of the emitted code. That way, they can be
  653. // optimized together with it. (If you want something outside of the module,
  654. // that is, literally before or after all the code including the extra
  655. // MODULARIZE code, you can do that by modifying the JS yourself after
  656. // emscripten runs. While --pre-js and --post-js happen to do that in
  657. // non-modularize mode, their big feature is that they add code to be
  658. // optimized with the rest of the emitted code, allowing better dead code
  659. // elimination and minification.)
  660. //
  661. // Modularize also provides a promise-like API,
  662. //
  663. // var instance = EXPORT_NAME().then(function(Module) { .. });
  664. //
  665. // The callback is called when it is safe to run compiled code, similar
  666. // to the onRuntimeInitialized callback (i.e., it waits for all
  667. // necessary async events). It receives the instance as a parameter,
  668. // for convenience.
  669. //
  670. // Note that in MODULARIZE mode we do *not* look at the global `Module`
  671. // object, so if you define things there they will be ignored. The reason
  672. // is that you will be constructing the instances manually, and can
  673. // provide Module there, or something else, as you want. This differs
  674. // in MODULARIZE_INSTANCE mode, where we *do* look at the global, since
  675. // as in non-MODULARIZE mode there is just one global instance, and it
  676. // is constructed by the setup code.
  677. var MODULARIZE = 0;
  678. // Similar to MODULARIZE, but while that mode exports a function, with which you
  679. // can create multiple instances, this option exports a singleton instance. In
  680. // other words, it's the same as if you used MODULARIZE and did EXPORT_NAME =
  681. // EXPORT_NAME() to create the instance manually.
  682. //
  683. // Note that the promise-like API MODULARIZE provides isn't available here
  684. // (since you arean't creating the instance yourself).
  685. var MODULARIZE_INSTANCE = 0;
  686. // Export using an ES6 Module export rather than a UMD export. MODULARIZE must
  687. // be enabled for ES6 exports.
  688. var EXPORT_ES6 = 0;
  689. // If 1, will just time how long main() takes to execute, and not print out
  690. // anything at all whatsoever. This is useful for benchmarking.
  691. var BENCHMARK = 0;
  692. // If 1, generate code in asm.js format. If 2, emits the same code except for
  693. // omitting 'use asm'
  694. var ASM_JS = 1;
  695. // If 1, will finalize the final emitted code, including operations that prevent
  696. // later js optimizer passes from running, like converting +5 into 5.0 (the js
  697. // optimizer sees 5.0 as just 5).
  698. var FINALIZE_ASM_JS = 1;
  699. // If 1, then all exports from the asm/wasm module will be accessed indirectly,
  700. // which allow the module to be swapped later, simply by replacing
  701. // Module['asm'].
  702. //
  703. // Note: It is very important that the replacement module be built with the same
  704. // optimizations and so forth, as we depend on them being a drop-in replacement
  705. // for each other (same globals on the heap at the same locations, etc.)
  706. var SWAPPABLE_ASM_MODULE = 0;
  707. // see emcc --separate-asm
  708. var SEPARATE_ASM = 0;
  709. // This disables linking and other causes of adding extra code automatically,
  710. // and as a result, your output compiled code (in the .asm.js file, if you emit
  711. // with --separate-asm) will contain only the functions you provide.
  712. var ONLY_MY_CODE = 0;
  713. // Enables profile-guided optimization in the form of runtime checks for which
  714. // functions are actually called. Emits a list during shutdown that you can pass
  715. // to DEAD_FUNCTIONS (you can also emit the list manually by calling
  716. // PGOMonitor.dump());
  717. var PGO = 0;
  718. // JS library functions on this list are not converted to JS, and calls to them
  719. // are turned into abort()s. This is potentially useful for reducing code size.
  720. // If a dead function is actually called, you will get a runtime error.
  721. //
  722. // TODO: make this work on compiled methods as well, perhaps by adding a JS
  723. // optimizer pass?
  724. var DEAD_FUNCTIONS = [];
  725. // If 1, generate an explicit conversion of zext i1 to i32, using ?:
  726. var EXPLICIT_ZEXT = 0;
  727. // Global variable to export the module as for environments without a
  728. // standardized module loading system (e.g. the browser and SM shell).
  729. var EXPORT_NAME = 'Module';
  730. // When set to 0, we do not emit eval() and new Function(), which disables some functionality
  731. // (causing runtime errors if attempted to be used), but allows the emitted code to be
  732. // acceptable in places that disallow dynamic code execution (chrome packaged app,
  733. // privileged firefox app, etc.). Pass this flag when developing an Emscripten application
  734. // that is targeting a privileged or a certified execution environment, see
  735. // Firefox Content Security Policy (CSP) webpage for details:
  736. // https://developer.mozilla.org/en-US/Apps/Build/Building_apps_for_Firefox_OS/CSP
  737. // When this flag is set, the following features (linker flags) are unavailable:
  738. // --closure 1: When using closure compiler, eval() would be needed to locate the Module object.
  739. // -s RELOCATABLE=1: the function Runtime.loadDynamicLibrary would need to eval().
  740. // --bind: Embind would need to eval().
  741. // Additionally, the following Emscripten runtime functions are unavailable when
  742. // DYNAMIC_EXECUTION=0 is set, and an attempt to call them will throw an exception:
  743. // - emscripten_run_script(),
  744. // - emscripten_run_script_int(),
  745. // - emscripten_run_script_string(),
  746. // - dlopen(),
  747. // - the functions ccall() and cwrap() are still available, but they are restricted to only
  748. // being able to call functions that have been exported in the Module object in advance.
  749. // When set to -s DYNAMIC_EXECUTION=2 flag is set, attempts to call to eval() are demoted
  750. // to warnings instead of throwing an exception.
  751. var DYNAMIC_EXECUTION = 1;
  752. // Runs tools/emterpretify on the compiler output
  753. var EMTERPRETIFY = 0;
  754. // If defined, a file to write bytecode to, otherwise the default is to embed it
  755. // in text JS arrays (which is less efficient). When emitting HTML, we
  756. // automatically generate code to load this file and set it to
  757. // Module.emterpreterFile. If you emit JS, you need to make sure that
  758. // Module.emterpreterFile contains an ArrayBuffer with the bytecode, when the
  759. // code loads. Note: You might need to quote twice in the shell, something like
  760. // -s 'EMTERPRETIFY_FILE="waka"'
  761. var EMTERPRETIFY_FILE = '';
  762. // Functions to not emterpret, that is, to run normally at full speed
  763. var EMTERPRETIFY_BLACKLIST = [];
  764. // If this contains any functions, then only the functions in this list are
  765. // emterpreted (as if all the rest are blacklisted; this overrides the
  766. // BLACKLIST)
  767. var EMTERPRETIFY_WHITELIST = [];
  768. // Allows sync code in the emterpreter, by saving the call stack, doing an async
  769. // delay, and resuming it
  770. var EMTERPRETIFY_ASYNC = 0;
  771. // Performs a static analysis to suggest which functions should be run in the
  772. // emterpreter, as it appears they can be on the stack when a sync function is
  773. // called in the EMTERPRETIFY_ASYNC option. After showing the suggested list,
  774. // compilation will halt. You can apply the provided list as an emcc argument
  775. // when compiling later.
  776. var EMTERPRETIFY_ADVISE = 0;
  777. // If you have additional custom synchronous functions, add them to this list
  778. // and the advise mode will include them in its analysis.
  779. var EMTERPRETIFY_SYNCLIST = [];
  780. // If > 0, we split memory into chunks, of the size given in this parameter.
  781. // * TOTAL_MEMORY becomes the maximum amount of memory, as chunks are allocated on
  782. // demand. That means this achieves a result similar to ALLOW_MEMORY_GROWTH, but
  783. // better since it can free chunks in the middle. You still to set
  784. // ALLOW_MEMORY_GROWTH if you want memory to grow beyond the initial TOTAL_MEMORY
  785. // target.
  786. // * Larger SPLIT_MEMORY sizes are generally faster to run.
  787. // TODO: more docs
  788. // TODO: add malloc-split to embuilder
  789. var SPLIT_MEMORY = 0;
  790. // Similar to SAFE_HEAP, but for SPLIT_MEMORY.
  791. var SAFE_SPLIT_MEMORY = 0;
  792. // whether js opts will be run, after the main compiler
  793. var RUNNING_JS_OPTS = 0;
  794. // whether we are in the generate struct_info bootstrap phase
  795. var BOOTSTRAPPING_STRUCT_INFO = 0;
  796. // struct_info that is either generated or cached
  797. var STRUCT_INFO = '';
  798. // Add some calls to emscripten tracing APIs
  799. var EMSCRIPTEN_TRACING = 0;
  800. // Specify the GLFW version that is being linked against. Only relevant, if you
  801. // are linking against the GLFW library. Valid options are 2 for GLFW2 and 3
  802. // for GLFW3.
  803. var USE_GLFW = 2;
  804. // Whether to use compile code to WebAssembly. Set this to 0 to compile to
  805. // asm.js. This will fetch the binaryen port and build it. (If, instead, you
  806. // set BINARYEN_ROOT in your ~/.emscripten file, then we use that instead of the
  807. // port, which can useful for local dev work on binaryen itself).
  808. var WASM = 1;
  809. // Whether to use the WebAssembly backend that is in development in LLVM. You
  810. // should not set this yourself, instead set EMCC_WASM_BACKEND=1 in the
  811. // environment.
  812. var WASM_BACKEND = 0;
  813. // Whether to compile object files as wasm as opposed to the default
  814. // of using LLVM IR.
  815. var WASM_OBJECT_FILES = 0;
  816. // How we should run WebAssembly code. By default, we run it natively.
  817. // See binaryen's src/js/wasm.js-post.js for more details and options.
  818. var BINARYEN_METHOD = "native-wasm";
  819. // An optional comma-separated list of script hooks to run after binaryen,
  820. // in binaryen's /scripts dir.
  821. var BINARYEN_SCRIPTS = "";
  822. // Whether to ignore implicit traps when optimizing in binaryen. Implicit traps
  823. // are the unlikely traps that happen in a load that is out of bounds, or
  824. // div/rem of 0, etc. We can reorder them, but we can't ignore that they have
  825. // side effects, so turning on this flag lets us do a little more to reduce code
  826. // size.
  827. var BINARYEN_IGNORE_IMPLICIT_TRAPS = 0;
  828. // How we handle wasm operations that may trap, which includes integer
  829. // div/rem of 0 and float-to-int of values too large to fit in an int.
  830. // js: do exactly what js does. this can be slower.
  831. // clamp: avoid traps by clamping to a reasonable value. this can be
  832. // faster than "js".
  833. // allow: allow creating operations that can trap. this is the most
  834. // compact, as we just emit a single wasm operation, with no
  835. // guards to trapping values, and also often the fastest.
  836. var BINARYEN_TRAP_MODE = "allow";
  837. // A comma-separated list of passes to run in the binaryen optimizer, for
  838. // example, "dce,precompute,vacuum". When set, this overrides the default
  839. // passes we would normally run.
  840. var BINARYEN_PASSES = "";
  841. // Set the maximum size of memory in the wasm module (in bytes). Without this,
  842. // TOTAL_MEMORY is used (as it is used for the initial value), or if memory
  843. // growth is enabled, the default value here (-1) is to have no limit, but you
  844. // can set this to set a maximum size that growth will stop at.
  845. //
  846. // (This option was formerly called BINARYEN_MEM_MAX)
  847. var WASM_MEM_MAX = -1;
  848. // Whether to compile the wasm asynchronously, which is more efficient and does
  849. // not block the main thread. This is currently required for all but the
  850. // smallest modules to run in V8
  851. var BINARYEN_ASYNC_COMPILATION = 1;
  852. // Directory where we can find Binaryen. Will be automatically set for you, but
  853. // you can set it to override if you are a Binaryen developer.
  854. var BINARYEN_ROOT = "";
  855. // Whether to legalize the JS FFI interfaces (imports/exports) by wrapping them
  856. // to automatically demote i64 to i32 and promote f32 to f64. This is necessary
  857. // in order to interface with JavaScript, both for asm.js and wasm. For
  858. // non-web/non-JS embeddings, setting this to 0 may be desirable.
  859. // LEGALIZE_JS_FFI=0 is incompatible with RUNNING_JS_OPTS and using non-wasm
  860. // BINARYEN_METHOD settings.
  861. var LEGALIZE_JS_FFI = 1;
  862. // Ports
  863. // Specify the SDL version that is being linked against.
  864. // 1, the default, is 1.3, which is implemented in JS
  865. // 2 is a port of the SDL C code on emscripten-ports
  866. var USE_SDL = 1;
  867. // Specify the SDL_gfx version that is being linked against. Must match USE_SDL
  868. var USE_SDL_GFX = 0;
  869. // Specify the SDL_image version that is being linked against. Must match USE_SDL
  870. var USE_SDL_IMAGE = 1;
  871. // Specify the SDL_ttf version that is being linked against. Must match USE_SDL
  872. var USE_SDL_TTF = 1;
  873. // Specify the SDL_net version that is being linked against. Must match USE_SDL
  874. var USE_SDL_NET = 1;
  875. // 1 = use icu from emscripten-ports
  876. var USE_ICU = 0;
  877. // 1 = use zlib from emscripten-ports
  878. var USE_ZLIB = 0;
  879. // 1 = use libpng from emscripten-ports
  880. var USE_LIBPNG = 0;
  881. // 1 = use bullet from emscripten-ports
  882. var USE_BULLET = 0;
  883. // 1 = use vorbis from emscripten-ports
  884. var USE_VORBIS = 0;
  885. // 1 = use ogg from emscripten-ports
  886. var USE_OGG = 0;
  887. // 1 = use freetype from emscripten-ports
  888. var USE_FREETYPE = 0;
  889. // 1 = use harfbuzz from harfbuzz upstream
  890. var USE_HARFBUZZ = 0;
  891. // 3 = use cocos2d v3 from emscripten-ports
  892. var USE_COCOS2D = 0;
  893. // Formats to support in SDL2_image. Valid values: bmp, gif, lbm, pcx, png, pnm, tga, xcf, xpm, xv
  894. var SDL2_IMAGE_FORMATS = [];
  895. // Compiler debugging options
  896. //
  897. // Some useful items:
  898. // framework
  899. // frameworkLines
  900. // gconst
  901. // types
  902. // vars
  903. // unparsedFunctions
  904. // metadata
  905. // legalizer
  906. var DEBUG_TAGS_SHOWING = [];
  907. // For internal use only
  908. var ORIGINAL_EXPORTED_FUNCTIONS = [];
  909. // The list of defines (C_DEFINES) was moved into struct_info.json in the same
  910. // directory. That file is automatically parsed by tools/gen_struct_info.py.
  911. // If you modify the headers, just clear your cache and emscripten libc should
  912. // see the new values.
  913. // If true, the current build is performed for the Emscripten test harness.
  914. var IN_TEST_HARNESS = 0;
  915. // If true, enables support for pthreads.
  916. var USE_PTHREADS = 0;
  917. // Specifies the number of web workers that are preallocated before runtime is
  918. // initialized. If 0, workers are created on demand.
  919. var PTHREAD_POOL_SIZE = 0;
  920. // If not explicitly specified, this is the stack size to use for newly created
  921. // pthreads. According to
  922. // http://man7.org/linux/man-pages/man3/pthread_create.3.html, default stack
  923. // size on Linux/x86-32 for a new thread is 2 megabytes, so follow the same
  924. // convention. Use pthread_attr_setstacksize() at thread creation time to
  925. // explicitly specify the stack size, in which case this value is ignored. Note
  926. // that the asm.js/wasm function call control flow stack is separate from this
  927. // stack, and this stack only contains certain function local variables, such as
  928. // those that have their addresses taken, or ones that are too large to fit as
  929. // local vars in asm.js/wasm code.
  930. var DEFAULT_PTHREAD_STACK_SIZE = 2*1024*1024;
  931. // Specifies the value returned by the function emscripten_num_logical_cores()
  932. // if navigator.hardwareConcurrency is not supported. Pass in a negative number
  933. // to show a popup dialog at startup so the user can configure this dynamically.
  934. var PTHREAD_HINT_NUM_CORES = 4;
  935. // True when building with --threadprofiler
  936. var PTHREADS_PROFILING = 0;
  937. // If true, add in debug traces for diagnosing pthreads related issues.
  938. var PTHREADS_DEBUG = 0;
  939. var MAX_GLOBAL_ALIGN = -1; // received from the backend
  940. var IMPLEMENTED_FUNCTIONS = []; // received from the backend
  941. var JSCALL_START_INDEX = 0; // received from the backend
  942. var JSCALL_SIG_ORDER = {}; // received from the backend
  943. // Duplicate function elimination. This coalesces function bodies that are
  944. // identical, which can happen e.g. if two methods have different C/C++ or LLVM
  945. // types, but end up identical at the asm.js level (all pointers are the same as
  946. // int32_t in asm.js, for example).
  947. //
  948. // This option is quite slow to run, as it processes and hashes all methods in
  949. // the codebase in multiple passes.
  950. var ELIMINATE_DUPLICATE_FUNCTIONS = 0; // disabled by default
  951. var ELIMINATE_DUPLICATE_FUNCTIONS_DUMP_EQUIVALENT_FUNCTIONS = 0;
  952. var ELIMINATE_DUPLICATE_FUNCTIONS_PASSES = 5;
  953. // This tries to evaluate global ctors at compile-time, applying their effects
  954. // into the mem init file. This saves running code during startup, and also
  955. // allows removing the global ctor functions and other code that only they used,
  956. // so this is also good for reducing code size. However, this does make the
  957. // compile step much slower.
  958. //
  959. // This basically runs the ctors during compile time, seeing if they execute
  960. // safely in a sandbox. Any ffi access out of asm.js causes failure, as it could
  961. // do something nondeterministic and/or alter some other state we don't see. If
  962. // all the global ctor does is pure computation inside asm.js, it should be ok.
  963. // Run with EMCC_DEBUG=1 in the env to see logging, and errors when it fails to
  964. // eval (you'll see a message, or a stack trace; in the latter case, the
  965. // functions on the stack should give you an idea of what ffi was called and
  966. // why, and perhaps you can refactor your code to avoid it, e.g., remove
  967. // mallocs, printfs in global ctors).
  968. //
  969. // This optimization can increase the size of the mem init file, because ctors
  970. // can write to memory that would otherwise be in a zeroinit area. This may not
  971. // be a significant increase after gzip, if there are mostly zeros in there, and
  972. // in any case the mem init increase would be offset by a code size decrease.
  973. // (Unless you have a small ctor that writes 'random' data to memory, which
  974. // would reduce little code but add potentially lots of uncompressible data.)
  975. //
  976. // LLVM's GlobalOpt *almost* does this operation. It does in simple cases, where
  977. // LLVM IR is not too complex for its logic to evaluate, but it isn't powerful
  978. // enough for e.g. libc++ iostream ctors. It is just hard to do at the LLVM IR
  979. // level - LLVM IR is complex and getting more complex, this would require
  980. // GlobalOpt to have a full interpreter, plus a way to write back into LLVM IR
  981. // global objects. At the asm.js level, however, everything has been lowered
  982. // into a simple low level, and we also just need to write bytes into an array,
  983. // so this is easy for us to do, but not for LLVM. A further issue for LLVM is
  984. // that it doesn't know that we will not link in further code, so it only tries
  985. // to optimize ctors with lowest priority. We do know that, and can optimize all
  986. // the ctors.
  987. var EVAL_CTORS = 0;
  988. // see http://kripken.github.io/emscripten-site/docs/debugging/CyberDWARF.html
  989. var CYBERDWARF = 0;
  990. // Path to the CyberDWARF debug file passed to the compiler
  991. var BUNDLED_CD_DEBUG_FILE = "";
  992. // Is enabled, use the JavaScript TextDecoder API for string marshalling.
  993. // Enabled by default, set this to 0 to disable.
  994. var TEXTDECODER = 1;
  995. // Embind specific: If enabled, assume UTF-8 encoded data in std::string binding.
  996. // Disable this to support binary data transfer.
  997. var EMBIND_STD_STRING_IS_UTF8 = 1;
  998. // If set to 1, enables support for transferring canvases to pthreads and
  999. // creating WebGL contexts in them, as well as explicit swap control for GL
  1000. // contexts. This needs browser support for the OffscreenCanvas specification.
  1001. var OFFSCREENCANVAS_SUPPORT = 0;
  1002. // If set to 1, enables support for WebGL contexts to render to an offscreen
  1003. // render target, to avoid the implicit swap behavior of WebGL where exiting any
  1004. // event callback would automatically perform a "flip" to present rendered
  1005. // content on screen. When an Emscripten GL context has Offscreen Framebuffer
  1006. // enabled, a single frame can be composited from multiple event callbacks, and
  1007. // the swap function emscripten_webgl_commit_frame() is then explicitly called
  1008. // to present the rendered content on screen.
  1009. //
  1010. // The OffscreenCanvas feature also enables explicit GL frame swapping support,
  1011. // and also, -s OFFSCREEN_FRAMEBUFFER=1 feature can be used to polyfill support
  1012. // for accessing WebGL in multiple threads in the absence of OffscreenCanvas
  1013. // support in browser, at the cost of some performance and latency.
  1014. // OffscreenCanvas and Offscreen Framebuffer support can be enabled at the same
  1015. // time, and allows one to utilize OffscreenCanvas where available, and to fall
  1016. // back to Offscreen Framebuffer otherwise.
  1017. var OFFSCREEN_FRAMEBUFFER = 0;
  1018. // If nonzero, prints out debugging information in library_fetch.js
  1019. var FETCH_DEBUG = 0;
  1020. // If nonzero, enables emscripten_fetch API.
  1021. var FETCH = 0;
  1022. // If set to 1, uses the multithreaded filesystem that is implemented within the
  1023. // asm.js module, using emscripten_fetch. Implies -s FETCH=1.
  1024. var ASMFS = 0;
  1025. // If set to 1, embeds all subresources in the emitted file as base64 string
  1026. // literals. Embedded subresources may include (but aren't limited to) wasm,
  1027. // asm.js, and static memory initialization code.
  1028. //
  1029. // When using code that depends on this option, your Content Security Policy may
  1030. // need to be updated. Specifically, embedding asm.js requires the script-src
  1031. // directive to whitelist 'unsafe-inline', and using a Worker requires the
  1032. // child-src directive to whitelist blob:. If you aren't using Content Security
  1033. // Policy, or your CSP header doesn't include either script-src or child-src,
  1034. // then you can safely ignore this warning.
  1035. var SINGLE_FILE = 0;
  1036. // For internal use only (name of the file containing wasm text, if relevant).
  1037. var WASM_TEXT_FILE = '';
  1038. // For internal use only (name of the file containing wasm binary, if relevant).
  1039. var WASM_BINARY_FILE = '';
  1040. // For internal use only (name of the file containing asm.js, if relevant).
  1041. var ASMJS_CODE_FILE = '';
  1042. // Base URL the source mapfile, if relevant
  1043. var SOURCE_MAP_BASE = '';
  1044. // for internal use only
  1045. var MEM_INIT_IN_WASM = 0;
  1046. // If set to 1, src/base64Utils.js will be included in the bundle.
  1047. // This is set internally when needed (SINGLE_FILE)
  1048. var SUPPORT_BASE64_EMBEDDING = 0;
  1049. // For internal use only, the possible environments the code may run in.
  1050. var ENVIRONMENT_MAY_BE_WEB = 1;
  1051. var ENVIRONMENT_MAY_BE_WORKER = 1;
  1052. var ENVIRONMENT_MAY_BE_NODE = 1;
  1053. var ENVIRONMENT_MAY_BE_SHELL = 1;
  1054. var ENVIRONMENT_MAY_BE_WEB_OR_WORKER = 1;