taisei/src/meson.build

481 lines
13 KiB
Meson
Raw Permalink Normal View History

2017-12-31 00:34:02 +01:00
version_deps += custom_target('version information',
command : [preprocess_command, '@INPUT@', '@OUTPUT@'],
build_by_default : true,
build_always_stale : true,
2017-12-31 00:34:02 +01:00
input : 'version_auto.c.in',
output : 'version_auto.c',
)
if host_machine.system() == 'windows'
winmod = import('windows')
2017-12-20 13:33:20 +01:00
rcpath = join_paths(meson.current_build_dir(), 'taisei.rc')
icons_dir = join_paths(meson.source_root(), 'misc', 'icons')
icon_main = join_paths(icons_dir, 'taisei.ico')
icon_replay = join_paths(icons_dir, 'taisei-replay.ico')
manifest = join_paths(meson.current_source_dir(), 'taisei.manifest')
2017-12-20 13:33:20 +01:00
rcdefs = [
'-DICON_MAIN=@0@'.format(icon_main),
'-DICON_REPLAY=@0@'.format(icon_replay),
'-DMANIFEST=@0@'.format(manifest),
2017-12-20 13:33:20 +01:00
]
if is_debug_build
2017-12-20 13:33:20 +01:00
rcdefs += ['-DBUILDTYPE_DEFINE=#define DEBUG_BUILD']
else
rcdefs += ['-DBUILDTYPE_DEFINE=#define RELEASE_BUILD']
endif
OpenGL ES 3.0 rendering backend (#148) * First steps towards shader transpilation Needs to be manually enabled via -Dshader_transpiler=true. Requires shaderc. https://github.com/google/shaderc Not yet functional due to missing SPIRV-Cross integration. SPIRV-Cross currently does not have an official C API, and crossc is too minimal to be useful. The current plan is to extend crossc and vendor it, while also sending PRs upstream. * Integrate crossc; shader transpilation for GLES now works * fix leak * gles30 backend now playable on Mesa with 3.2 context Some rendering issues are present. Identified so far: - Marisa's lasers are invisible - Death effect looks wrong Also, a small pixmap manipulation library has been written, and the texture uploading API redesigned around it. * fix marisa lasers in GLES (uniform name clashed with builtin) * fix player death effect in GLES (another name clash) * Dump ANGLE's translated shader code in debug log * fix screenshots * Drop support for triangle fans, switch to strips Fans offer no advantage over strips, and they've been removed in D3D10+, so ANGLE has to emulate them. * crude workaround for an ANGLE bug * Re-enable GL debug labels, fix an issue with them that affected ANGLE (but was always technically a bug) * fix race condition in shaderc initialization * New SDL_RWops interface for vertex buffers * Optimize VBO streaming via buffering updates Measurable performance improvement even with the main gl33 renderer, drastic improvement with ANGLE. * Fix the depth texture binding problem under ANGLE Apparently it hates GL_DEPTH_COMPONENT16 for some reason. Sized internal formats are not supported in GLES 2.0 anyway, so not using them is probably a good idea. * fix GLES2.0 segfault (the backend still doesn't work, though) * dump GL extensions at info log level, not debug * get around a Mesa bug; more correct texture format table for GLES2 * Correct GLES3 texture format table according to the spec Not a Mesa bug after all * require crossc>=1.5.0, fallback to subproject * Request at least 8bit per color channel in GL backends * Forbid lto for static windows builds with shader_transpiler=true * fix edge case segfault * Add basic ANGLE bundling support to the build system Windows only, and no NSIS support yet * Fix various windows-related build system and installer brokenness * Disable gles backends by default * update documentation
2018-10-02 00:36:10 +02:00
# https://github.com/mesonbuild/meson/issues/4301
rc_target = custom_target('windows-resource',
2017-12-20 13:33:20 +01:00
command : [preprocess_command, rcdefs, '@INPUT@', '@OUTPUT@'],
build_always_stale : true,
build_by_default : true,
2017-12-20 13:33:20 +01:00
input : 'taisei.rc.in',
output : 'taisei.rc',
)
version_deps += winmod.compile_resources(
rc_target,
depend_files : files(
'taisei.manifest',
icon_main,
icon_replay,
)
)
# msvcrt is dumb and only supports up to c89.
# with this defined, alternative implementations from mingw for e.g. the
# printf family of functions will be used, which conform to c11.
config.set('__USE_MINGW_ANSI_STDIO', 1)
endif
taisei_src = files(
'aniplayer.c',
'boss.c',
'cli.c',
'color.c',
'color.c',
'common_tasks.c',
'config.c',
'credits.c',
'dialog.c',
'difficulty.c',
'dynarray.c',
'enemy.c',
'enemy_classes.c',
'entity.c',
'events.c',
2018-01-20 15:15:15 +01:00
'framerate.c',
'gamepad.c',
'global.c',
'hashtable.c',
'hirestime.c',
'item.c',
'list.c',
'log.c',
'move.c',
'player.c',
'plrmodes.c',
'portrait.c',
'progress.c',
'projectile.c',
'projectile_prototypes.c',
'random.c',
'ringbuf.c',
'stage.c',
'stagedraw.c',
'stageinfo.c',
2017-12-18 21:25:06 +01:00
'stageobjects.c',
'stagetext.c',
'stageutils.c',
2020-04-26 21:27:13 +02:00
'stats.c',
'taskmanager.c',
'thread.c',
'transition.c',
'version.c',
'video.c',
'video_postprocess.c',
'watchdog.c',
)
taisei_main_src = files('main.c')
if is_developer_build
taisei_src += files(
'camcontrol.c'
)
endif
if host_machine.system() == 'nx'
taisei_src += files(
'arch_switch.c',
)
endif
subdir('audio')
subdir('coroutine')
subdir('cutscenes')
subdir('dialog')
Emscripten compatibility (#161) * Major refactoring of the main loop(s) and control flow (WIP) run_at_fps() is gone 🦀 Instead of nested blocking event loops, there is now an eventloop API that manages an explicit stack of scenes. This makes Taisei a lot more portable to async environments where spinning a loop forever without yielding control simply is not an option, and that is the entire point of this change. A prime example of such an environment is the Web (via emscripten). Taisei was able to run there through a terrible hack: inserting emscripten_sleep calls into the loop, which would yield to the browser. This has several major drawbacks: first of all, every function that could possibly call emscripten_sleep must be compiled into a special kind of bytecode, which then has to be interpreted at runtime, *much* slower than JITed WebAssembly. And that includes *everything* down the call stack, too! For more information, see https://emscripten.org/docs/porting/emterpreter.html Even though that method worked well enough for experimenting, despite suboptimal performance, there is another obvious drawback: emscripten_sleep is implemented via setTimeout(), which can be very imprecise and is generally not reliable for fluid animation. Browsers actually have an API specifically for that use case: window.requestAnimationFrame(), but Taisei's original blocking control flow style is simply not compatible with it. Emscripten exposes this API with its emscripten_set_main_loop(), which the eventloop backend now uses on that platform. Unfortunately, C is still C, with no fancy closures or coroutines. With blocking calls into menu/scene loops gone, the control flow is reimplemented via so-called (pun intended) "call chains". That is basically an euphemism for callback hell. With manual memory management and zero type-safety. Not that the menu system wasn't shitty enough already. I'll just keep telling myself that this is all temporary and will be replaced with scripts in v1.4. * improve build system for emscripten + various fixes * squish menu bugs * improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS Note that stock freetype does not work without EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the "emscripten" branch here: https://github.com/taisei-project/freetype2/tree/emscripten * Enable -Wcast-function-type Calling functions through incompatible pointers is nasal demons and doesn't work in WASM. * webgl: workaround a crash on some browsers * emscripten improvements: * Persist state (config, progress, replays, ...) in local IndexDB * Simpler HTML shell (temporary) * Enable more optimizations * fix build if validate_glsl=false * emscripten: improve asset packaging, with local cache Note that even though there are rules to build audio bundles, audio does *not* work yet. It looks like SDL2_mixer can not work without threads, which is a problem. Yet another reason to write an OpenAL backend - emscripten supports that natively. * emscripten: customize the html shell * emscripten: force "show log" checkbox unchecked initially * emscripten: remove quit shortcut from main menu (since there's no quit) * emscripten: log area fixes * emscripten/webgl: workaround for fullscreen viewport issue * emscripten: implement frameskip * emscripter: improve framerate limiter * align List to at least 8 bytes (shut up warnings) * fix non-emscripten builds * improve fullscreen handling, mainly for emscripten * Workaround to make audio work in chromium emscripten-core/emscripten#6511 * emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 20:32:32 +01:00
subdir('eventloop')
subdir('filewatch')
subdir('lasers')
2023-01-31 03:13:43 +01:00
subdir('memory')
subdir('menu')
Texturing overhaul: GPU compression, sRGB sampling, swizzles, etc. (#240) * WIP compressed textures, swizzles, sRGB sampling, ... * refactor texture type info & fix random bugs * fix preprocessing of sRGB textures * handle y-flipped basis textures * glcommon: better WebGL compat for compressed format detection * missed WEBGL_compressed_texture_pvrtc * implement compressed texture xcoding and uploading * Add basis_universal submodule * Reorganize texture loader code Clean up some code Isolate Basis Universal loader into a separate module * Add wrapper script for encoding .basis textures * basisu: honor custom metadata written by the mkbasis.py script * mkbasis.py: add --incredibly-slow and --dry-run * Move pixmap code from util/ to pixmap/ * Add an on-disk transcode cache for basis textures to speed up loads * Compress texture cache with zlib * Use readable format names for basisu cache filenames * basisu: mip bias test code * basisu: small caching cleanup * add TAISEI_BASISU_MIP_BIAS env variable * Improve OpenGL format matching heuristics * Document considerations for compressed format priority * Remove dead code * Enable two forgotten formats, BC3_RGBA and ATC_RGBA Also prefer BC7 over BC1/BC3 * Recognize GL_ANGLE_compressed_texture_etc for ETC2 textures * Default depth buffers to 24-bit; remove ANGLE hack * Fix glcommon_check_extension for GLES2/legacy gl * Add renderer feature bit for texture swizzle masks * glcommon: Fixup internal formats for GLES2 Sized internal formats are not allowed in GLES2 * Fix emscripten compile errors * Update basis_universal * remove more dead code * revert irrelevant stage4 change * shut up UBSan * basisu: shut up some debug spam * Add normalmap sampling helper to util.glslh * basisu: add a gray-alpha mode * mkbasis.py: Abort if image dimansions aren't multiples of 4 * Add basic Basis Universal encoding documentation (WIP) * doc/basisu: Add paragraph about modes; minor tweaks * basisu: workarounds for GL texture size requirements * gles20: fix uncompressed sRGB formats * Partial workaround for missing swizzles in gles2 and webgl * remove invalid assertion * New renderer API to expose glDrawBuffers-like functionality * stagedraw: disable all color outputs for copy_depth pass required for WebGL compatibility * support GL_ANGLE_request_extension * emscripten: include *.basis in gfx package Also fix a potential problem when more than one .pkgdir is used to construct emscripten packages * Don't rely on emscripten runtime to enable webgl extensions
2020-08-15 13:51:12 +02:00
subdir('pixmap')
subdir('plrmodes')
subdir('renderer')
subdir('replay')
subdir('resource')
subdir('rwops')
subdir('stages')
subdir('util')
subdir('vfs')
taisei_src += [
audio_src,
coroutine_src,
cutscenes_src,
dialog_src,
Emscripten compatibility (#161) * Major refactoring of the main loop(s) and control flow (WIP) run_at_fps() is gone 🦀 Instead of nested blocking event loops, there is now an eventloop API that manages an explicit stack of scenes. This makes Taisei a lot more portable to async environments where spinning a loop forever without yielding control simply is not an option, and that is the entire point of this change. A prime example of such an environment is the Web (via emscripten). Taisei was able to run there through a terrible hack: inserting emscripten_sleep calls into the loop, which would yield to the browser. This has several major drawbacks: first of all, every function that could possibly call emscripten_sleep must be compiled into a special kind of bytecode, which then has to be interpreted at runtime, *much* slower than JITed WebAssembly. And that includes *everything* down the call stack, too! For more information, see https://emscripten.org/docs/porting/emterpreter.html Even though that method worked well enough for experimenting, despite suboptimal performance, there is another obvious drawback: emscripten_sleep is implemented via setTimeout(), which can be very imprecise and is generally not reliable for fluid animation. Browsers actually have an API specifically for that use case: window.requestAnimationFrame(), but Taisei's original blocking control flow style is simply not compatible with it. Emscripten exposes this API with its emscripten_set_main_loop(), which the eventloop backend now uses on that platform. Unfortunately, C is still C, with no fancy closures or coroutines. With blocking calls into menu/scene loops gone, the control flow is reimplemented via so-called (pun intended) "call chains". That is basically an euphemism for callback hell. With manual memory management and zero type-safety. Not that the menu system wasn't shitty enough already. I'll just keep telling myself that this is all temporary and will be replaced with scripts in v1.4. * improve build system for emscripten + various fixes * squish menu bugs * improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS Note that stock freetype does not work without EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the "emscripten" branch here: https://github.com/taisei-project/freetype2/tree/emscripten * Enable -Wcast-function-type Calling functions through incompatible pointers is nasal demons and doesn't work in WASM. * webgl: workaround a crash on some browsers * emscripten improvements: * Persist state (config, progress, replays, ...) in local IndexDB * Simpler HTML shell (temporary) * Enable more optimizations * fix build if validate_glsl=false * emscripten: improve asset packaging, with local cache Note that even though there are rules to build audio bundles, audio does *not* work yet. It looks like SDL2_mixer can not work without threads, which is a problem. Yet another reason to write an OpenAL backend - emscripten supports that natively. * emscripten: customize the html shell * emscripten: force "show log" checkbox unchecked initially * emscripten: remove quit shortcut from main menu (since there's no quit) * emscripten: log area fixes * emscripten/webgl: workaround for fullscreen viewport issue * emscripten: implement frameskip * emscripter: improve framerate limiter * align List to at least 8 bytes (shut up warnings) * fix non-emscripten builds * improve fullscreen handling, mainly for emscripten * Workaround to make audio work in chromium emscripten-core/emscripten#6511 * emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 20:32:32 +01:00
eventloop_src,
filewatch_src,
lasers_src,
2023-01-31 03:13:43 +01:00
memory_src,
menu_src,
Texturing overhaul: GPU compression, sRGB sampling, swizzles, etc. (#240) * WIP compressed textures, swizzles, sRGB sampling, ... * refactor texture type info & fix random bugs * fix preprocessing of sRGB textures * handle y-flipped basis textures * glcommon: better WebGL compat for compressed format detection * missed WEBGL_compressed_texture_pvrtc * implement compressed texture xcoding and uploading * Add basis_universal submodule * Reorganize texture loader code Clean up some code Isolate Basis Universal loader into a separate module * Add wrapper script for encoding .basis textures * basisu: honor custom metadata written by the mkbasis.py script * mkbasis.py: add --incredibly-slow and --dry-run * Move pixmap code from util/ to pixmap/ * Add an on-disk transcode cache for basis textures to speed up loads * Compress texture cache with zlib * Use readable format names for basisu cache filenames * basisu: mip bias test code * basisu: small caching cleanup * add TAISEI_BASISU_MIP_BIAS env variable * Improve OpenGL format matching heuristics * Document considerations for compressed format priority * Remove dead code * Enable two forgotten formats, BC3_RGBA and ATC_RGBA Also prefer BC7 over BC1/BC3 * Recognize GL_ANGLE_compressed_texture_etc for ETC2 textures * Default depth buffers to 24-bit; remove ANGLE hack * Fix glcommon_check_extension for GLES2/legacy gl * Add renderer feature bit for texture swizzle masks * glcommon: Fixup internal formats for GLES2 Sized internal formats are not allowed in GLES2 * Fix emscripten compile errors * Update basis_universal * remove more dead code * revert irrelevant stage4 change * shut up UBSan * basisu: shut up some debug spam * Add normalmap sampling helper to util.glslh * basisu: add a gray-alpha mode * mkbasis.py: Abort if image dimansions aren't multiples of 4 * Add basic Basis Universal encoding documentation (WIP) * doc/basisu: Add paragraph about modes; minor tweaks * basisu: workarounds for GL texture size requirements * gles20: fix uncompressed sRGB formats * Partial workaround for missing swizzles in gles2 and webgl * remove invalid assertion * New renderer API to expose glDrawBuffers-like functionality * stagedraw: disable all color outputs for copy_depth pass required for WebGL compatibility * support GL_ANGLE_request_extension * emscripten: include *.basis in gfx package Also fix a potential problem when more than one .pkgdir is used to construct emscripten packages * Don't rely on emscripten runtime to enable webgl extensions
2020-08-15 13:51:12 +02:00
pixmap_src,
plrmodes_src,
renderer_src,
replay_src,
resource_src,
rwops_src,
util_src,
vfs_src,
]
taisei_deps += [
audio_deps,
renderer_deps,
util_deps,
]
if stages_live_reload
taisei_src += files('dynstage.c')
# We want this to build fast
libstages_opts = ['b_lto=false']
if get_option('optimization') != '0'
# Don't force a higher optimization level if we're building the project
# without optimizations
libstages_opts += ['optimization=g']
endif
taisei_stages = shared_module('taisei-stages', stages_src, version_deps,
dependencies : taisei_deps,
c_args : taisei_c_args,
c_pch : 'pch/taisei_pch.h',
build_by_default : true,
gnu_symbol_visibility : 'hidden',
override_options : libstages_opts,
)
taisei_deps += cc.find_library('dl', required : false)
taisei_stages_compile_command = [
find_program('meson'), 'compile', '-C', meson.project_build_root(), '-v', taisei_stages.name(),
]
r = run_command(format_array_command, taisei_stages_compile_command, check : true)
config.set_quoted('TAISEI_BUILDCONF_DYNSTAGE_LIB', taisei_stages.full_path())
config.set_quoted('TAISEI_BUILDCONF_DYNSTAGE_SRCROOT', stages_srcdir)
config.set('TAISEI_BUILDCONF_DYNSTAGE_REBUILD_CMD', r.stdout().strip())
else
taisei_src += files('dynstage_stub.c')
taisei_src += stages_src
endif
configure_file(configuration : config, output : 'build_config.h')
Emscripten compatibility (#161) * Major refactoring of the main loop(s) and control flow (WIP) run_at_fps() is gone 🦀 Instead of nested blocking event loops, there is now an eventloop API that manages an explicit stack of scenes. This makes Taisei a lot more portable to async environments where spinning a loop forever without yielding control simply is not an option, and that is the entire point of this change. A prime example of such an environment is the Web (via emscripten). Taisei was able to run there through a terrible hack: inserting emscripten_sleep calls into the loop, which would yield to the browser. This has several major drawbacks: first of all, every function that could possibly call emscripten_sleep must be compiled into a special kind of bytecode, which then has to be interpreted at runtime, *much* slower than JITed WebAssembly. And that includes *everything* down the call stack, too! For more information, see https://emscripten.org/docs/porting/emterpreter.html Even though that method worked well enough for experimenting, despite suboptimal performance, there is another obvious drawback: emscripten_sleep is implemented via setTimeout(), which can be very imprecise and is generally not reliable for fluid animation. Browsers actually have an API specifically for that use case: window.requestAnimationFrame(), but Taisei's original blocking control flow style is simply not compatible with it. Emscripten exposes this API with its emscripten_set_main_loop(), which the eventloop backend now uses on that platform. Unfortunately, C is still C, with no fancy closures or coroutines. With blocking calls into menu/scene loops gone, the control flow is reimplemented via so-called (pun intended) "call chains". That is basically an euphemism for callback hell. With manual memory management and zero type-safety. Not that the menu system wasn't shitty enough already. I'll just keep telling myself that this is all temporary and will be replaced with scripts in v1.4. * improve build system for emscripten + various fixes * squish menu bugs * improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS Note that stock freetype does not work without EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the "emscripten" branch here: https://github.com/taisei-project/freetype2/tree/emscripten * Enable -Wcast-function-type Calling functions through incompatible pointers is nasal demons and doesn't work in WASM. * webgl: workaround a crash on some browsers * emscripten improvements: * Persist state (config, progress, replays, ...) in local IndexDB * Simpler HTML shell (temporary) * Enable more optimizations * fix build if validate_glsl=false * emscripten: improve asset packaging, with local cache Note that even though there are rules to build audio bundles, audio does *not* work yet. It looks like SDL2_mixer can not work without threads, which is a problem. Yet another reason to write an OpenAL backend - emscripten supports that natively. * emscripten: customize the html shell * emscripten: force "show log" checkbox unchecked initially * emscripten: remove quit shortcut from main menu (since there's no quit) * emscripten: log area fixes * emscripten/webgl: workaround for fullscreen viewport issue * emscripten: implement frameskip * emscripter: improve framerate limiter * align List to at least 8 bytes (shut up warnings) * fix non-emscripten builds * improve fullscreen handling, mainly for emscripten * Workaround to make audio work in chromium emscripten-core/emscripten#6511 * emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 20:32:32 +01:00
taisei_basename = (macos_app_bundle ? 'Taisei' : 'taisei')
have_libtaisei = false
Emscripten compatibility (#161) * Major refactoring of the main loop(s) and control flow (WIP) run_at_fps() is gone 🦀 Instead of nested blocking event loops, there is now an eventloop API that manages an explicit stack of scenes. This makes Taisei a lot more portable to async environments where spinning a loop forever without yielding control simply is not an option, and that is the entire point of this change. A prime example of such an environment is the Web (via emscripten). Taisei was able to run there through a terrible hack: inserting emscripten_sleep calls into the loop, which would yield to the browser. This has several major drawbacks: first of all, every function that could possibly call emscripten_sleep must be compiled into a special kind of bytecode, which then has to be interpreted at runtime, *much* slower than JITed WebAssembly. And that includes *everything* down the call stack, too! For more information, see https://emscripten.org/docs/porting/emterpreter.html Even though that method worked well enough for experimenting, despite suboptimal performance, there is another obvious drawback: emscripten_sleep is implemented via setTimeout(), which can be very imprecise and is generally not reliable for fluid animation. Browsers actually have an API specifically for that use case: window.requestAnimationFrame(), but Taisei's original blocking control flow style is simply not compatible with it. Emscripten exposes this API with its emscripten_set_main_loop(), which the eventloop backend now uses on that platform. Unfortunately, C is still C, with no fancy closures or coroutines. With blocking calls into menu/scene loops gone, the control flow is reimplemented via so-called (pun intended) "call chains". That is basically an euphemism for callback hell. With manual memory management and zero type-safety. Not that the menu system wasn't shitty enough already. I'll just keep telling myself that this is all temporary and will be replaced with scripts in v1.4. * improve build system for emscripten + various fixes * squish menu bugs * improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS Note that stock freetype does not work without EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the "emscripten" branch here: https://github.com/taisei-project/freetype2/tree/emscripten * Enable -Wcast-function-type Calling functions through incompatible pointers is nasal demons and doesn't work in WASM. * webgl: workaround a crash on some browsers * emscripten improvements: * Persist state (config, progress, replays, ...) in local IndexDB * Simpler HTML shell (temporary) * Enable more optimizations * fix build if validate_glsl=false * emscripten: improve asset packaging, with local cache Note that even though there are rules to build audio bundles, audio does *not* work yet. It looks like SDL2_mixer can not work without threads, which is a problem. Yet another reason to write an OpenAL backend - emscripten supports that natively. * emscripten: customize the html shell * emscripten: force "show log" checkbox unchecked initially * emscripten: remove quit shortcut from main menu (since there's no quit) * emscripten: log area fixes * emscripten/webgl: workaround for fullscreen viewport issue * emscripten: implement frameskip * emscripter: improve framerate limiter * align List to at least 8 bytes (shut up warnings) * fix non-emscripten builds * improve fullscreen handling, mainly for emscripten * Workaround to make audio work in chromium emscripten-core/emscripten#6511 * emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 20:32:32 +01:00
if host_machine.system() == 'emscripten'
if get_option('b_staticpic')
warning('b_staticpic is not compatible with the LLVM WebAssembly backend')
endif
2022-02-22 10:37:11 +01:00
# Asyncify instrumentation is very overzealous by default.
# This crazy list is not exhaustive, but still helps us reduce code size quite a bit.
# Link with -s ASYNCIFY_ADVISE to see what gets instrumented.
asyncify_ignore = [
'*printf',
'AlphaApplyFilter',
'ApplyInverseTransforms',
'Bezier_*',
'DecodeImageData',
2023-01-05 03:03:54 +01:00
'DoUVTransform',
'EmitFancyRGB',
'EmitRescaledAlphaRGB',
'EmitRescaledRGB',
'EmitSampledRGB',
2022-02-22 10:37:11 +01:00
'Emscripten_*',
'FT_*',
'FlushRenderCommands',
2023-01-05 03:03:54 +01:00
'ReconstructRow',
2022-02-22 10:37:11 +01:00
'SDL_*',
'T1_*',
'TT_*',
'VP8*',
2023-01-05 03:03:54 +01:00
'VP8ExitCritical',
2022-02-22 10:37:11 +01:00
'WebP*',
'ZSTD_*',
'__*',
2023-01-05 03:03:54 +01:00
'__ftello_unlocked',
'__fwritex',
'__shgetc',
'__toread',
'__vfprintf_internal',
2022-02-22 10:37:11 +01:00
'_dynarray_*',
'_ht_*',
2023-01-05 03:03:54 +01:00
'_taisei_log*',
2022-02-22 10:37:11 +01:00
'_text_draw',
'af_*',
'afm_*',
'apply_kerning',
'astream_*',
'basist*',
'camera3d_*',
'cf2_*',
'cff_*',
'deflate*',
'fbmgr_*',
'fclose',
'fread',
'ft_*',
'gamepad_*',
'get_glyph',
'gl33_*',
'glcommon_*',
'gles30_*',
'hash_bucket',
'ht_*',
'inflate*',
'log_*',
2023-01-05 03:03:54 +01:00
'log_internal',
2022-02-22 10:37:11 +01:00
'op_get_next_page',
'op_seek_helper',
'pfr_*',
'pixmap_*',
'png_*',
2023-01-05 03:03:54 +01:00
'printf_core',
2022-02-22 10:37:11 +01:00
'px_*',
'qsort',
'sfnt_*',
'sift',
2023-01-05 03:03:54 +01:00
'stdio_*',
2022-02-22 10:37:11 +01:00
'strtox',
't1_*',
't42_*',
'tt_*',
'vfs_decref',
2023-01-05 03:03:54 +01:00
'wrapper_cmp',
2022-02-22 10:37:11 +01:00
]
em_debug = is_debug_build
Emscripten compatibility (#161) * Major refactoring of the main loop(s) and control flow (WIP) run_at_fps() is gone 🦀 Instead of nested blocking event loops, there is now an eventloop API that manages an explicit stack of scenes. This makes Taisei a lot more portable to async environments where spinning a loop forever without yielding control simply is not an option, and that is the entire point of this change. A prime example of such an environment is the Web (via emscripten). Taisei was able to run there through a terrible hack: inserting emscripten_sleep calls into the loop, which would yield to the browser. This has several major drawbacks: first of all, every function that could possibly call emscripten_sleep must be compiled into a special kind of bytecode, which then has to be interpreted at runtime, *much* slower than JITed WebAssembly. And that includes *everything* down the call stack, too! For more information, see https://emscripten.org/docs/porting/emterpreter.html Even though that method worked well enough for experimenting, despite suboptimal performance, there is another obvious drawback: emscripten_sleep is implemented via setTimeout(), which can be very imprecise and is generally not reliable for fluid animation. Browsers actually have an API specifically for that use case: window.requestAnimationFrame(), but Taisei's original blocking control flow style is simply not compatible with it. Emscripten exposes this API with its emscripten_set_main_loop(), which the eventloop backend now uses on that platform. Unfortunately, C is still C, with no fancy closures or coroutines. With blocking calls into menu/scene loops gone, the control flow is reimplemented via so-called (pun intended) "call chains". That is basically an euphemism for callback hell. With manual memory management and zero type-safety. Not that the menu system wasn't shitty enough already. I'll just keep telling myself that this is all temporary and will be replaced with scripts in v1.4. * improve build system for emscripten + various fixes * squish menu bugs * improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS Note that stock freetype does not work without EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the "emscripten" branch here: https://github.com/taisei-project/freetype2/tree/emscripten * Enable -Wcast-function-type Calling functions through incompatible pointers is nasal demons and doesn't work in WASM. * webgl: workaround a crash on some browsers * emscripten improvements: * Persist state (config, progress, replays, ...) in local IndexDB * Simpler HTML shell (temporary) * Enable more optimizations * fix build if validate_glsl=false * emscripten: improve asset packaging, with local cache Note that even though there are rules to build audio bundles, audio does *not* work yet. It looks like SDL2_mixer can not work without threads, which is a problem. Yet another reason to write an OpenAL backend - emscripten supports that natively. * emscripten: customize the html shell * emscripten: force "show log" checkbox unchecked initially * emscripten: remove quit shortcut from main menu (since there's no quit) * emscripten: log area fixes * emscripten/webgl: workaround for fullscreen viewport issue * emscripten: implement frameskip * emscripter: improve framerate limiter * align List to at least 8 bytes (shut up warnings) * fix non-emscripten builds * improve fullscreen handling, mainly for emscripten * Workaround to make audio work in chromium emscripten-core/emscripten#6511 * emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 20:32:32 +01:00
em_link_outputs = []
em_link_output_suffixes = ['js', 'wasm'] # first element is significant
Emscripten compatibility (#161) * Major refactoring of the main loop(s) and control flow (WIP) run_at_fps() is gone 🦀 Instead of nested blocking event loops, there is now an eventloop API that manages an explicit stack of scenes. This makes Taisei a lot more portable to async environments where spinning a loop forever without yielding control simply is not an option, and that is the entire point of this change. A prime example of such an environment is the Web (via emscripten). Taisei was able to run there through a terrible hack: inserting emscripten_sleep calls into the loop, which would yield to the browser. This has several major drawbacks: first of all, every function that could possibly call emscripten_sleep must be compiled into a special kind of bytecode, which then has to be interpreted at runtime, *much* slower than JITed WebAssembly. And that includes *everything* down the call stack, too! For more information, see https://emscripten.org/docs/porting/emterpreter.html Even though that method worked well enough for experimenting, despite suboptimal performance, there is another obvious drawback: emscripten_sleep is implemented via setTimeout(), which can be very imprecise and is generally not reliable for fluid animation. Browsers actually have an API specifically for that use case: window.requestAnimationFrame(), but Taisei's original blocking control flow style is simply not compatible with it. Emscripten exposes this API with its emscripten_set_main_loop(), which the eventloop backend now uses on that platform. Unfortunately, C is still C, with no fancy closures or coroutines. With blocking calls into menu/scene loops gone, the control flow is reimplemented via so-called (pun intended) "call chains". That is basically an euphemism for callback hell. With manual memory management and zero type-safety. Not that the menu system wasn't shitty enough already. I'll just keep telling myself that this is all temporary and will be replaced with scripts in v1.4. * improve build system for emscripten + various fixes * squish menu bugs * improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS Note that stock freetype does not work without EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the "emscripten" branch here: https://github.com/taisei-project/freetype2/tree/emscripten * Enable -Wcast-function-type Calling functions through incompatible pointers is nasal demons and doesn't work in WASM. * webgl: workaround a crash on some browsers * emscripten improvements: * Persist state (config, progress, replays, ...) in local IndexDB * Simpler HTML shell (temporary) * Enable more optimizations * fix build if validate_glsl=false * emscripten: improve asset packaging, with local cache Note that even though there are rules to build audio bundles, audio does *not* work yet. It looks like SDL2_mixer can not work without threads, which is a problem. Yet another reason to write an OpenAL backend - emscripten supports that natively. * emscripten: customize the html shell * emscripten: force "show log" checkbox unchecked initially * emscripten: remove quit shortcut from main menu (since there's no quit) * emscripten: log area fixes * emscripten/webgl: workaround for fullscreen viewport issue * emscripten: implement frameskip * emscripter: improve framerate limiter * align List to at least 8 bytes (shut up warnings) * fix non-emscripten builds * improve fullscreen handling, mainly for emscripten * Workaround to make audio work in chromium emscripten-core/emscripten#6511 * emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 20:32:32 +01:00
em_data_dir = config.get_unquoted('TAISEI_BUILDCONF_DATA_PATH')
em_common_args = []
Emscripten compatibility (#161) * Major refactoring of the main loop(s) and control flow (WIP) run_at_fps() is gone 🦀 Instead of nested blocking event loops, there is now an eventloop API that manages an explicit stack of scenes. This makes Taisei a lot more portable to async environments where spinning a loop forever without yielding control simply is not an option, and that is the entire point of this change. A prime example of such an environment is the Web (via emscripten). Taisei was able to run there through a terrible hack: inserting emscripten_sleep calls into the loop, which would yield to the browser. This has several major drawbacks: first of all, every function that could possibly call emscripten_sleep must be compiled into a special kind of bytecode, which then has to be interpreted at runtime, *much* slower than JITed WebAssembly. And that includes *everything* down the call stack, too! For more information, see https://emscripten.org/docs/porting/emterpreter.html Even though that method worked well enough for experimenting, despite suboptimal performance, there is another obvious drawback: emscripten_sleep is implemented via setTimeout(), which can be very imprecise and is generally not reliable for fluid animation. Browsers actually have an API specifically for that use case: window.requestAnimationFrame(), but Taisei's original blocking control flow style is simply not compatible with it. Emscripten exposes this API with its emscripten_set_main_loop(), which the eventloop backend now uses on that platform. Unfortunately, C is still C, with no fancy closures or coroutines. With blocking calls into menu/scene loops gone, the control flow is reimplemented via so-called (pun intended) "call chains". That is basically an euphemism for callback hell. With manual memory management and zero type-safety. Not that the menu system wasn't shitty enough already. I'll just keep telling myself that this is all temporary and will be replaced with scripts in v1.4. * improve build system for emscripten + various fixes * squish menu bugs * improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS Note that stock freetype does not work without EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the "emscripten" branch here: https://github.com/taisei-project/freetype2/tree/emscripten * Enable -Wcast-function-type Calling functions through incompatible pointers is nasal demons and doesn't work in WASM. * webgl: workaround a crash on some browsers * emscripten improvements: * Persist state (config, progress, replays, ...) in local IndexDB * Simpler HTML shell (temporary) * Enable more optimizations * fix build if validate_glsl=false * emscripten: improve asset packaging, with local cache Note that even though there are rules to build audio bundles, audio does *not* work yet. It looks like SDL2_mixer can not work without threads, which is a problem. Yet another reason to write an OpenAL backend - emscripten supports that natively. * emscripten: customize the html shell * emscripten: force "show log" checkbox unchecked initially * emscripten: remove quit shortcut from main menu (since there's no quit) * emscripten: log area fixes * emscripten/webgl: workaround for fullscreen viewport issue * emscripten: implement frameskip * emscripter: improve framerate limiter * align List to at least 8 bytes (shut up warnings) * fix non-emscripten builds * improve fullscreen handling, mainly for emscripten * Workaround to make audio work in chromium emscripten-core/emscripten#6511 * emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 20:32:32 +01:00
em_link_args = [
'-O@0@'.format(get_option('optimization')),
Emscripten compatibility (#161) * Major refactoring of the main loop(s) and control flow (WIP) run_at_fps() is gone 🦀 Instead of nested blocking event loops, there is now an eventloop API that manages an explicit stack of scenes. This makes Taisei a lot more portable to async environments where spinning a loop forever without yielding control simply is not an option, and that is the entire point of this change. A prime example of such an environment is the Web (via emscripten). Taisei was able to run there through a terrible hack: inserting emscripten_sleep calls into the loop, which would yield to the browser. This has several major drawbacks: first of all, every function that could possibly call emscripten_sleep must be compiled into a special kind of bytecode, which then has to be interpreted at runtime, *much* slower than JITed WebAssembly. And that includes *everything* down the call stack, too! For more information, see https://emscripten.org/docs/porting/emterpreter.html Even though that method worked well enough for experimenting, despite suboptimal performance, there is another obvious drawback: emscripten_sleep is implemented via setTimeout(), which can be very imprecise and is generally not reliable for fluid animation. Browsers actually have an API specifically for that use case: window.requestAnimationFrame(), but Taisei's original blocking control flow style is simply not compatible with it. Emscripten exposes this API with its emscripten_set_main_loop(), which the eventloop backend now uses on that platform. Unfortunately, C is still C, with no fancy closures or coroutines. With blocking calls into menu/scene loops gone, the control flow is reimplemented via so-called (pun intended) "call chains". That is basically an euphemism for callback hell. With manual memory management and zero type-safety. Not that the menu system wasn't shitty enough already. I'll just keep telling myself that this is all temporary and will be replaced with scripts in v1.4. * improve build system for emscripten + various fixes * squish menu bugs * improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS Note that stock freetype does not work without EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the "emscripten" branch here: https://github.com/taisei-project/freetype2/tree/emscripten * Enable -Wcast-function-type Calling functions through incompatible pointers is nasal demons and doesn't work in WASM. * webgl: workaround a crash on some browsers * emscripten improvements: * Persist state (config, progress, replays, ...) in local IndexDB * Simpler HTML shell (temporary) * Enable more optimizations * fix build if validate_glsl=false * emscripten: improve asset packaging, with local cache Note that even though there are rules to build audio bundles, audio does *not* work yet. It looks like SDL2_mixer can not work without threads, which is a problem. Yet another reason to write an OpenAL backend - emscripten supports that natively. * emscripten: customize the html shell * emscripten: force "show log" checkbox unchecked initially * emscripten: remove quit shortcut from main menu (since there's no quit) * emscripten: log area fixes * emscripten/webgl: workaround for fullscreen viewport issue * emscripten: implement frameskip * emscripter: improve framerate limiter * align List to at least 8 bytes (shut up warnings) * fix non-emscripten builds * improve fullscreen handling, mainly for emscripten * Workaround to make audio work in chromium emscripten-core/emscripten#6511 * emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 20:32:32 +01:00
'-s', 'ALLOW_MEMORY_GROWTH=1',
2022-02-22 10:37:11 +01:00
'-s', 'ASYNCIFY_REMOVE=@0@'.format(','.join(asyncify_ignore)),
'-s', 'AUTO_ARCHIVE_INDEXES=0',
'-s', 'AUTO_JS_LIBRARIES=0',
'-s', 'AUTO_NATIVE_LIBRARIES=0',
Texturing overhaul: GPU compression, sRGB sampling, swizzles, etc. (#240) * WIP compressed textures, swizzles, sRGB sampling, ... * refactor texture type info & fix random bugs * fix preprocessing of sRGB textures * handle y-flipped basis textures * glcommon: better WebGL compat for compressed format detection * missed WEBGL_compressed_texture_pvrtc * implement compressed texture xcoding and uploading * Add basis_universal submodule * Reorganize texture loader code Clean up some code Isolate Basis Universal loader into a separate module * Add wrapper script for encoding .basis textures * basisu: honor custom metadata written by the mkbasis.py script * mkbasis.py: add --incredibly-slow and --dry-run * Move pixmap code from util/ to pixmap/ * Add an on-disk transcode cache for basis textures to speed up loads * Compress texture cache with zlib * Use readable format names for basisu cache filenames * basisu: mip bias test code * basisu: small caching cleanup * add TAISEI_BASISU_MIP_BIAS env variable * Improve OpenGL format matching heuristics * Document considerations for compressed format priority * Remove dead code * Enable two forgotten formats, BC3_RGBA and ATC_RGBA Also prefer BC7 over BC1/BC3 * Recognize GL_ANGLE_compressed_texture_etc for ETC2 textures * Default depth buffers to 24-bit; remove ANGLE hack * Fix glcommon_check_extension for GLES2/legacy gl * Add renderer feature bit for texture swizzle masks * glcommon: Fixup internal formats for GLES2 Sized internal formats are not allowed in GLES2 * Fix emscripten compile errors * Update basis_universal * remove more dead code * revert irrelevant stage4 change * shut up UBSan * basisu: shut up some debug spam * Add normalmap sampling helper to util.glslh * basisu: add a gray-alpha mode * mkbasis.py: Abort if image dimansions aren't multiples of 4 * Add basic Basis Universal encoding documentation (WIP) * doc/basisu: Add paragraph about modes; minor tweaks * basisu: workarounds for GL texture size requirements * gles20: fix uncompressed sRGB formats * Partial workaround for missing swizzles in gles2 and webgl * remove invalid assertion * New renderer API to expose glDrawBuffers-like functionality * stagedraw: disable all color outputs for copy_depth pass required for WebGL compatibility * support GL_ANGLE_request_extension * emscripten: include *.basis in gfx package Also fix a potential problem when more than one .pkgdir is used to construct emscripten packages * Don't rely on emscripten runtime to enable webgl extensions
2020-08-15 13:51:12 +02:00
'-s', 'DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=["$autoResumeAudioContext"]',
2022-02-22 10:37:11 +01:00
'-s', 'DYNAMIC_EXECUTION=0',
Emscripten compatibility (#161) * Major refactoring of the main loop(s) and control flow (WIP) run_at_fps() is gone 🦀 Instead of nested blocking event loops, there is now an eventloop API that manages an explicit stack of scenes. This makes Taisei a lot more portable to async environments where spinning a loop forever without yielding control simply is not an option, and that is the entire point of this change. A prime example of such an environment is the Web (via emscripten). Taisei was able to run there through a terrible hack: inserting emscripten_sleep calls into the loop, which would yield to the browser. This has several major drawbacks: first of all, every function that could possibly call emscripten_sleep must be compiled into a special kind of bytecode, which then has to be interpreted at runtime, *much* slower than JITed WebAssembly. And that includes *everything* down the call stack, too! For more information, see https://emscripten.org/docs/porting/emterpreter.html Even though that method worked well enough for experimenting, despite suboptimal performance, there is another obvious drawback: emscripten_sleep is implemented via setTimeout(), which can be very imprecise and is generally not reliable for fluid animation. Browsers actually have an API specifically for that use case: window.requestAnimationFrame(), but Taisei's original blocking control flow style is simply not compatible with it. Emscripten exposes this API with its emscripten_set_main_loop(), which the eventloop backend now uses on that platform. Unfortunately, C is still C, with no fancy closures or coroutines. With blocking calls into menu/scene loops gone, the control flow is reimplemented via so-called (pun intended) "call chains". That is basically an euphemism for callback hell. With manual memory management and zero type-safety. Not that the menu system wasn't shitty enough already. I'll just keep telling myself that this is all temporary and will be replaced with scripts in v1.4. * improve build system for emscripten + various fixes * squish menu bugs * improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS Note that stock freetype does not work without EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the "emscripten" branch here: https://github.com/taisei-project/freetype2/tree/emscripten * Enable -Wcast-function-type Calling functions through incompatible pointers is nasal demons and doesn't work in WASM. * webgl: workaround a crash on some browsers * emscripten improvements: * Persist state (config, progress, replays, ...) in local IndexDB * Simpler HTML shell (temporary) * Enable more optimizations * fix build if validate_glsl=false * emscripten: improve asset packaging, with local cache Note that even though there are rules to build audio bundles, audio does *not* work yet. It looks like SDL2_mixer can not work without threads, which is a problem. Yet another reason to write an OpenAL backend - emscripten supports that natively. * emscripten: customize the html shell * emscripten: force "show log" checkbox unchecked initially * emscripten: remove quit shortcut from main menu (since there's no quit) * emscripten: log area fixes * emscripten/webgl: workaround for fullscreen viewport issue * emscripten: implement frameskip * emscripter: improve framerate limiter * align List to at least 8 bytes (shut up warnings) * fix non-emscripten builds * improve fullscreen handling, mainly for emscripten * Workaround to make audio work in chromium emscripten-core/emscripten#6511 * emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 20:32:32 +01:00
'-s', 'ENVIRONMENT=web',
'-s', 'EXIT_RUNTIME=0',
'-s', 'EXPORT_NAME=createTaisei',
'-s', 'EXPORTED_FUNCTIONS=["_main", "_vfs_sync_callback"]',
'-s', 'EXPORTED_RUNTIME_METHODS=["ccall","callMain","FS","ENV"]',
'-s', 'FETCH_SUPPORT_INDEXEDDB=0',
'-s', 'FETCH',
Emscripten compatibility (#161) * Major refactoring of the main loop(s) and control flow (WIP) run_at_fps() is gone 🦀 Instead of nested blocking event loops, there is now an eventloop API that manages an explicit stack of scenes. This makes Taisei a lot more portable to async environments where spinning a loop forever without yielding control simply is not an option, and that is the entire point of this change. A prime example of such an environment is the Web (via emscripten). Taisei was able to run there through a terrible hack: inserting emscripten_sleep calls into the loop, which would yield to the browser. This has several major drawbacks: first of all, every function that could possibly call emscripten_sleep must be compiled into a special kind of bytecode, which then has to be interpreted at runtime, *much* slower than JITed WebAssembly. And that includes *everything* down the call stack, too! For more information, see https://emscripten.org/docs/porting/emterpreter.html Even though that method worked well enough for experimenting, despite suboptimal performance, there is another obvious drawback: emscripten_sleep is implemented via setTimeout(), which can be very imprecise and is generally not reliable for fluid animation. Browsers actually have an API specifically for that use case: window.requestAnimationFrame(), but Taisei's original blocking control flow style is simply not compatible with it. Emscripten exposes this API with its emscripten_set_main_loop(), which the eventloop backend now uses on that platform. Unfortunately, C is still C, with no fancy closures or coroutines. With blocking calls into menu/scene loops gone, the control flow is reimplemented via so-called (pun intended) "call chains". That is basically an euphemism for callback hell. With manual memory management and zero type-safety. Not that the menu system wasn't shitty enough already. I'll just keep telling myself that this is all temporary and will be replaced with scripts in v1.4. * improve build system for emscripten + various fixes * squish menu bugs * improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS Note that stock freetype does not work without EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the "emscripten" branch here: https://github.com/taisei-project/freetype2/tree/emscripten * Enable -Wcast-function-type Calling functions through incompatible pointers is nasal demons and doesn't work in WASM. * webgl: workaround a crash on some browsers * emscripten improvements: * Persist state (config, progress, replays, ...) in local IndexDB * Simpler HTML shell (temporary) * Enable more optimizations * fix build if validate_glsl=false * emscripten: improve asset packaging, with local cache Note that even though there are rules to build audio bundles, audio does *not* work yet. It looks like SDL2_mixer can not work without threads, which is a problem. Yet another reason to write an OpenAL backend - emscripten supports that natively. * emscripten: customize the html shell * emscripten: force "show log" checkbox unchecked initially * emscripten: remove quit shortcut from main menu (since there's no quit) * emscripten: log area fixes * emscripten/webgl: workaround for fullscreen viewport issue * emscripten: implement frameskip * emscripter: improve framerate limiter * align List to at least 8 bytes (shut up warnings) * fix non-emscripten builds * improve fullscreen handling, mainly for emscripten * Workaround to make audio work in chromium emscripten-core/emscripten#6511 * emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 20:32:32 +01:00
'-s', 'FILESYSTEM=1',
'-s', 'FORCE_FILESYSTEM=1',
'-s', 'GL_ENABLE_GET_PROC_ADDRESS',
Emscripten compatibility (#161) * Major refactoring of the main loop(s) and control flow (WIP) run_at_fps() is gone 🦀 Instead of nested blocking event loops, there is now an eventloop API that manages an explicit stack of scenes. This makes Taisei a lot more portable to async environments where spinning a loop forever without yielding control simply is not an option, and that is the entire point of this change. A prime example of such an environment is the Web (via emscripten). Taisei was able to run there through a terrible hack: inserting emscripten_sleep calls into the loop, which would yield to the browser. This has several major drawbacks: first of all, every function that could possibly call emscripten_sleep must be compiled into a special kind of bytecode, which then has to be interpreted at runtime, *much* slower than JITed WebAssembly. And that includes *everything* down the call stack, too! For more information, see https://emscripten.org/docs/porting/emterpreter.html Even though that method worked well enough for experimenting, despite suboptimal performance, there is another obvious drawback: emscripten_sleep is implemented via setTimeout(), which can be very imprecise and is generally not reliable for fluid animation. Browsers actually have an API specifically for that use case: window.requestAnimationFrame(), but Taisei's original blocking control flow style is simply not compatible with it. Emscripten exposes this API with its emscripten_set_main_loop(), which the eventloop backend now uses on that platform. Unfortunately, C is still C, with no fancy closures or coroutines. With blocking calls into menu/scene loops gone, the control flow is reimplemented via so-called (pun intended) "call chains". That is basically an euphemism for callback hell. With manual memory management and zero type-safety. Not that the menu system wasn't shitty enough already. I'll just keep telling myself that this is all temporary and will be replaced with scripts in v1.4. * improve build system for emscripten + various fixes * squish menu bugs * improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS Note that stock freetype does not work without EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the "emscripten" branch here: https://github.com/taisei-project/freetype2/tree/emscripten * Enable -Wcast-function-type Calling functions through incompatible pointers is nasal demons and doesn't work in WASM. * webgl: workaround a crash on some browsers * emscripten improvements: * Persist state (config, progress, replays, ...) in local IndexDB * Simpler HTML shell (temporary) * Enable more optimizations * fix build if validate_glsl=false * emscripten: improve asset packaging, with local cache Note that even though there are rules to build audio bundles, audio does *not* work yet. It looks like SDL2_mixer can not work without threads, which is a problem. Yet another reason to write an OpenAL backend - emscripten supports that natively. * emscripten: customize the html shell * emscripten: force "show log" checkbox unchecked initially * emscripten: remove quit shortcut from main menu (since there's no quit) * emscripten: log area fixes * emscripten/webgl: workaround for fullscreen viewport issue * emscripten: implement frameskip * emscripter: improve framerate limiter * align List to at least 8 bytes (shut up warnings) * fix non-emscripten builds * improve fullscreen handling, mainly for emscripten * Workaround to make audio work in chromium emscripten-core/emscripten#6511 * emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 20:32:32 +01:00
'-s', 'GL_POOL_TEMP_BUFFERS=0',
'-s', 'GL_PREINITIALIZED_CONTEXT=1',
Texturing overhaul: GPU compression, sRGB sampling, swizzles, etc. (#240) * WIP compressed textures, swizzles, sRGB sampling, ... * refactor texture type info & fix random bugs * fix preprocessing of sRGB textures * handle y-flipped basis textures * glcommon: better WebGL compat for compressed format detection * missed WEBGL_compressed_texture_pvrtc * implement compressed texture xcoding and uploading * Add basis_universal submodule * Reorganize texture loader code Clean up some code Isolate Basis Universal loader into a separate module * Add wrapper script for encoding .basis textures * basisu: honor custom metadata written by the mkbasis.py script * mkbasis.py: add --incredibly-slow and --dry-run * Move pixmap code from util/ to pixmap/ * Add an on-disk transcode cache for basis textures to speed up loads * Compress texture cache with zlib * Use readable format names for basisu cache filenames * basisu: mip bias test code * basisu: small caching cleanup * add TAISEI_BASISU_MIP_BIAS env variable * Improve OpenGL format matching heuristics * Document considerations for compressed format priority * Remove dead code * Enable two forgotten formats, BC3_RGBA and ATC_RGBA Also prefer BC7 over BC1/BC3 * Recognize GL_ANGLE_compressed_texture_etc for ETC2 textures * Default depth buffers to 24-bit; remove ANGLE hack * Fix glcommon_check_extension for GLES2/legacy gl * Add renderer feature bit for texture swizzle masks * glcommon: Fixup internal formats for GLES2 Sized internal formats are not allowed in GLES2 * Fix emscripten compile errors * Update basis_universal * remove more dead code * revert irrelevant stage4 change * shut up UBSan * basisu: shut up some debug spam * Add normalmap sampling helper to util.glslh * basisu: add a gray-alpha mode * mkbasis.py: Abort if image dimansions aren't multiples of 4 * Add basic Basis Universal encoding documentation (WIP) * doc/basisu: Add paragraph about modes; minor tweaks * basisu: workarounds for GL texture size requirements * gles20: fix uncompressed sRGB formats * Partial workaround for missing swizzles in gles2 and webgl * remove invalid assertion * New renderer API to expose glDrawBuffers-like functionality * stagedraw: disable all color outputs for copy_depth pass required for WebGL compatibility * support GL_ANGLE_request_extension * emscripten: include *.basis in gfx package Also fix a potential problem when more than one .pkgdir is used to construct emscripten packages * Don't rely on emscripten runtime to enable webgl extensions
2020-08-15 13:51:12 +02:00
'-s', 'GL_SUPPORT_AUTOMATIC_ENABLE_EXTENSIONS=0',
2022-02-22 10:37:11 +01:00
'-s', 'GL_SUPPORT_SIMPLE_ENABLE_EXTENSIONS=0',
'-s', 'IGNORE_MISSING_MAIN=0',
Texturing overhaul: GPU compression, sRGB sampling, swizzles, etc. (#240) * WIP compressed textures, swizzles, sRGB sampling, ... * refactor texture type info & fix random bugs * fix preprocessing of sRGB textures * handle y-flipped basis textures * glcommon: better WebGL compat for compressed format detection * missed WEBGL_compressed_texture_pvrtc * implement compressed texture xcoding and uploading * Add basis_universal submodule * Reorganize texture loader code Clean up some code Isolate Basis Universal loader into a separate module * Add wrapper script for encoding .basis textures * basisu: honor custom metadata written by the mkbasis.py script * mkbasis.py: add --incredibly-slow and --dry-run * Move pixmap code from util/ to pixmap/ * Add an on-disk transcode cache for basis textures to speed up loads * Compress texture cache with zlib * Use readable format names for basisu cache filenames * basisu: mip bias test code * basisu: small caching cleanup * add TAISEI_BASISU_MIP_BIAS env variable * Improve OpenGL format matching heuristics * Document considerations for compressed format priority * Remove dead code * Enable two forgotten formats, BC3_RGBA and ATC_RGBA Also prefer BC7 over BC1/BC3 * Recognize GL_ANGLE_compressed_texture_etc for ETC2 textures * Default depth buffers to 24-bit; remove ANGLE hack * Fix glcommon_check_extension for GLES2/legacy gl * Add renderer feature bit for texture swizzle masks * glcommon: Fixup internal formats for GLES2 Sized internal formats are not allowed in GLES2 * Fix emscripten compile errors * Update basis_universal * remove more dead code * revert irrelevant stage4 change * shut up UBSan * basisu: shut up some debug spam * Add normalmap sampling helper to util.glslh * basisu: add a gray-alpha mode * mkbasis.py: Abort if image dimansions aren't multiples of 4 * Add basic Basis Universal encoding documentation (WIP) * doc/basisu: Add paragraph about modes; minor tweaks * basisu: workarounds for GL texture size requirements * gles20: fix uncompressed sRGB formats * Partial workaround for missing swizzles in gles2 and webgl * remove invalid assertion * New renderer API to expose glDrawBuffers-like functionality * stagedraw: disable all color outputs for copy_depth pass required for WebGL compatibility * support GL_ANGLE_request_extension * emscripten: include *.basis in gfx package Also fix a potential problem when more than one .pkgdir is used to construct emscripten packages * Don't rely on emscripten runtime to enable webgl extensions
2020-08-15 13:51:12 +02:00
'-s', 'INITIAL_MEMORY=268435456',
'-s', 'INVOKE_RUN=0',
2022-02-22 10:37:11 +01:00
'-s', 'LLD_REPORT_UNDEFINED',
'-s', 'MAX_WEBGL_VERSION=2',
'-s', 'MIN_WEBGL_VERSION=2',
'-s', 'MODULARIZE=1',
'-s', 'STACK_SIZE=1MB',
2022-02-22 10:37:11 +01:00
'-s', 'SUPPORT_BIG_ENDIAN=1',
Emscripten compatibility (#161) * Major refactoring of the main loop(s) and control flow (WIP) run_at_fps() is gone 🦀 Instead of nested blocking event loops, there is now an eventloop API that manages an explicit stack of scenes. This makes Taisei a lot more portable to async environments where spinning a loop forever without yielding control simply is not an option, and that is the entire point of this change. A prime example of such an environment is the Web (via emscripten). Taisei was able to run there through a terrible hack: inserting emscripten_sleep calls into the loop, which would yield to the browser. This has several major drawbacks: first of all, every function that could possibly call emscripten_sleep must be compiled into a special kind of bytecode, which then has to be interpreted at runtime, *much* slower than JITed WebAssembly. And that includes *everything* down the call stack, too! For more information, see https://emscripten.org/docs/porting/emterpreter.html Even though that method worked well enough for experimenting, despite suboptimal performance, there is another obvious drawback: emscripten_sleep is implemented via setTimeout(), which can be very imprecise and is generally not reliable for fluid animation. Browsers actually have an API specifically for that use case: window.requestAnimationFrame(), but Taisei's original blocking control flow style is simply not compatible with it. Emscripten exposes this API with its emscripten_set_main_loop(), which the eventloop backend now uses on that platform. Unfortunately, C is still C, with no fancy closures or coroutines. With blocking calls into menu/scene loops gone, the control flow is reimplemented via so-called (pun intended) "call chains". That is basically an euphemism for callback hell. With manual memory management and zero type-safety. Not that the menu system wasn't shitty enough already. I'll just keep telling myself that this is all temporary and will be replaced with scripts in v1.4. * improve build system for emscripten + various fixes * squish menu bugs * improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS Note that stock freetype does not work without EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the "emscripten" branch here: https://github.com/taisei-project/freetype2/tree/emscripten * Enable -Wcast-function-type Calling functions through incompatible pointers is nasal demons and doesn't work in WASM. * webgl: workaround a crash on some browsers * emscripten improvements: * Persist state (config, progress, replays, ...) in local IndexDB * Simpler HTML shell (temporary) * Enable more optimizations * fix build if validate_glsl=false * emscripten: improve asset packaging, with local cache Note that even though there are rules to build audio bundles, audio does *not* work yet. It looks like SDL2_mixer can not work without threads, which is a problem. Yet another reason to write an OpenAL backend - emscripten supports that natively. * emscripten: customize the html shell * emscripten: force "show log" checkbox unchecked initially * emscripten: remove quit shortcut from main menu (since there's no quit) * emscripten: log area fixes * emscripten/webgl: workaround for fullscreen viewport issue * emscripten: implement frameskip * emscripter: improve framerate limiter * align List to at least 8 bytes (shut up warnings) * fix non-emscripten builds * improve fullscreen handling, mainly for emscripten * Workaround to make audio work in chromium emscripten-core/emscripten#6511 * emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 20:32:32 +01:00
'-s', 'WASM=1',
'-lGL',
'-legl.js',
2019-11-19 06:52:22 +01:00
'-lidbfs.js',
2022-02-22 10:37:11 +01:00
'-lwebgl.js',
'-lhtml5', # NOTE: SDL dependency; should be fixed there
Emscripten compatibility (#161) * Major refactoring of the main loop(s) and control flow (WIP) run_at_fps() is gone 🦀 Instead of nested blocking event loops, there is now an eventloop API that manages an explicit stack of scenes. This makes Taisei a lot more portable to async environments where spinning a loop forever without yielding control simply is not an option, and that is the entire point of this change. A prime example of such an environment is the Web (via emscripten). Taisei was able to run there through a terrible hack: inserting emscripten_sleep calls into the loop, which would yield to the browser. This has several major drawbacks: first of all, every function that could possibly call emscripten_sleep must be compiled into a special kind of bytecode, which then has to be interpreted at runtime, *much* slower than JITed WebAssembly. And that includes *everything* down the call stack, too! For more information, see https://emscripten.org/docs/porting/emterpreter.html Even though that method worked well enough for experimenting, despite suboptimal performance, there is another obvious drawback: emscripten_sleep is implemented via setTimeout(), which can be very imprecise and is generally not reliable for fluid animation. Browsers actually have an API specifically for that use case: window.requestAnimationFrame(), but Taisei's original blocking control flow style is simply not compatible with it. Emscripten exposes this API with its emscripten_set_main_loop(), which the eventloop backend now uses on that platform. Unfortunately, C is still C, with no fancy closures or coroutines. With blocking calls into menu/scene loops gone, the control flow is reimplemented via so-called (pun intended) "call chains". That is basically an euphemism for callback hell. With manual memory management and zero type-safety. Not that the menu system wasn't shitty enough already. I'll just keep telling myself that this is all temporary and will be replaced with scripts in v1.4. * improve build system for emscripten + various fixes * squish menu bugs * improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS Note that stock freetype does not work without EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the "emscripten" branch here: https://github.com/taisei-project/freetype2/tree/emscripten * Enable -Wcast-function-type Calling functions through incompatible pointers is nasal demons and doesn't work in WASM. * webgl: workaround a crash on some browsers * emscripten improvements: * Persist state (config, progress, replays, ...) in local IndexDB * Simpler HTML shell (temporary) * Enable more optimizations * fix build if validate_glsl=false * emscripten: improve asset packaging, with local cache Note that even though there are rules to build audio bundles, audio does *not* work yet. It looks like SDL2_mixer can not work without threads, which is a problem. Yet another reason to write an OpenAL backend - emscripten supports that natively. * emscripten: customize the html shell * emscripten: force "show log" checkbox unchecked initially * emscripten: remove quit shortcut from main menu (since there's no quit) * emscripten: log area fixes * emscripten/webgl: workaround for fullscreen viewport issue * emscripten: implement frameskip * emscripter: improve framerate limiter * align List to at least 8 bytes (shut up warnings) * fix non-emscripten builds * improve fullscreen handling, mainly for emscripten * Workaround to make audio work in chromium emscripten-core/emscripten#6511 * emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 20:32:32 +01:00
]
em_link_args += subproject('koishi').get_variable('koishi_external_link_args')
Emscripten compatibility (#161) * Major refactoring of the main loop(s) and control flow (WIP) run_at_fps() is gone 🦀 Instead of nested blocking event loops, there is now an eventloop API that manages an explicit stack of scenes. This makes Taisei a lot more portable to async environments where spinning a loop forever without yielding control simply is not an option, and that is the entire point of this change. A prime example of such an environment is the Web (via emscripten). Taisei was able to run there through a terrible hack: inserting emscripten_sleep calls into the loop, which would yield to the browser. This has several major drawbacks: first of all, every function that could possibly call emscripten_sleep must be compiled into a special kind of bytecode, which then has to be interpreted at runtime, *much* slower than JITed WebAssembly. And that includes *everything* down the call stack, too! For more information, see https://emscripten.org/docs/porting/emterpreter.html Even though that method worked well enough for experimenting, despite suboptimal performance, there is another obvious drawback: emscripten_sleep is implemented via setTimeout(), which can be very imprecise and is generally not reliable for fluid animation. Browsers actually have an API specifically for that use case: window.requestAnimationFrame(), but Taisei's original blocking control flow style is simply not compatible with it. Emscripten exposes this API with its emscripten_set_main_loop(), which the eventloop backend now uses on that platform. Unfortunately, C is still C, with no fancy closures or coroutines. With blocking calls into menu/scene loops gone, the control flow is reimplemented via so-called (pun intended) "call chains". That is basically an euphemism for callback hell. With manual memory management and zero type-safety. Not that the menu system wasn't shitty enough already. I'll just keep telling myself that this is all temporary and will be replaced with scripts in v1.4. * improve build system for emscripten + various fixes * squish menu bugs * improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS Note that stock freetype does not work without EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the "emscripten" branch here: https://github.com/taisei-project/freetype2/tree/emscripten * Enable -Wcast-function-type Calling functions through incompatible pointers is nasal demons and doesn't work in WASM. * webgl: workaround a crash on some browsers * emscripten improvements: * Persist state (config, progress, replays, ...) in local IndexDB * Simpler HTML shell (temporary) * Enable more optimizations * fix build if validate_glsl=false * emscripten: improve asset packaging, with local cache Note that even though there are rules to build audio bundles, audio does *not* work yet. It looks like SDL2_mixer can not work without threads, which is a problem. Yet another reason to write an OpenAL backend - emscripten supports that natively. * emscripten: customize the html shell * emscripten: force "show log" checkbox unchecked initially * emscripten: remove quit shortcut from main menu (since there's no quit) * emscripten: log area fixes * emscripten/webgl: workaround for fullscreen viewport issue * emscripten: implement frameskip * emscripter: improve framerate limiter * align List to at least 8 bytes (shut up warnings) * fix non-emscripten builds * improve fullscreen handling, mainly for emscripten * Workaround to make audio work in chromium emscripten-core/emscripten#6511 * emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 20:32:32 +01:00
if em_debug
2020-03-19 07:58:51 +01:00
em_link_output_suffixes += ['wasm.map']
Emscripten compatibility (#161) * Major refactoring of the main loop(s) and control flow (WIP) run_at_fps() is gone 🦀 Instead of nested blocking event loops, there is now an eventloop API that manages an explicit stack of scenes. This makes Taisei a lot more portable to async environments where spinning a loop forever without yielding control simply is not an option, and that is the entire point of this change. A prime example of such an environment is the Web (via emscripten). Taisei was able to run there through a terrible hack: inserting emscripten_sleep calls into the loop, which would yield to the browser. This has several major drawbacks: first of all, every function that could possibly call emscripten_sleep must be compiled into a special kind of bytecode, which then has to be interpreted at runtime, *much* slower than JITed WebAssembly. And that includes *everything* down the call stack, too! For more information, see https://emscripten.org/docs/porting/emterpreter.html Even though that method worked well enough for experimenting, despite suboptimal performance, there is another obvious drawback: emscripten_sleep is implemented via setTimeout(), which can be very imprecise and is generally not reliable for fluid animation. Browsers actually have an API specifically for that use case: window.requestAnimationFrame(), but Taisei's original blocking control flow style is simply not compatible with it. Emscripten exposes this API with its emscripten_set_main_loop(), which the eventloop backend now uses on that platform. Unfortunately, C is still C, with no fancy closures or coroutines. With blocking calls into menu/scene loops gone, the control flow is reimplemented via so-called (pun intended) "call chains". That is basically an euphemism for callback hell. With manual memory management and zero type-safety. Not that the menu system wasn't shitty enough already. I'll just keep telling myself that this is all temporary and will be replaced with scripts in v1.4. * improve build system for emscripten + various fixes * squish menu bugs * improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS Note that stock freetype does not work without EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the "emscripten" branch here: https://github.com/taisei-project/freetype2/tree/emscripten * Enable -Wcast-function-type Calling functions through incompatible pointers is nasal demons and doesn't work in WASM. * webgl: workaround a crash on some browsers * emscripten improvements: * Persist state (config, progress, replays, ...) in local IndexDB * Simpler HTML shell (temporary) * Enable more optimizations * fix build if validate_glsl=false * emscripten: improve asset packaging, with local cache Note that even though there are rules to build audio bundles, audio does *not* work yet. It looks like SDL2_mixer can not work without threads, which is a problem. Yet another reason to write an OpenAL backend - emscripten supports that natively. * emscripten: customize the html shell * emscripten: force "show log" checkbox unchecked initially * emscripten: remove quit shortcut from main menu (since there's no quit) * emscripten: log area fixes * emscripten/webgl: workaround for fullscreen viewport issue * emscripten: implement frameskip * emscripter: improve framerate limiter * align List to at least 8 bytes (shut up warnings) * fix non-emscripten builds * improve fullscreen handling, mainly for emscripten * Workaround to make audio work in chromium emscripten-core/emscripten#6511 * emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 20:32:32 +01:00
em_link_args += [
'--profiling',
2021-04-21 03:31:26 +02:00
'-g3',
'-gsource-map',
2023-01-05 02:42:22 +01:00
'--source-map-base', meson.get_external_property('source_map_base', 'http://0.0.0.0:6931/'),
Emscripten compatibility (#161) * Major refactoring of the main loop(s) and control flow (WIP) run_at_fps() is gone 🦀 Instead of nested blocking event loops, there is now an eventloop API that manages an explicit stack of scenes. This makes Taisei a lot more portable to async environments where spinning a loop forever without yielding control simply is not an option, and that is the entire point of this change. A prime example of such an environment is the Web (via emscripten). Taisei was able to run there through a terrible hack: inserting emscripten_sleep calls into the loop, which would yield to the browser. This has several major drawbacks: first of all, every function that could possibly call emscripten_sleep must be compiled into a special kind of bytecode, which then has to be interpreted at runtime, *much* slower than JITed WebAssembly. And that includes *everything* down the call stack, too! For more information, see https://emscripten.org/docs/porting/emterpreter.html Even though that method worked well enough for experimenting, despite suboptimal performance, there is another obvious drawback: emscripten_sleep is implemented via setTimeout(), which can be very imprecise and is generally not reliable for fluid animation. Browsers actually have an API specifically for that use case: window.requestAnimationFrame(), but Taisei's original blocking control flow style is simply not compatible with it. Emscripten exposes this API with its emscripten_set_main_loop(), which the eventloop backend now uses on that platform. Unfortunately, C is still C, with no fancy closures or coroutines. With blocking calls into menu/scene loops gone, the control flow is reimplemented via so-called (pun intended) "call chains". That is basically an euphemism for callback hell. With manual memory management and zero type-safety. Not that the menu system wasn't shitty enough already. I'll just keep telling myself that this is all temporary and will be replaced with scripts in v1.4. * improve build system for emscripten + various fixes * squish menu bugs * improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS Note that stock freetype does not work without EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the "emscripten" branch here: https://github.com/taisei-project/freetype2/tree/emscripten * Enable -Wcast-function-type Calling functions through incompatible pointers is nasal demons and doesn't work in WASM. * webgl: workaround a crash on some browsers * emscripten improvements: * Persist state (config, progress, replays, ...) in local IndexDB * Simpler HTML shell (temporary) * Enable more optimizations * fix build if validate_glsl=false * emscripten: improve asset packaging, with local cache Note that even though there are rules to build audio bundles, audio does *not* work yet. It looks like SDL2_mixer can not work without threads, which is a problem. Yet another reason to write an OpenAL backend - emscripten supports that natively. * emscripten: customize the html shell * emscripten: force "show log" checkbox unchecked initially * emscripten: remove quit shortcut from main menu (since there's no quit) * emscripten: log area fixes * emscripten/webgl: workaround for fullscreen viewport issue * emscripten: implement frameskip * emscripter: improve framerate limiter * align List to at least 8 bytes (shut up warnings) * fix non-emscripten builds * improve fullscreen handling, mainly for emscripten * Workaround to make audio work in chromium emscripten-core/emscripten#6511 * emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 20:32:32 +01:00
'-s', 'ASSERTIONS=2',
'-s', 'GL_ASSERTIONS=1',
2022-02-22 10:37:11 +01:00
'-s', 'GL_DEBUG=1',
'-s', 'GL_TRACK_ERRORS=1',
Emscripten compatibility (#161) * Major refactoring of the main loop(s) and control flow (WIP) run_at_fps() is gone 🦀 Instead of nested blocking event loops, there is now an eventloop API that manages an explicit stack of scenes. This makes Taisei a lot more portable to async environments where spinning a loop forever without yielding control simply is not an option, and that is the entire point of this change. A prime example of such an environment is the Web (via emscripten). Taisei was able to run there through a terrible hack: inserting emscripten_sleep calls into the loop, which would yield to the browser. This has several major drawbacks: first of all, every function that could possibly call emscripten_sleep must be compiled into a special kind of bytecode, which then has to be interpreted at runtime, *much* slower than JITed WebAssembly. And that includes *everything* down the call stack, too! For more information, see https://emscripten.org/docs/porting/emterpreter.html Even though that method worked well enough for experimenting, despite suboptimal performance, there is another obvious drawback: emscripten_sleep is implemented via setTimeout(), which can be very imprecise and is generally not reliable for fluid animation. Browsers actually have an API specifically for that use case: window.requestAnimationFrame(), but Taisei's original blocking control flow style is simply not compatible with it. Emscripten exposes this API with its emscripten_set_main_loop(), which the eventloop backend now uses on that platform. Unfortunately, C is still C, with no fancy closures or coroutines. With blocking calls into menu/scene loops gone, the control flow is reimplemented via so-called (pun intended) "call chains". That is basically an euphemism for callback hell. With manual memory management and zero type-safety. Not that the menu system wasn't shitty enough already. I'll just keep telling myself that this is all temporary and will be replaced with scripts in v1.4. * improve build system for emscripten + various fixes * squish menu bugs * improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS Note that stock freetype does not work without EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the "emscripten" branch here: https://github.com/taisei-project/freetype2/tree/emscripten * Enable -Wcast-function-type Calling functions through incompatible pointers is nasal demons and doesn't work in WASM. * webgl: workaround a crash on some browsers * emscripten improvements: * Persist state (config, progress, replays, ...) in local IndexDB * Simpler HTML shell (temporary) * Enable more optimizations * fix build if validate_glsl=false * emscripten: improve asset packaging, with local cache Note that even though there are rules to build audio bundles, audio does *not* work yet. It looks like SDL2_mixer can not work without threads, which is a problem. Yet another reason to write an OpenAL backend - emscripten supports that natively. * emscripten: customize the html shell * emscripten: force "show log" checkbox unchecked initially * emscripten: remove quit shortcut from main menu (since there's no quit) * emscripten: log area fixes * emscripten/webgl: workaround for fullscreen viewport issue * emscripten: implement frameskip * emscripter: improve framerate limiter * align List to at least 8 bytes (shut up warnings) * fix non-emscripten builds * improve fullscreen handling, mainly for emscripten * Workaround to make audio work in chromium emscripten-core/emscripten#6511 * emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 20:32:32 +01:00
]
else
em_link_args += [
'-g0',
'-s', 'ASSERTIONS=0',
'-s', 'GL_TRACK_ERRORS=0',
Emscripten compatibility (#161) * Major refactoring of the main loop(s) and control flow (WIP) run_at_fps() is gone 🦀 Instead of nested blocking event loops, there is now an eventloop API that manages an explicit stack of scenes. This makes Taisei a lot more portable to async environments where spinning a loop forever without yielding control simply is not an option, and that is the entire point of this change. A prime example of such an environment is the Web (via emscripten). Taisei was able to run there through a terrible hack: inserting emscripten_sleep calls into the loop, which would yield to the browser. This has several major drawbacks: first of all, every function that could possibly call emscripten_sleep must be compiled into a special kind of bytecode, which then has to be interpreted at runtime, *much* slower than JITed WebAssembly. And that includes *everything* down the call stack, too! For more information, see https://emscripten.org/docs/porting/emterpreter.html Even though that method worked well enough for experimenting, despite suboptimal performance, there is another obvious drawback: emscripten_sleep is implemented via setTimeout(), which can be very imprecise and is generally not reliable for fluid animation. Browsers actually have an API specifically for that use case: window.requestAnimationFrame(), but Taisei's original blocking control flow style is simply not compatible with it. Emscripten exposes this API with its emscripten_set_main_loop(), which the eventloop backend now uses on that platform. Unfortunately, C is still C, with no fancy closures or coroutines. With blocking calls into menu/scene loops gone, the control flow is reimplemented via so-called (pun intended) "call chains". That is basically an euphemism for callback hell. With manual memory management and zero type-safety. Not that the menu system wasn't shitty enough already. I'll just keep telling myself that this is all temporary and will be replaced with scripts in v1.4. * improve build system for emscripten + various fixes * squish menu bugs * improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS Note that stock freetype does not work without EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the "emscripten" branch here: https://github.com/taisei-project/freetype2/tree/emscripten * Enable -Wcast-function-type Calling functions through incompatible pointers is nasal demons and doesn't work in WASM. * webgl: workaround a crash on some browsers * emscripten improvements: * Persist state (config, progress, replays, ...) in local IndexDB * Simpler HTML shell (temporary) * Enable more optimizations * fix build if validate_glsl=false * emscripten: improve asset packaging, with local cache Note that even though there are rules to build audio bundles, audio does *not* work yet. It looks like SDL2_mixer can not work without threads, which is a problem. Yet another reason to write an OpenAL backend - emscripten supports that natively. * emscripten: customize the html shell * emscripten: force "show log" checkbox unchecked initially * emscripten: remove quit shortcut from main menu (since there's no quit) * emscripten: log area fixes * emscripten/webgl: workaround for fullscreen viewport issue * emscripten: implement frameskip * emscripter: improve framerate limiter * align List to at least 8 bytes (shut up warnings) * fix non-emscripten builds * improve fullscreen handling, mainly for emscripten * Workaround to make audio work in chromium emscripten-core/emscripten#6511 * emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 20:32:32 +01:00
]
2020-03-19 07:58:51 +01:00
if get_option('optimization') != '0'
em_link_args += ['--closure', '1']
endif
endif
Emscripten compatibility (#161) * Major refactoring of the main loop(s) and control flow (WIP) run_at_fps() is gone 🦀 Instead of nested blocking event loops, there is now an eventloop API that manages an explicit stack of scenes. This makes Taisei a lot more portable to async environments where spinning a loop forever without yielding control simply is not an option, and that is the entire point of this change. A prime example of such an environment is the Web (via emscripten). Taisei was able to run there through a terrible hack: inserting emscripten_sleep calls into the loop, which would yield to the browser. This has several major drawbacks: first of all, every function that could possibly call emscripten_sleep must be compiled into a special kind of bytecode, which then has to be interpreted at runtime, *much* slower than JITed WebAssembly. And that includes *everything* down the call stack, too! For more information, see https://emscripten.org/docs/porting/emterpreter.html Even though that method worked well enough for experimenting, despite suboptimal performance, there is another obvious drawback: emscripten_sleep is implemented via setTimeout(), which can be very imprecise and is generally not reliable for fluid animation. Browsers actually have an API specifically for that use case: window.requestAnimationFrame(), but Taisei's original blocking control flow style is simply not compatible with it. Emscripten exposes this API with its emscripten_set_main_loop(), which the eventloop backend now uses on that platform. Unfortunately, C is still C, with no fancy closures or coroutines. With blocking calls into menu/scene loops gone, the control flow is reimplemented via so-called (pun intended) "call chains". That is basically an euphemism for callback hell. With manual memory management and zero type-safety. Not that the menu system wasn't shitty enough already. I'll just keep telling myself that this is all temporary and will be replaced with scripts in v1.4. * improve build system for emscripten + various fixes * squish menu bugs * improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS Note that stock freetype does not work without EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the "emscripten" branch here: https://github.com/taisei-project/freetype2/tree/emscripten * Enable -Wcast-function-type Calling functions through incompatible pointers is nasal demons and doesn't work in WASM. * webgl: workaround a crash on some browsers * emscripten improvements: * Persist state (config, progress, replays, ...) in local IndexDB * Simpler HTML shell (temporary) * Enable more optimizations * fix build if validate_glsl=false * emscripten: improve asset packaging, with local cache Note that even though there are rules to build audio bundles, audio does *not* work yet. It looks like SDL2_mixer can not work without threads, which is a problem. Yet another reason to write an OpenAL backend - emscripten supports that natively. * emscripten: customize the html shell * emscripten: force "show log" checkbox unchecked initially * emscripten: remove quit shortcut from main menu (since there's no quit) * emscripten: log area fixes * emscripten/webgl: workaround for fullscreen viewport issue * emscripten: implement frameskip * emscripter: improve framerate limiter * align List to at least 8 bytes (shut up warnings) * fix non-emscripten builds * improve fullscreen handling, mainly for emscripten * Workaround to make audio work in chromium emscripten-core/emscripten#6511 * emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 20:32:32 +01:00
foreach suffix : em_link_output_suffixes
em_link_outputs += ['@0@.@1@'.format(taisei_basename, suffix)]
endforeach
meson_link_whole_is_broken = meson.version().version_compare('>1.1.0')
if meson_link_whole_is_broken
warning('Installing private static library to work around a Meson bug: https://github.com/mesonbuild/meson/issues/12638')
endif
libtaisei = static_library(taisei_basename, taisei_src, taisei_main_src, version_deps,
Emscripten compatibility (#161) * Major refactoring of the main loop(s) and control flow (WIP) run_at_fps() is gone 🦀 Instead of nested blocking event loops, there is now an eventloop API that manages an explicit stack of scenes. This makes Taisei a lot more portable to async environments where spinning a loop forever without yielding control simply is not an option, and that is the entire point of this change. A prime example of such an environment is the Web (via emscripten). Taisei was able to run there through a terrible hack: inserting emscripten_sleep calls into the loop, which would yield to the browser. This has several major drawbacks: first of all, every function that could possibly call emscripten_sleep must be compiled into a special kind of bytecode, which then has to be interpreted at runtime, *much* slower than JITed WebAssembly. And that includes *everything* down the call stack, too! For more information, see https://emscripten.org/docs/porting/emterpreter.html Even though that method worked well enough for experimenting, despite suboptimal performance, there is another obvious drawback: emscripten_sleep is implemented via setTimeout(), which can be very imprecise and is generally not reliable for fluid animation. Browsers actually have an API specifically for that use case: window.requestAnimationFrame(), but Taisei's original blocking control flow style is simply not compatible with it. Emscripten exposes this API with its emscripten_set_main_loop(), which the eventloop backend now uses on that platform. Unfortunately, C is still C, with no fancy closures or coroutines. With blocking calls into menu/scene loops gone, the control flow is reimplemented via so-called (pun intended) "call chains". That is basically an euphemism for callback hell. With manual memory management and zero type-safety. Not that the menu system wasn't shitty enough already. I'll just keep telling myself that this is all temporary and will be replaced with scripts in v1.4. * improve build system for emscripten + various fixes * squish menu bugs * improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS Note that stock freetype does not work without EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the "emscripten" branch here: https://github.com/taisei-project/freetype2/tree/emscripten * Enable -Wcast-function-type Calling functions through incompatible pointers is nasal demons and doesn't work in WASM. * webgl: workaround a crash on some browsers * emscripten improvements: * Persist state (config, progress, replays, ...) in local IndexDB * Simpler HTML shell (temporary) * Enable more optimizations * fix build if validate_glsl=false * emscripten: improve asset packaging, with local cache Note that even though there are rules to build audio bundles, audio does *not* work yet. It looks like SDL2_mixer can not work without threads, which is a problem. Yet another reason to write an OpenAL backend - emscripten supports that natively. * emscripten: customize the html shell * emscripten: force "show log" checkbox unchecked initially * emscripten: remove quit shortcut from main menu (since there's no quit) * emscripten: log area fixes * emscripten/webgl: workaround for fullscreen viewport issue * emscripten: implement frameskip * emscripter: improve framerate limiter * align List to at least 8 bytes (shut up warnings) * fix non-emscripten builds * improve fullscreen handling, mainly for emscripten * Workaround to make audio work in chromium emscripten-core/emscripten#6511 * emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 20:32:32 +01:00
dependencies : taisei_deps,
2020-11-10 06:36:57 +01:00
c_pch : 'pch/taisei_pch.h',
2022-02-22 10:37:11 +01:00
c_args : [em_common_args, taisei_c_args],
install : meson_link_whole_is_broken,
install_dir : '.',
install_tag : 'trash',
# Explicitly give it a predictable name, in case we have to remove it via install script
name_prefix : 'lib',
name_suffix : 'a',
Emscripten compatibility (#161) * Major refactoring of the main loop(s) and control flow (WIP) run_at_fps() is gone 🦀 Instead of nested blocking event loops, there is now an eventloop API that manages an explicit stack of scenes. This makes Taisei a lot more portable to async environments where spinning a loop forever without yielding control simply is not an option, and that is the entire point of this change. A prime example of such an environment is the Web (via emscripten). Taisei was able to run there through a terrible hack: inserting emscripten_sleep calls into the loop, which would yield to the browser. This has several major drawbacks: first of all, every function that could possibly call emscripten_sleep must be compiled into a special kind of bytecode, which then has to be interpreted at runtime, *much* slower than JITed WebAssembly. And that includes *everything* down the call stack, too! For more information, see https://emscripten.org/docs/porting/emterpreter.html Even though that method worked well enough for experimenting, despite suboptimal performance, there is another obvious drawback: emscripten_sleep is implemented via setTimeout(), which can be very imprecise and is generally not reliable for fluid animation. Browsers actually have an API specifically for that use case: window.requestAnimationFrame(), but Taisei's original blocking control flow style is simply not compatible with it. Emscripten exposes this API with its emscripten_set_main_loop(), which the eventloop backend now uses on that platform. Unfortunately, C is still C, with no fancy closures or coroutines. With blocking calls into menu/scene loops gone, the control flow is reimplemented via so-called (pun intended) "call chains". That is basically an euphemism for callback hell. With manual memory management and zero type-safety. Not that the menu system wasn't shitty enough already. I'll just keep telling myself that this is all temporary and will be replaced with scripts in v1.4. * improve build system for emscripten + various fixes * squish menu bugs * improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS Note that stock freetype does not work without EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the "emscripten" branch here: https://github.com/taisei-project/freetype2/tree/emscripten * Enable -Wcast-function-type Calling functions through incompatible pointers is nasal demons and doesn't work in WASM. * webgl: workaround a crash on some browsers * emscripten improvements: * Persist state (config, progress, replays, ...) in local IndexDB * Simpler HTML shell (temporary) * Enable more optimizations * fix build if validate_glsl=false * emscripten: improve asset packaging, with local cache Note that even though there are rules to build audio bundles, audio does *not* work yet. It looks like SDL2_mixer can not work without threads, which is a problem. Yet another reason to write an OpenAL backend - emscripten supports that natively. * emscripten: customize the html shell * emscripten: force "show log" checkbox unchecked initially * emscripten: remove quit shortcut from main menu (since there's no quit) * emscripten: log area fixes * emscripten/webgl: workaround for fullscreen viewport issue * emscripten: implement frameskip * emscripter: improve framerate limiter * align List to at least 8 bytes (shut up warnings) * fix non-emscripten builds * improve fullscreen handling, mainly for emscripten * Workaround to make audio work in chromium emscripten-core/emscripten#6511 * emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 20:32:32 +01:00
)
if meson_link_whole_is_broken
meson.add_install_script(
post_install_remove_command, 'lib' + libtaisei.name() + '.a',
install_tag : 'trash',
)
endif
2020-11-10 06:36:57 +01:00
taisei = static_library(taisei_basename + '-full',
link_whole : libtaisei,
)
taisei_js = custom_target(em_link_outputs[0],
Emscripten compatibility (#161) * Major refactoring of the main loop(s) and control flow (WIP) run_at_fps() is gone 🦀 Instead of nested blocking event loops, there is now an eventloop API that manages an explicit stack of scenes. This makes Taisei a lot more portable to async environments where spinning a loop forever without yielding control simply is not an option, and that is the entire point of this change. A prime example of such an environment is the Web (via emscripten). Taisei was able to run there through a terrible hack: inserting emscripten_sleep calls into the loop, which would yield to the browser. This has several major drawbacks: first of all, every function that could possibly call emscripten_sleep must be compiled into a special kind of bytecode, which then has to be interpreted at runtime, *much* slower than JITed WebAssembly. And that includes *everything* down the call stack, too! For more information, see https://emscripten.org/docs/porting/emterpreter.html Even though that method worked well enough for experimenting, despite suboptimal performance, there is another obvious drawback: emscripten_sleep is implemented via setTimeout(), which can be very imprecise and is generally not reliable for fluid animation. Browsers actually have an API specifically for that use case: window.requestAnimationFrame(), but Taisei's original blocking control flow style is simply not compatible with it. Emscripten exposes this API with its emscripten_set_main_loop(), which the eventloop backend now uses on that platform. Unfortunately, C is still C, with no fancy closures or coroutines. With blocking calls into menu/scene loops gone, the control flow is reimplemented via so-called (pun intended) "call chains". That is basically an euphemism for callback hell. With manual memory management and zero type-safety. Not that the menu system wasn't shitty enough already. I'll just keep telling myself that this is all temporary and will be replaced with scripts in v1.4. * improve build system for emscripten + various fixes * squish menu bugs * improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS Note that stock freetype does not work without EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the "emscripten" branch here: https://github.com/taisei-project/freetype2/tree/emscripten * Enable -Wcast-function-type Calling functions through incompatible pointers is nasal demons and doesn't work in WASM. * webgl: workaround a crash on some browsers * emscripten improvements: * Persist state (config, progress, replays, ...) in local IndexDB * Simpler HTML shell (temporary) * Enable more optimizations * fix build if validate_glsl=false * emscripten: improve asset packaging, with local cache Note that even though there are rules to build audio bundles, audio does *not* work yet. It looks like SDL2_mixer can not work without threads, which is a problem. Yet another reason to write an OpenAL backend - emscripten supports that natively. * emscripten: customize the html shell * emscripten: force "show log" checkbox unchecked initially * emscripten: remove quit shortcut from main menu (since there's no quit) * emscripten: log area fixes * emscripten/webgl: workaround for fullscreen viewport issue * emscripten: implement frameskip * emscripter: improve framerate limiter * align List to at least 8 bytes (shut up warnings) * fix non-emscripten builds * improve fullscreen handling, mainly for emscripten * Workaround to make audio work in chromium emscripten-core/emscripten#6511 * emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 20:32:32 +01:00
command : [
2020-11-10 06:36:57 +01:00
meson.get_compiler('cpp').cmd_array(),
2020-11-10 07:12:06 +01:00
taisei,
'--pre-js', em_preamble,
'--post-js', em_postamble,
get_option('c_args'),
get_option('c_link_args'),
2020-11-10 06:36:57 +01:00
em_common_args,
Emscripten compatibility (#161) * Major refactoring of the main loop(s) and control flow (WIP) run_at_fps() is gone 🦀 Instead of nested blocking event loops, there is now an eventloop API that manages an explicit stack of scenes. This makes Taisei a lot more portable to async environments where spinning a loop forever without yielding control simply is not an option, and that is the entire point of this change. A prime example of such an environment is the Web (via emscripten). Taisei was able to run there through a terrible hack: inserting emscripten_sleep calls into the loop, which would yield to the browser. This has several major drawbacks: first of all, every function that could possibly call emscripten_sleep must be compiled into a special kind of bytecode, which then has to be interpreted at runtime, *much* slower than JITed WebAssembly. And that includes *everything* down the call stack, too! For more information, see https://emscripten.org/docs/porting/emterpreter.html Even though that method worked well enough for experimenting, despite suboptimal performance, there is another obvious drawback: emscripten_sleep is implemented via setTimeout(), which can be very imprecise and is generally not reliable for fluid animation. Browsers actually have an API specifically for that use case: window.requestAnimationFrame(), but Taisei's original blocking control flow style is simply not compatible with it. Emscripten exposes this API with its emscripten_set_main_loop(), which the eventloop backend now uses on that platform. Unfortunately, C is still C, with no fancy closures or coroutines. With blocking calls into menu/scene loops gone, the control flow is reimplemented via so-called (pun intended) "call chains". That is basically an euphemism for callback hell. With manual memory management and zero type-safety. Not that the menu system wasn't shitty enough already. I'll just keep telling myself that this is all temporary and will be replaced with scripts in v1.4. * improve build system for emscripten + various fixes * squish menu bugs * improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS Note that stock freetype does not work without EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the "emscripten" branch here: https://github.com/taisei-project/freetype2/tree/emscripten * Enable -Wcast-function-type Calling functions through incompatible pointers is nasal demons and doesn't work in WASM. * webgl: workaround a crash on some browsers * emscripten improvements: * Persist state (config, progress, replays, ...) in local IndexDB * Simpler HTML shell (temporary) * Enable more optimizations * fix build if validate_glsl=false * emscripten: improve asset packaging, with local cache Note that even though there are rules to build audio bundles, audio does *not* work yet. It looks like SDL2_mixer can not work without threads, which is a problem. Yet another reason to write an OpenAL backend - emscripten supports that natively. * emscripten: customize the html shell * emscripten: force "show log" checkbox unchecked initially * emscripten: remove quit shortcut from main menu (since there's no quit) * emscripten: log area fixes * emscripten/webgl: workaround for fullscreen viewport issue * emscripten: implement frameskip * emscripter: improve framerate limiter * align List to at least 8 bytes (shut up warnings) * fix non-emscripten builds * improve fullscreen handling, mainly for emscripten * Workaround to make audio work in chromium emscripten-core/emscripten#6511 * emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 20:32:32 +01:00
em_link_args,
'-o', '@OUTPUT0@',
Emscripten compatibility (#161) * Major refactoring of the main loop(s) and control flow (WIP) run_at_fps() is gone 🦀 Instead of nested blocking event loops, there is now an eventloop API that manages an explicit stack of scenes. This makes Taisei a lot more portable to async environments where spinning a loop forever without yielding control simply is not an option, and that is the entire point of this change. A prime example of such an environment is the Web (via emscripten). Taisei was able to run there through a terrible hack: inserting emscripten_sleep calls into the loop, which would yield to the browser. This has several major drawbacks: first of all, every function that could possibly call emscripten_sleep must be compiled into a special kind of bytecode, which then has to be interpreted at runtime, *much* slower than JITed WebAssembly. And that includes *everything* down the call stack, too! For more information, see https://emscripten.org/docs/porting/emterpreter.html Even though that method worked well enough for experimenting, despite suboptimal performance, there is another obvious drawback: emscripten_sleep is implemented via setTimeout(), which can be very imprecise and is generally not reliable for fluid animation. Browsers actually have an API specifically for that use case: window.requestAnimationFrame(), but Taisei's original blocking control flow style is simply not compatible with it. Emscripten exposes this API with its emscripten_set_main_loop(), which the eventloop backend now uses on that platform. Unfortunately, C is still C, with no fancy closures or coroutines. With blocking calls into menu/scene loops gone, the control flow is reimplemented via so-called (pun intended) "call chains". That is basically an euphemism for callback hell. With manual memory management and zero type-safety. Not that the menu system wasn't shitty enough already. I'll just keep telling myself that this is all temporary and will be replaced with scripts in v1.4. * improve build system for emscripten + various fixes * squish menu bugs * improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS Note that stock freetype does not work without EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the "emscripten" branch here: https://github.com/taisei-project/freetype2/tree/emscripten * Enable -Wcast-function-type Calling functions through incompatible pointers is nasal demons and doesn't work in WASM. * webgl: workaround a crash on some browsers * emscripten improvements: * Persist state (config, progress, replays, ...) in local IndexDB * Simpler HTML shell (temporary) * Enable more optimizations * fix build if validate_glsl=false * emscripten: improve asset packaging, with local cache Note that even though there are rules to build audio bundles, audio does *not* work yet. It looks like SDL2_mixer can not work without threads, which is a problem. Yet another reason to write an OpenAL backend - emscripten supports that natively. * emscripten: customize the html shell * emscripten: force "show log" checkbox unchecked initially * emscripten: remove quit shortcut from main menu (since there's no quit) * emscripten: log area fixes * emscripten/webgl: workaround for fullscreen viewport issue * emscripten: implement frameskip * emscripter: improve framerate limiter * align List to at least 8 bytes (shut up warnings) * fix non-emscripten builds * improve fullscreen handling, mainly for emscripten * Workaround to make audio work in chromium emscripten-core/emscripten#6511 * emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 20:32:32 +01:00
],
build_by_default : true,
output : em_link_outputs,
install : true,
install_dir : bindir,
2023-05-18 20:03:30 +02:00
install_tag : 'runtime',
console : true,
Emscripten compatibility (#161) * Major refactoring of the main loop(s) and control flow (WIP) run_at_fps() is gone 🦀 Instead of nested blocking event loops, there is now an eventloop API that manages an explicit stack of scenes. This makes Taisei a lot more portable to async environments where spinning a loop forever without yielding control simply is not an option, and that is the entire point of this change. A prime example of such an environment is the Web (via emscripten). Taisei was able to run there through a terrible hack: inserting emscripten_sleep calls into the loop, which would yield to the browser. This has several major drawbacks: first of all, every function that could possibly call emscripten_sleep must be compiled into a special kind of bytecode, which then has to be interpreted at runtime, *much* slower than JITed WebAssembly. And that includes *everything* down the call stack, too! For more information, see https://emscripten.org/docs/porting/emterpreter.html Even though that method worked well enough for experimenting, despite suboptimal performance, there is another obvious drawback: emscripten_sleep is implemented via setTimeout(), which can be very imprecise and is generally not reliable for fluid animation. Browsers actually have an API specifically for that use case: window.requestAnimationFrame(), but Taisei's original blocking control flow style is simply not compatible with it. Emscripten exposes this API with its emscripten_set_main_loop(), which the eventloop backend now uses on that platform. Unfortunately, C is still C, with no fancy closures or coroutines. With blocking calls into menu/scene loops gone, the control flow is reimplemented via so-called (pun intended) "call chains". That is basically an euphemism for callback hell. With manual memory management and zero type-safety. Not that the menu system wasn't shitty enough already. I'll just keep telling myself that this is all temporary and will be replaced with scripts in v1.4. * improve build system for emscripten + various fixes * squish menu bugs * improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS Note that stock freetype does not work without EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the "emscripten" branch here: https://github.com/taisei-project/freetype2/tree/emscripten * Enable -Wcast-function-type Calling functions through incompatible pointers is nasal demons and doesn't work in WASM. * webgl: workaround a crash on some browsers * emscripten improvements: * Persist state (config, progress, replays, ...) in local IndexDB * Simpler HTML shell (temporary) * Enable more optimizations * fix build if validate_glsl=false * emscripten: improve asset packaging, with local cache Note that even though there are rules to build audio bundles, audio does *not* work yet. It looks like SDL2_mixer can not work without threads, which is a problem. Yet another reason to write an OpenAL backend - emscripten supports that natively. * emscripten: customize the html shell * emscripten: force "show log" checkbox unchecked initially * emscripten: remove quit shortcut from main menu (since there's no quit) * emscripten: log area fixes * emscripten/webgl: workaround for fullscreen viewport issue * emscripten: implement frameskip * emscripter: improve framerate limiter * align List to at least 8 bytes (shut up warnings) * fix non-emscripten builds * improve fullscreen handling, mainly for emscripten * Workaround to make audio work in chromium emscripten-core/emscripten#6511 * emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 20:32:32 +01:00
)
2019-12-18 14:33:36 +01:00
bindist_deps += taisei_js
elif host_machine.system() == 'nx'
taisei_elf_name = '@0@.elf'.format(taisei_basename)
taisei_elf = executable(taisei_elf_name, taisei_src, taisei_main_src, version_deps,
dependencies : taisei_deps,
c_args : taisei_c_args,
c_pch : 'pch/taisei_pch.h',
install : is_debug_build,
install_dir : bindir,
override_options: ['strip=false'],
)
bindist_deps += taisei_elf
taisei_nacp_name = '@0@.nacp'.format(taisei_basename)
taisei_nacp = custom_target(taisei_nacp_name,
command : [
find_program('nacptool'),
'--create',
nx_app_title,
nx_app_author,
taisei_version_string,
'@OUTPUT@',
],
build_by_default : true,
install : false,
output : taisei_nacp_name,
)
taisei_nro_name = '@0@.nro'.format(taisei_basename)
taisei_nro = custom_target(taisei_nro_name,
command : [
find_program('elf2nro'),
build,ci: Build system maintenance (#350) Squashed commit of the following: commit 9ab0197ee148b15252d9aa8a962474b8c1afd1a5 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 28 23:05:58 2022 +0100 build: add dummy descriptions for deprecated options commit b0c41d4719ce3076d6867bb68ee4991823059d78 Author: Alice D <alice@starwitch.productions> Date: Mon Dec 26 15:18:09 2022 -0500 update docker containers with ones containing meson 0.63.3 commit a2dd4173fc94527f0ab21f6cf4a50b88bbd893bf Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sun Dec 25 19:20:44 2022 +0100 build: featurize audio options commit 7c59e2a56966db2fdba55578cd1b65501f50c3cf Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sun Dec 25 19:20:35 2022 +0100 build: remove dead code commit cf500af137d88a4dd340e31bea024b50fc52559d Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sun Dec 25 19:07:37 2022 +0100 doc: update BUILD.rst commit 9764ac706f6780bd47e9adb4a7635be7f2d4dc1f Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sun Dec 25 17:12:37 2022 +0100 ci: disable WGI joystick backend for SDL Fails to build with latest llvm-mingw commit 2d4f310b903eeae5a76437ca6151e2468fff2f27 Author: p-sam <p-sam@d3vs.net> Date: Sun Dec 25 17:03:47 2022 +0100 switch: fix missing include commit 9264f1649df458ed970274e2ed8336b572429263 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sat Dec 24 14:36:41 2022 +0100 ci: update meson to 0.63.3 due to a bug commit 3e37be3d8f9bd69c8349b8f33154c1074c528081 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sat Dec 24 13:42:34 2022 +0100 ci: update build options commit 281a39a4f5718b48f8c05ef261d76c3d2f12fd7e Author: Alice D <alice@starwitch.productions> Date: Sun Dec 18 00:17:07 2022 -0500 ci: change when apt is cleaned up for switch image commit 2f2100a84cc55a194f55bc1993da0dffe15d5243 Author: Alice D <alice@starwitch.productions> Date: Sun Dec 18 00:11:08 2022 -0500 ci: bump switch homebrew container version commit ebaff59260d5518d526d9ceb28eb0636ac207de0 Author: Alice D <alice@starwitch.productions> Date: Sat Dec 17 22:55:39 2022 -0500 ci: bump windows container version commit 7ce6f234199a9c8028debf1dc009a8b4f6cfebd4 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sat Dec 17 07:36:28 2022 +0100 build: featurize renderer options commit a345f21b35f6f8c9ca761f6307731727bf98d54a Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sat Dec 17 07:33:30 2022 +0100 build: revert to explicit fallback for libzstd Implicit fallback causes conflicts in the basis_universal subproject https://github.com/mesonbuild/meson/issues/11189 commit b2de61f5c50d1d1246bb39ad6c8cc0ca829ec0df Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sat Dec 17 05:29:29 2022 +0100 build: remove debug_opengl This option was always misdocumented, as it only controlled whether GL debugging is on by default. You can still control it with the TAISEI_GL_DEBUG environment variable, which is set to 1 in meson devenv. commit 4c659ba19517ccd4f2bbd70d3af2b7dcbf0f711e Author: Andrei Alexeyev <akari@taisei-project.org> Date: Fri Dec 16 08:03:37 2022 +0100 build: set up useful env vars for meson devenv Makes Taisei load resources from the source tree, making live reload work; enables OpenGL debugging by default; works around ASan stack use after return false positives. commit 1ddc58b84ae7c5b7733c1c31bfa4b6619d84a04a Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 08:06:32 2022 +0100 build: featurize docs; always install licenses commit c3a94d7f5bdeab1c5180972c20526fa54ca37703 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 07:46:28 2022 +0100 build: featurize shader_transpiler commit 619d82ae36a3360c5151623412037eb88bc6acd9 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 07:38:30 2022 +0100 build: allow libzip fallback by default commit 79ab72292a54dc77c739b7abdee307549cacd527 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 07:35:51 2022 +0100 build: featurize use_libcrypto commit b393077f716f77af59df6c62cb83d16b0e409880 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 05:03:20 2022 +0100 build: featurize validate_glsl commit 7d76484079e3dda8ea042852b61f66908eb174c9 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 04:34:31 2022 +0100 build: featurize some more installation options commit 17c0bda2050c5544433b7a25ceaab9270d1ba09c Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 03:24:46 2022 +0100 build: deprecate enable_zip for vfs_zip; convert package_data into feature commit 9a4ef8c091b71218fe872afcc66d47e055f7ab75 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 02:37:55 2022 +0100 build: deprecate developer=auto; default to false commit 807240e508cd375402973bdabd8a0cf0ad4d9d71 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 02:24:04 2022 +0100 build: move subproject fallback info into wraps commit 08c953f48773326e4b2b2082052d0654fd540ed2 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 01:57:33 2022 +0100 build: deprecate 'static' option Meson has a built-in `prefer_static` now commit c5756015374eeef71fcc443d911e1679bfb64167 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 01:49:31 2022 +0100 build: remove complicated shaderc detection logic Meson does all of this internally since 0.51.0 commit cd2d460d4b6dbb291a4bd1b99e87a9cb69805203 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 01:45:17 2022 +0100 build: Require meson >=0.63.0 commit 10abd790f7d71fecc0884ffb4f32880f4f0ddd4d Author: Andrei Alexeyev <akari@taisei-project.org> Date: Mon Dec 12 05:16:47 2022 +0100 ci: remove meson dist version workaround from release workflow Meson should know the correct version now commit 31a07d8c3cbaec0a49d23e912d74d2e0fd3478d1 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Mon Dec 12 03:46:28 2022 +0100 build: use built-in summary() function commit 0c47f6d14b63335ee051346cb48955f3452b9823 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Mon Dec 12 04:33:01 2022 +0100 build: remove -Dversion_fallback and introduce .VERSION file The version script will now first try to read the version from a .VERSION file in the source root. If that file does not exist, it will query git. The .VERSION file is not included in the git repository, it is generated for inclusion in source tarballs. Package maintainers who had any use for -Dversion_fallback may want to create the .VERSION file themselves. Additionally, some git-specific files have been removed from source tarballs. commit d32332a5e378b8fb183b1e1609746e60f76aeadc Author: Andrei Alexeyev <akari@taisei-project.org> Date: Mon Dec 12 03:00:07 2022 +0100 build: set the "real" version in project() commit f9a3fbc72956fa680e4b1ed6b3f9dba636c26768 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Mon Dec 12 01:50:08 2022 +0100 build: raise meson_version and remove some legacy workarounds Effectively 0.56.0 was already required since we started using some of its features at some point. This also fixes all current meson warnings.
2022-12-28 23:15:55 +01:00
taisei_elf,
'@OUTPUT@',
'--nacp=@0@'.format(taisei_nacp.full_path()), # if we could pass the path in a standalone argument, we could have meson generate an implicit dependency here...
'--icon=@0@'.format(nx_icon_path),
],
build_by_default : true,
build,ci: Build system maintenance (#350) Squashed commit of the following: commit 9ab0197ee148b15252d9aa8a962474b8c1afd1a5 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 28 23:05:58 2022 +0100 build: add dummy descriptions for deprecated options commit b0c41d4719ce3076d6867bb68ee4991823059d78 Author: Alice D <alice@starwitch.productions> Date: Mon Dec 26 15:18:09 2022 -0500 update docker containers with ones containing meson 0.63.3 commit a2dd4173fc94527f0ab21f6cf4a50b88bbd893bf Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sun Dec 25 19:20:44 2022 +0100 build: featurize audio options commit 7c59e2a56966db2fdba55578cd1b65501f50c3cf Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sun Dec 25 19:20:35 2022 +0100 build: remove dead code commit cf500af137d88a4dd340e31bea024b50fc52559d Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sun Dec 25 19:07:37 2022 +0100 doc: update BUILD.rst commit 9764ac706f6780bd47e9adb4a7635be7f2d4dc1f Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sun Dec 25 17:12:37 2022 +0100 ci: disable WGI joystick backend for SDL Fails to build with latest llvm-mingw commit 2d4f310b903eeae5a76437ca6151e2468fff2f27 Author: p-sam <p-sam@d3vs.net> Date: Sun Dec 25 17:03:47 2022 +0100 switch: fix missing include commit 9264f1649df458ed970274e2ed8336b572429263 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sat Dec 24 14:36:41 2022 +0100 ci: update meson to 0.63.3 due to a bug commit 3e37be3d8f9bd69c8349b8f33154c1074c528081 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sat Dec 24 13:42:34 2022 +0100 ci: update build options commit 281a39a4f5718b48f8c05ef261d76c3d2f12fd7e Author: Alice D <alice@starwitch.productions> Date: Sun Dec 18 00:17:07 2022 -0500 ci: change when apt is cleaned up for switch image commit 2f2100a84cc55a194f55bc1993da0dffe15d5243 Author: Alice D <alice@starwitch.productions> Date: Sun Dec 18 00:11:08 2022 -0500 ci: bump switch homebrew container version commit ebaff59260d5518d526d9ceb28eb0636ac207de0 Author: Alice D <alice@starwitch.productions> Date: Sat Dec 17 22:55:39 2022 -0500 ci: bump windows container version commit 7ce6f234199a9c8028debf1dc009a8b4f6cfebd4 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sat Dec 17 07:36:28 2022 +0100 build: featurize renderer options commit a345f21b35f6f8c9ca761f6307731727bf98d54a Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sat Dec 17 07:33:30 2022 +0100 build: revert to explicit fallback for libzstd Implicit fallback causes conflicts in the basis_universal subproject https://github.com/mesonbuild/meson/issues/11189 commit b2de61f5c50d1d1246bb39ad6c8cc0ca829ec0df Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sat Dec 17 05:29:29 2022 +0100 build: remove debug_opengl This option was always misdocumented, as it only controlled whether GL debugging is on by default. You can still control it with the TAISEI_GL_DEBUG environment variable, which is set to 1 in meson devenv. commit 4c659ba19517ccd4f2bbd70d3af2b7dcbf0f711e Author: Andrei Alexeyev <akari@taisei-project.org> Date: Fri Dec 16 08:03:37 2022 +0100 build: set up useful env vars for meson devenv Makes Taisei load resources from the source tree, making live reload work; enables OpenGL debugging by default; works around ASan stack use after return false positives. commit 1ddc58b84ae7c5b7733c1c31bfa4b6619d84a04a Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 08:06:32 2022 +0100 build: featurize docs; always install licenses commit c3a94d7f5bdeab1c5180972c20526fa54ca37703 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 07:46:28 2022 +0100 build: featurize shader_transpiler commit 619d82ae36a3360c5151623412037eb88bc6acd9 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 07:38:30 2022 +0100 build: allow libzip fallback by default commit 79ab72292a54dc77c739b7abdee307549cacd527 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 07:35:51 2022 +0100 build: featurize use_libcrypto commit b393077f716f77af59df6c62cb83d16b0e409880 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 05:03:20 2022 +0100 build: featurize validate_glsl commit 7d76484079e3dda8ea042852b61f66908eb174c9 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 04:34:31 2022 +0100 build: featurize some more installation options commit 17c0bda2050c5544433b7a25ceaab9270d1ba09c Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 03:24:46 2022 +0100 build: deprecate enable_zip for vfs_zip; convert package_data into feature commit 9a4ef8c091b71218fe872afcc66d47e055f7ab75 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 02:37:55 2022 +0100 build: deprecate developer=auto; default to false commit 807240e508cd375402973bdabd8a0cf0ad4d9d71 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 02:24:04 2022 +0100 build: move subproject fallback info into wraps commit 08c953f48773326e4b2b2082052d0654fd540ed2 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 01:57:33 2022 +0100 build: deprecate 'static' option Meson has a built-in `prefer_static` now commit c5756015374eeef71fcc443d911e1679bfb64167 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 01:49:31 2022 +0100 build: remove complicated shaderc detection logic Meson does all of this internally since 0.51.0 commit cd2d460d4b6dbb291a4bd1b99e87a9cb69805203 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 01:45:17 2022 +0100 build: Require meson >=0.63.0 commit 10abd790f7d71fecc0884ffb4f32880f4f0ddd4d Author: Andrei Alexeyev <akari@taisei-project.org> Date: Mon Dec 12 05:16:47 2022 +0100 ci: remove meson dist version workaround from release workflow Meson should know the correct version now commit 31a07d8c3cbaec0a49d23e912d74d2e0fd3478d1 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Mon Dec 12 03:46:28 2022 +0100 build: use built-in summary() function commit 0c47f6d14b63335ee051346cb48955f3452b9823 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Mon Dec 12 04:33:01 2022 +0100 build: remove -Dversion_fallback and introduce .VERSION file The version script will now first try to read the version from a .VERSION file in the source root. If that file does not exist, it will query git. The .VERSION file is not included in the git repository, it is generated for inclusion in source tarballs. Package maintainers who had any use for -Dversion_fallback may want to create the .VERSION file themselves. Additionally, some git-specific files have been removed from source tarballs. commit d32332a5e378b8fb183b1e1609746e60f76aeadc Author: Andrei Alexeyev <akari@taisei-project.org> Date: Mon Dec 12 03:00:07 2022 +0100 build: set the "real" version in project() commit f9a3fbc72956fa680e4b1ed6b3f9dba636c26768 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Mon Dec 12 01:50:08 2022 +0100 build: raise meson_version and remove some legacy workarounds Effectively 0.56.0 was already required since we started using some of its features at some point. This also fixes all current meson warnings.
2022-12-28 23:15:55 +01:00
depends : [taisei_nacp],
install : true,
install_dir : bindir,
2023-05-18 20:03:30 +02:00
install_tag : 'runtime',
output : taisei_nro_name,
)
bindist_deps += taisei_nro
else
libtaisei = static_library(taisei_basename, taisei_src, version_deps,
Emscripten compatibility (#161) * Major refactoring of the main loop(s) and control flow (WIP) run_at_fps() is gone 🦀 Instead of nested blocking event loops, there is now an eventloop API that manages an explicit stack of scenes. This makes Taisei a lot more portable to async environments where spinning a loop forever without yielding control simply is not an option, and that is the entire point of this change. A prime example of such an environment is the Web (via emscripten). Taisei was able to run there through a terrible hack: inserting emscripten_sleep calls into the loop, which would yield to the browser. This has several major drawbacks: first of all, every function that could possibly call emscripten_sleep must be compiled into a special kind of bytecode, which then has to be interpreted at runtime, *much* slower than JITed WebAssembly. And that includes *everything* down the call stack, too! For more information, see https://emscripten.org/docs/porting/emterpreter.html Even though that method worked well enough for experimenting, despite suboptimal performance, there is another obvious drawback: emscripten_sleep is implemented via setTimeout(), which can be very imprecise and is generally not reliable for fluid animation. Browsers actually have an API specifically for that use case: window.requestAnimationFrame(), but Taisei's original blocking control flow style is simply not compatible with it. Emscripten exposes this API with its emscripten_set_main_loop(), which the eventloop backend now uses on that platform. Unfortunately, C is still C, with no fancy closures or coroutines. With blocking calls into menu/scene loops gone, the control flow is reimplemented via so-called (pun intended) "call chains". That is basically an euphemism for callback hell. With manual memory management and zero type-safety. Not that the menu system wasn't shitty enough already. I'll just keep telling myself that this is all temporary and will be replaced with scripts in v1.4. * improve build system for emscripten + various fixes * squish menu bugs * improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS Note that stock freetype does not work without EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the "emscripten" branch here: https://github.com/taisei-project/freetype2/tree/emscripten * Enable -Wcast-function-type Calling functions through incompatible pointers is nasal demons and doesn't work in WASM. * webgl: workaround a crash on some browsers * emscripten improvements: * Persist state (config, progress, replays, ...) in local IndexDB * Simpler HTML shell (temporary) * Enable more optimizations * fix build if validate_glsl=false * emscripten: improve asset packaging, with local cache Note that even though there are rules to build audio bundles, audio does *not* work yet. It looks like SDL2_mixer can not work without threads, which is a problem. Yet another reason to write an OpenAL backend - emscripten supports that natively. * emscripten: customize the html shell * emscripten: force "show log" checkbox unchecked initially * emscripten: remove quit shortcut from main menu (since there's no quit) * emscripten: log area fixes * emscripten/webgl: workaround for fullscreen viewport issue * emscripten: implement frameskip * emscripter: improve framerate limiter * align List to at least 8 bytes (shut up warnings) * fix non-emscripten builds * improve fullscreen handling, mainly for emscripten * Workaround to make audio work in chromium emscripten-core/emscripten#6511 * emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 20:32:32 +01:00
dependencies : taisei_deps,
c_args : taisei_c_args,
c_pch : 'pch/taisei_pch.h',
install : false,
)
libtaisei_dep = declare_dependency(
compile_args : taisei_c_args,
dependencies : taisei_deps,
include_directories : include_directories('.'),
link_with : libtaisei,
)
taisei = executable(taisei_basename, taisei_main_src,
dependencies : stages_live_reload ? libtaisei_dep.as_link_whole() : libtaisei_dep,
build,ci: Build system maintenance (#350) Squashed commit of the following: commit 9ab0197ee148b15252d9aa8a962474b8c1afd1a5 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 28 23:05:58 2022 +0100 build: add dummy descriptions for deprecated options commit b0c41d4719ce3076d6867bb68ee4991823059d78 Author: Alice D <alice@starwitch.productions> Date: Mon Dec 26 15:18:09 2022 -0500 update docker containers with ones containing meson 0.63.3 commit a2dd4173fc94527f0ab21f6cf4a50b88bbd893bf Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sun Dec 25 19:20:44 2022 +0100 build: featurize audio options commit 7c59e2a56966db2fdba55578cd1b65501f50c3cf Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sun Dec 25 19:20:35 2022 +0100 build: remove dead code commit cf500af137d88a4dd340e31bea024b50fc52559d Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sun Dec 25 19:07:37 2022 +0100 doc: update BUILD.rst commit 9764ac706f6780bd47e9adb4a7635be7f2d4dc1f Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sun Dec 25 17:12:37 2022 +0100 ci: disable WGI joystick backend for SDL Fails to build with latest llvm-mingw commit 2d4f310b903eeae5a76437ca6151e2468fff2f27 Author: p-sam <p-sam@d3vs.net> Date: Sun Dec 25 17:03:47 2022 +0100 switch: fix missing include commit 9264f1649df458ed970274e2ed8336b572429263 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sat Dec 24 14:36:41 2022 +0100 ci: update meson to 0.63.3 due to a bug commit 3e37be3d8f9bd69c8349b8f33154c1074c528081 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sat Dec 24 13:42:34 2022 +0100 ci: update build options commit 281a39a4f5718b48f8c05ef261d76c3d2f12fd7e Author: Alice D <alice@starwitch.productions> Date: Sun Dec 18 00:17:07 2022 -0500 ci: change when apt is cleaned up for switch image commit 2f2100a84cc55a194f55bc1993da0dffe15d5243 Author: Alice D <alice@starwitch.productions> Date: Sun Dec 18 00:11:08 2022 -0500 ci: bump switch homebrew container version commit ebaff59260d5518d526d9ceb28eb0636ac207de0 Author: Alice D <alice@starwitch.productions> Date: Sat Dec 17 22:55:39 2022 -0500 ci: bump windows container version commit 7ce6f234199a9c8028debf1dc009a8b4f6cfebd4 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sat Dec 17 07:36:28 2022 +0100 build: featurize renderer options commit a345f21b35f6f8c9ca761f6307731727bf98d54a Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sat Dec 17 07:33:30 2022 +0100 build: revert to explicit fallback for libzstd Implicit fallback causes conflicts in the basis_universal subproject https://github.com/mesonbuild/meson/issues/11189 commit b2de61f5c50d1d1246bb39ad6c8cc0ca829ec0df Author: Andrei Alexeyev <akari@taisei-project.org> Date: Sat Dec 17 05:29:29 2022 +0100 build: remove debug_opengl This option was always misdocumented, as it only controlled whether GL debugging is on by default. You can still control it with the TAISEI_GL_DEBUG environment variable, which is set to 1 in meson devenv. commit 4c659ba19517ccd4f2bbd70d3af2b7dcbf0f711e Author: Andrei Alexeyev <akari@taisei-project.org> Date: Fri Dec 16 08:03:37 2022 +0100 build: set up useful env vars for meson devenv Makes Taisei load resources from the source tree, making live reload work; enables OpenGL debugging by default; works around ASan stack use after return false positives. commit 1ddc58b84ae7c5b7733c1c31bfa4b6619d84a04a Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 08:06:32 2022 +0100 build: featurize docs; always install licenses commit c3a94d7f5bdeab1c5180972c20526fa54ca37703 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 07:46:28 2022 +0100 build: featurize shader_transpiler commit 619d82ae36a3360c5151623412037eb88bc6acd9 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 07:38:30 2022 +0100 build: allow libzip fallback by default commit 79ab72292a54dc77c739b7abdee307549cacd527 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 07:35:51 2022 +0100 build: featurize use_libcrypto commit b393077f716f77af59df6c62cb83d16b0e409880 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 05:03:20 2022 +0100 build: featurize validate_glsl commit 7d76484079e3dda8ea042852b61f66908eb174c9 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 04:34:31 2022 +0100 build: featurize some more installation options commit 17c0bda2050c5544433b7a25ceaab9270d1ba09c Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 03:24:46 2022 +0100 build: deprecate enable_zip for vfs_zip; convert package_data into feature commit 9a4ef8c091b71218fe872afcc66d47e055f7ab75 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 02:37:55 2022 +0100 build: deprecate developer=auto; default to false commit 807240e508cd375402973bdabd8a0cf0ad4d9d71 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 02:24:04 2022 +0100 build: move subproject fallback info into wraps commit 08c953f48773326e4b2b2082052d0654fd540ed2 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 01:57:33 2022 +0100 build: deprecate 'static' option Meson has a built-in `prefer_static` now commit c5756015374eeef71fcc443d911e1679bfb64167 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 01:49:31 2022 +0100 build: remove complicated shaderc detection logic Meson does all of this internally since 0.51.0 commit cd2d460d4b6dbb291a4bd1b99e87a9cb69805203 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Wed Dec 14 01:45:17 2022 +0100 build: Require meson >=0.63.0 commit 10abd790f7d71fecc0884ffb4f32880f4f0ddd4d Author: Andrei Alexeyev <akari@taisei-project.org> Date: Mon Dec 12 05:16:47 2022 +0100 ci: remove meson dist version workaround from release workflow Meson should know the correct version now commit 31a07d8c3cbaec0a49d23e912d74d2e0fd3478d1 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Mon Dec 12 03:46:28 2022 +0100 build: use built-in summary() function commit 0c47f6d14b63335ee051346cb48955f3452b9823 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Mon Dec 12 04:33:01 2022 +0100 build: remove -Dversion_fallback and introduce .VERSION file The version script will now first try to read the version from a .VERSION file in the source root. If that file does not exist, it will query git. The .VERSION file is not included in the git repository, it is generated for inclusion in source tarballs. Package maintainers who had any use for -Dversion_fallback may want to create the .VERSION file themselves. Additionally, some git-specific files have been removed from source tarballs. commit d32332a5e378b8fb183b1e1609746e60f76aeadc Author: Andrei Alexeyev <akari@taisei-project.org> Date: Mon Dec 12 03:00:07 2022 +0100 build: set the "real" version in project() commit f9a3fbc72956fa680e4b1ed6b3f9dba636c26768 Author: Andrei Alexeyev <akari@taisei-project.org> Date: Mon Dec 12 01:50:08 2022 +0100 build: raise meson_version and remove some legacy workarounds Effectively 0.56.0 was already required since we started using some of its features at some point. This also fixes all current meson warnings.
2022-12-28 23:15:55 +01:00
win_subsystem : get_option('win_console') ? 'console' : 'windows',
Emscripten compatibility (#161) * Major refactoring of the main loop(s) and control flow (WIP) run_at_fps() is gone 🦀 Instead of nested blocking event loops, there is now an eventloop API that manages an explicit stack of scenes. This makes Taisei a lot more portable to async environments where spinning a loop forever without yielding control simply is not an option, and that is the entire point of this change. A prime example of such an environment is the Web (via emscripten). Taisei was able to run there through a terrible hack: inserting emscripten_sleep calls into the loop, which would yield to the browser. This has several major drawbacks: first of all, every function that could possibly call emscripten_sleep must be compiled into a special kind of bytecode, which then has to be interpreted at runtime, *much* slower than JITed WebAssembly. And that includes *everything* down the call stack, too! For more information, see https://emscripten.org/docs/porting/emterpreter.html Even though that method worked well enough for experimenting, despite suboptimal performance, there is another obvious drawback: emscripten_sleep is implemented via setTimeout(), which can be very imprecise and is generally not reliable for fluid animation. Browsers actually have an API specifically for that use case: window.requestAnimationFrame(), but Taisei's original blocking control flow style is simply not compatible with it. Emscripten exposes this API with its emscripten_set_main_loop(), which the eventloop backend now uses on that platform. Unfortunately, C is still C, with no fancy closures or coroutines. With blocking calls into menu/scene loops gone, the control flow is reimplemented via so-called (pun intended) "call chains". That is basically an euphemism for callback hell. With manual memory management and zero type-safety. Not that the menu system wasn't shitty enough already. I'll just keep telling myself that this is all temporary and will be replaced with scripts in v1.4. * improve build system for emscripten + various fixes * squish menu bugs * improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS Note that stock freetype does not work without EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the "emscripten" branch here: https://github.com/taisei-project/freetype2/tree/emscripten * Enable -Wcast-function-type Calling functions through incompatible pointers is nasal demons and doesn't work in WASM. * webgl: workaround a crash on some browsers * emscripten improvements: * Persist state (config, progress, replays, ...) in local IndexDB * Simpler HTML shell (temporary) * Enable more optimizations * fix build if validate_glsl=false * emscripten: improve asset packaging, with local cache Note that even though there are rules to build audio bundles, audio does *not* work yet. It looks like SDL2_mixer can not work without threads, which is a problem. Yet another reason to write an OpenAL backend - emscripten supports that natively. * emscripten: customize the html shell * emscripten: force "show log" checkbox unchecked initially * emscripten: remove quit shortcut from main menu (since there's no quit) * emscripten: log area fixes * emscripten/webgl: workaround for fullscreen viewport issue * emscripten: implement frameskip * emscripter: improve framerate limiter * align List to at least 8 bytes (shut up warnings) * fix non-emscripten builds * improve fullscreen handling, mainly for emscripten * Workaround to make audio work in chromium emscripten-core/emscripten#6511 * emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 20:32:32 +01:00
install : true,
install_dir : bindir,
export_dynamic : stages_live_reload,
Emscripten compatibility (#161) * Major refactoring of the main loop(s) and control flow (WIP) run_at_fps() is gone 🦀 Instead of nested blocking event loops, there is now an eventloop API that manages an explicit stack of scenes. This makes Taisei a lot more portable to async environments where spinning a loop forever without yielding control simply is not an option, and that is the entire point of this change. A prime example of such an environment is the Web (via emscripten). Taisei was able to run there through a terrible hack: inserting emscripten_sleep calls into the loop, which would yield to the browser. This has several major drawbacks: first of all, every function that could possibly call emscripten_sleep must be compiled into a special kind of bytecode, which then has to be interpreted at runtime, *much* slower than JITed WebAssembly. And that includes *everything* down the call stack, too! For more information, see https://emscripten.org/docs/porting/emterpreter.html Even though that method worked well enough for experimenting, despite suboptimal performance, there is another obvious drawback: emscripten_sleep is implemented via setTimeout(), which can be very imprecise and is generally not reliable for fluid animation. Browsers actually have an API specifically for that use case: window.requestAnimationFrame(), but Taisei's original blocking control flow style is simply not compatible with it. Emscripten exposes this API with its emscripten_set_main_loop(), which the eventloop backend now uses on that platform. Unfortunately, C is still C, with no fancy closures or coroutines. With blocking calls into menu/scene loops gone, the control flow is reimplemented via so-called (pun intended) "call chains". That is basically an euphemism for callback hell. With manual memory management and zero type-safety. Not that the menu system wasn't shitty enough already. I'll just keep telling myself that this is all temporary and will be replaced with scripts in v1.4. * improve build system for emscripten + various fixes * squish menu bugs * improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS Note that stock freetype does not work without EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the "emscripten" branch here: https://github.com/taisei-project/freetype2/tree/emscripten * Enable -Wcast-function-type Calling functions through incompatible pointers is nasal demons and doesn't work in WASM. * webgl: workaround a crash on some browsers * emscripten improvements: * Persist state (config, progress, replays, ...) in local IndexDB * Simpler HTML shell (temporary) * Enable more optimizations * fix build if validate_glsl=false * emscripten: improve asset packaging, with local cache Note that even though there are rules to build audio bundles, audio does *not* work yet. It looks like SDL2_mixer can not work without threads, which is a problem. Yet another reason to write an OpenAL backend - emscripten supports that natively. * emscripten: customize the html shell * emscripten: force "show log" checkbox unchecked initially * emscripten: remove quit shortcut from main menu (since there's no quit) * emscripten: log area fixes * emscripten/webgl: workaround for fullscreen viewport issue * emscripten: implement frameskip * emscripter: improve framerate limiter * align List to at least 8 bytes (shut up warnings) * fix non-emscripten builds * improve fullscreen handling, mainly for emscripten * Workaround to make audio work in chromium emscripten-core/emscripten#6511 * emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 20:32:32 +01:00
)
bindist_deps += taisei
have_libtaisei = true
endif