2017-11-25 20:45:11 +01:00
|
|
|
project('taisei', 'c',
|
|
|
|
license : 'MIT',
|
2019-08-20 16:00:20 +02:00
|
|
|
version : 'v1.4-dev',
|
2019-09-29 21:02:38 +02:00
|
|
|
meson_version : '>=0.48.0',
|
2017-11-25 20:45:11 +01:00
|
|
|
default_options : [
|
2019-12-14 10:03:04 +01:00
|
|
|
# Should really be c11, but gnu11 is a safer default because everything is terrible.
|
|
|
|
'c_std=gnu11',
|
|
|
|
|
2019-03-17 06:06:47 +01:00
|
|
|
'default_library=static',
|
|
|
|
|
2020-03-17 10:00:34 +01:00
|
|
|
'koishi:threadsafe=false',
|
|
|
|
|
2019-03-17 06:06:47 +01:00
|
|
|
'libzip:enable_bzip2=false',
|
2020-03-19 08:02:33 +01:00
|
|
|
'libzip:enable_crypto=false',
|
|
|
|
'libzip:enable_lzma=false',
|
2017-11-25 20:45:11 +01:00
|
|
|
|
2019-03-20 08:35:29 +01:00
|
|
|
'sdl2:use_haptic=disabled',
|
|
|
|
'sdl2:use_power=disabled',
|
|
|
|
'sdl2:use_render=disabled',
|
|
|
|
'sdl2:use_sensor=disabled',
|
2020-03-19 08:02:33 +01:00
|
|
|
'sdl2:use_video_offscreen=disabled',
|
|
|
|
'sdl2:use_video_vulkan=disabled',
|
2019-03-18 07:05:10 +01:00
|
|
|
|
2017-11-25 20:45:11 +01:00
|
|
|
# You may want to change these for a debug build dir
|
|
|
|
'buildtype=release',
|
|
|
|
'strip=true',
|
|
|
|
'b_lto=true',
|
2019-01-24 21:21:08 +01:00
|
|
|
'b_ndebug=if-release',
|
2017-11-25 20:45:11 +01:00
|
|
|
]
|
|
|
|
)
|
2017-11-12 01:28:30 +01:00
|
|
|
|
2019-09-29 21:02:38 +02:00
|
|
|
minimum_recommended_meson_version = '0.49.0'
|
2019-03-12 01:05:35 +01:00
|
|
|
|
|
|
|
if meson.version().version_compare('<@0@'.format(minimum_recommended_meson_version))
|
|
|
|
warning('Old Meson version detected. Try upgrading to at least @0@ if the build fails.'.format(minimum_recommended_meson_version))
|
|
|
|
endif
|
|
|
|
|
2019-05-01 07:18:25 +02:00
|
|
|
is_debug_build = get_option('debug')
|
|
|
|
is_developer_build = (get_option('developer') == 'auto' ? is_debug_build : get_option('developer') == 'true')
|
|
|
|
|
2017-11-12 01:28:30 +01:00
|
|
|
cc = meson.get_compiler('c')
|
2017-11-27 14:27:32 +01:00
|
|
|
python3 = import('python3').find_python()
|
2019-01-24 21:21:08 +01:00
|
|
|
macos_app_bundle = get_option('macos_bundle') and host_machine.system() == 'darwin'
|
2017-11-12 01:28:30 +01:00
|
|
|
|
2019-01-24 21:21:08 +01:00
|
|
|
subdir('scripts')
|
2017-11-25 20:45:11 +01:00
|
|
|
|
2019-01-24 21:21:08 +01:00
|
|
|
config = configuration_data()
|
2017-11-12 01:28:30 +01:00
|
|
|
|
2019-02-11 09:30:00 +01:00
|
|
|
taisei_c_args = [
|
2019-01-24 21:21:08 +01:00
|
|
|
'-Wall',
|
|
|
|
'-Wpedantic',
|
2019-04-04 01:43:03 +02:00
|
|
|
|
2019-02-02 12:25:06 +01:00
|
|
|
'-Werror=assume',
|
2019-01-24 21:21:08 +01:00
|
|
|
'-Werror=implicit-function-declaration',
|
2019-04-04 01:43:03 +02:00
|
|
|
'-Werror=incompatible-pointer-types',
|
2019-01-24 21:21:08 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Keep the rest sorted
|
|
|
|
#
|
|
|
|
|
|
|
|
'-Wabsolute-value',
|
|
|
|
'-Wcast-align',
|
|
|
|
'-Wcast-align=strict',
|
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
|
|
|
'-Wcast-function-type',
|
2019-01-24 21:21:08 +01:00
|
|
|
'-Wclobbered',
|
|
|
|
'-Wduplicated-branches',
|
|
|
|
'-Wduplicated-cond',
|
|
|
|
'-Wfloat-overflow-conversion',
|
|
|
|
'-Wfloat-zero-conversion',
|
|
|
|
'-Wfor-loop-analysis',
|
|
|
|
'-Wformat-pedantic',
|
|
|
|
'-Wformat-security',
|
|
|
|
'-Wgcc-compat',
|
|
|
|
'-Wgnu',
|
|
|
|
'-Wignored-qualifiers',
|
|
|
|
'-Winit-self',
|
|
|
|
'-Wlogical-op',
|
|
|
|
'-Wmissing-prototypes',
|
2020-03-07 17:47:02 +01:00
|
|
|
'-Wno-gnu-folding-constant',
|
2020-04-04 01:23:32 +02:00
|
|
|
'-Wno-implicit-fallthrough',
|
2019-01-24 21:21:08 +01:00
|
|
|
'-Wno-long-long',
|
2019-03-03 12:53:45 +01:00
|
|
|
'-Wno-missing-braces',
|
2019-02-08 20:12:52 +01:00
|
|
|
'-Wno-typedef-redefinition',
|
2019-01-24 21:21:08 +01:00
|
|
|
'-Wnull-dereference',
|
|
|
|
'-Wparentheses',
|
|
|
|
'-Wshadow=compatible-local',
|
|
|
|
'-Wsometimes-uninitialized',
|
|
|
|
'-Wstrict-prototypes',
|
|
|
|
'-Wtype-limits',
|
Some compatibility fixes for Elbrus compiler (and others based on EDG front end) (#157)
* Reduce alignment to 16 due to stack variables alignment
On some archs (e.g. elbrus) there is no possibility to align
variables on stack by more that 16 bytes.
* Added check for -Wno-typedef-redefinition
In C11, there is legal to redefine typedef with the same type,
but some compilers like elbrus's lcc and, probably, intel's icc
generate a warning about that. So we disable it.
* Typo fix
* Fix __builtin_unreachable() warning on some frontends like EDG
* Added check for __attribute__((designated_init))
It doesn't work for elbrus'c lcc and clang; but clang does not
generate warning by default, but we still disable it just in case.
* A hack to avoid -Wtype-limits for compilers with unsigned enums
* Rewritten unreachable __builtin_unreachable() behavior.
According to https://bugs.llvm.org/show_bug.cgi?id=13910,
old clang versions also suffer from this issue along with lcc.
And also this warning option is removed from gcc since 4.5.0,
and it's likely there is no unreachable code analysis at all:
https://gcc.gnu.org/onlinedocs/gcc-4.5.0/gcc/Warning-Options.html
* Fixed unneeded stray UNREACHABLE which caused warnings
* Removed alignas() which is unneeded after lowering alignment requirements
* Removed a hack of -Wunreachable-code disabling on certain compilers
Actually, there was a wrong opinion that most of unreachable code
warnings are produced by __builtin_unreachable() itself,
not the certain use of it. After commit 36493d3, it is finally
figured out that it wasn't the case.
* Added dummy element to a struct in a test for designated_init
This test will enexpectedly fail when GNU extensions are not available
2019-02-07 09:11:13 +01:00
|
|
|
'-Wunneeded-internal-declaration',
|
2019-02-08 20:12:52 +01:00
|
|
|
'-Wunreachable-code',
|
2019-01-24 21:21:08 +01:00
|
|
|
'-Wunreachable-code-loop-increment',
|
2019-07-22 09:35:21 +02:00
|
|
|
|
|
|
|
'-fexcess-precision=standard',
|
|
|
|
'-fmerge-all-constants',
|
|
|
|
'-fno-math-errno',
|
|
|
|
'-fno-signaling-nans',
|
|
|
|
'-fno-trapping-math',
|
2019-02-11 09:30:00 +01:00
|
|
|
]
|
|
|
|
|
2019-10-03 02:22:54 +02:00
|
|
|
deprecation_warnings = get_option('deprecation_warnings')
|
|
|
|
|
|
|
|
if deprecation_warnings == 'error'
|
|
|
|
taisei_c_args += '-Werror=deprecated-declarations'
|
|
|
|
elif deprecation_warnings == 'no-error'
|
|
|
|
taisei_c_args += '-Wno-error=deprecated-declarations'
|
|
|
|
elif deprecation_warnings == 'ignore'
|
|
|
|
taisei_c_args += '-Wno-deprecated-declarations'
|
|
|
|
endif
|
|
|
|
|
2019-10-01 06:19:33 +02:00
|
|
|
if meson.version().version_compare('<0.50.0') and get_option('b_pch')
|
2019-02-11 09:30:00 +01:00
|
|
|
# Workaround for Meson bug: https://github.com/mesonbuild/meson/issues/4905
|
|
|
|
taisei_c_args += ['-fpch-deps']
|
|
|
|
endif
|
|
|
|
|
|
|
|
taisei_c_args = cc.get_supported_arguments(taisei_c_args)
|
2017-11-25 20:45:11 +01:00
|
|
|
|
2019-02-17 22:25:16 +01:00
|
|
|
foreach arglist : [
|
|
|
|
['-msse', '-mfpmath=sse'],
|
|
|
|
]
|
|
|
|
if cc.has_multi_arguments(arglist)
|
|
|
|
taisei_c_args += arglist
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
2019-02-20 03:55:54 +01:00
|
|
|
sm_check = run_command(check_submodules_command)
|
|
|
|
|
|
|
|
if sm_check.stdout() != ''
|
|
|
|
foreach line : sm_check.stdout().strip().split('\n')
|
|
|
|
warning(line)
|
|
|
|
endforeach
|
|
|
|
endif
|
|
|
|
|
|
|
|
if sm_check.stderr() != ''
|
|
|
|
warning('Submodule check completed with errors:\n@0@'.format(sm_check.stderr()))
|
|
|
|
endif
|
|
|
|
|
2019-08-02 20:38:33 +02:00
|
|
|
static = get_option('static') or ['emscripten', 'nx'].contains(host_machine.system())
|
2017-11-12 01:28:30 +01:00
|
|
|
|
2019-03-17 20:05:32 +01:00
|
|
|
dep_freetype = dependency('freetype2', required : true, static : static, fallback : ['freetype', 'freetype_dep'])
|
2019-03-17 19:02:45 +01:00
|
|
|
dep_png = dependency('libpng', version : '>=1.5', required : true, static : static, fallback : ['libpng', 'png_dep'])
|
2019-05-11 08:46:26 +02:00
|
|
|
dep_sdl2 = dependency('sdl2', version : '>=2.0.6', required : true, static : static, fallback : ['sdl2', 'sdl2_dep'])
|
2019-09-15 09:18:39 +02:00
|
|
|
dep_webp = dependency('libwebp', version : '>=0.5', required : true, static : static, fallback : ['libwebp', 'webpdecoder_dep'])
|
|
|
|
dep_webpdecoder = dependency('libwebpdecoder', version : '>=0.5', required : false, static : static)
|
2019-03-17 06:06:47 +01:00
|
|
|
dep_zip = dependency('libzip', version : '>=1.2', required : false, static : static, fallback : ['libzip', 'libzip_dep'])
|
2019-05-11 08:46:26 +02:00
|
|
|
dep_zlib = dependency('zlib', required : true, static : static, fallback : ['zlib', 'zlib_dep'])
|
2019-02-08 19:59:36 +01:00
|
|
|
dep_crypto = dependency('libcrypto', required : false, static : static)
|
2020-11-19 00:12:51 +01:00
|
|
|
dep_gamemode = dependency('gamemode', required : false, static : static)
|
2018-10-18 23:12:46 +02:00
|
|
|
|
2019-02-08 19:59:36 +01:00
|
|
|
dep_m = cc.find_library('m', required : false)
|
2017-11-12 01:28:30 +01:00
|
|
|
|
2020-08-15 13:51:12 +02:00
|
|
|
dep_basisu_transcoder = subproject('basis_universal').get_variable('basisu_transcoder_dep')
|
2018-06-30 22:11:54 +02:00
|
|
|
dep_cglm = subproject('cglm').get_variable('cglm_dep')
|
|
|
|
dep_glad = subproject('glad').get_variable('glad_dep')
|
2019-06-26 12:09:26 +02:00
|
|
|
dep_koishi = subproject('koishi').get_variable('koishi_dep')
|
2018-06-30 22:11:54 +02:00
|
|
|
|
2018-04-12 16:08:48 +02:00
|
|
|
taisei_deps = [
|
2020-08-15 13:51:12 +02:00
|
|
|
dep_basisu_transcoder,
|
2018-10-18 23:12:46 +02:00
|
|
|
dep_cglm,
|
2018-06-29 23:36:51 +02:00
|
|
|
dep_freetype,
|
2020-11-19 00:12:51 +01:00
|
|
|
dep_gamemode,
|
2019-06-26 12:09:26 +02:00
|
|
|
dep_koishi,
|
2018-04-12 16:08:48 +02:00
|
|
|
dep_m,
|
2018-10-18 23:12:46 +02:00
|
|
|
dep_png,
|
|
|
|
dep_sdl2,
|
|
|
|
dep_zlib,
|
2018-06-30 22:11:54 +02:00
|
|
|
# don't add glad here
|
2018-04-12 16:08:48 +02:00
|
|
|
]
|
2017-11-12 01:28:30 +01:00
|
|
|
|
2019-09-29 21:02:38 +02:00
|
|
|
if meson.version().version_compare('<0.49.0')
|
|
|
|
wrap_mode_forcefallback = false
|
|
|
|
else
|
|
|
|
wrap_mode_forcefallback = (get_option('wrap_mode') == 'forcefallback')
|
|
|
|
endif
|
|
|
|
|
|
|
|
if dep_webpdecoder.found() and not wrap_mode_forcefallback
|
2019-09-15 09:18:39 +02:00
|
|
|
# distro libwebpdecoder
|
2018-10-19 01:51:59 +02:00
|
|
|
taisei_deps += dep_webpdecoder
|
|
|
|
else
|
2019-09-15 09:18:39 +02:00
|
|
|
# either distro libwebp, or libwebpdecoder from subproject
|
|
|
|
taisei_deps += dep_webp
|
2018-10-19 01:51:59 +02:00
|
|
|
endif
|
|
|
|
|
2017-11-12 01:28:30 +01:00
|
|
|
if host_machine.system() == 'windows'
|
|
|
|
taisei_deps += cc.find_library('shlwapi')
|
|
|
|
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
|
|
|
if host_machine.system() == 'emscripten'
|
|
|
|
package_data = false
|
|
|
|
enable_zip = false
|
|
|
|
else
|
|
|
|
package_data = get_option('package_data')
|
|
|
|
enable_zip = get_option('enable_zip')
|
|
|
|
package_data = (package_data == 'auto' ? enable_zip : package_data == 'true')
|
|
|
|
endif
|
2019-01-24 21:21:08 +01:00
|
|
|
|
|
|
|
if enable_zip
|
2019-03-17 06:06:47 +01:00
|
|
|
assert(dep_zip.found(), 'ZIP support enabled but libzip not found')
|
2019-01-24 21:21:08 +01:00
|
|
|
taisei_deps += dep_zip
|
|
|
|
endif
|
|
|
|
|
|
|
|
if package_data and not enable_zip
|
|
|
|
error('ZIP support must be enabled for data packaging to work')
|
|
|
|
endif
|
|
|
|
|
2017-11-25 20:45:11 +01:00
|
|
|
config.set('TAISEI_BUILDCONF_USE_ZIP', taisei_deps.contains(dep_zip))
|
2017-11-12 01:28:30 +01:00
|
|
|
|
2019-12-14 10:03:04 +01:00
|
|
|
have_posix = cc.has_header_symbol('unistd.h', '_POSIX_VERSION')
|
|
|
|
|
|
|
|
# Feature test macros _SUCK_!
|
|
|
|
# On some platforms (FreeBSD, macOS, ...), defining _POSIX_C_SOURCE disables C11
|
|
|
|
# symbols, EVEN WHEN COMPILING IN C11 MODE! On macOS you can get around this
|
|
|
|
# with _DARWIN_C_SOURCE; on BSD you're screwed apparently. Some libCs require
|
|
|
|
# _POSIX_C_SOURCE for posix functionality (musl, glibc with __STRICT_ANSI__),
|
|
|
|
# others include everything by default, it's an inconsistent trash fire. So far
|
|
|
|
# the safest option seems to be to compile without strict conformance and only
|
|
|
|
# define _POSIX_C_SOURCE if we have to.
|
|
|
|
if have_posix
|
|
|
|
if not cc.has_header_symbol('stdio.h', 'fileno')
|
|
|
|
# No POSIX stuff by default? Then request it, and assume the libc isn't
|
|
|
|
# braindead enough to hide the standard C11 APIs.
|
|
|
|
# If it is then your system sucks.
|
|
|
|
config.set('_POSIX_C_SOURCE', '200809L')
|
|
|
|
endif
|
|
|
|
|
|
|
|
# For good measure
|
|
|
|
if host_machine.system() == 'darwin'
|
|
|
|
config.set('_DARWIN_C_SOURCE', true)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2019-02-22 00:56:48 +01:00
|
|
|
have_vla = not cc.has_header_symbol('stdlib.h', '__STDC_NO_VLA__')
|
|
|
|
have_complex = not cc.has_header_symbol('stdlib.h', '__STDC_NO_COMPLEX__')
|
2019-12-14 10:03:04 +01:00
|
|
|
have_timespec = cc.has_function('timespec_get')
|
2017-11-12 01:28:30 +01:00
|
|
|
|
2019-02-22 00:56:48 +01:00
|
|
|
assert(have_vla and have_complex, 'Your C implementation needs to support complex numbers and variable-length arrays.')
|
2017-11-12 01:28:30 +01:00
|
|
|
|
2018-05-28 10:10:41 +02:00
|
|
|
config.set('TAISEI_BUILDCONF_HAVE_TIMESPEC', have_timespec)
|
2019-01-09 04:25:10 +01:00
|
|
|
config.set('TAISEI_BUILDCONF_HAVE_INT128', cc.sizeof('__int128') == 16)
|
|
|
|
config.set('TAISEI_BUILDCONF_HAVE_LONG_DOUBLE', cc.sizeof('long double') > 8)
|
2019-02-14 22:11:27 +01:00
|
|
|
config.set('TAISEI_BUILDCONF_HAVE_POSIX', have_posix)
|
2019-07-20 15:15:51 +02:00
|
|
|
config.set('TAISEI_BUILDCONF_HAVE_SINCOS', cc.has_function('sincos', dependencies : dep_m))
|
|
|
|
|
|
|
|
if config.get('TAISEI_BUILDCONF_HAVE_SINCOS')
|
|
|
|
config.set('_GNU_SOURCE', true)
|
|
|
|
endif
|
2019-12-18 14:33:36 +01:00
|
|
|
|
|
|
|
if host_machine.system() == 'emscripten'
|
|
|
|
# Emscripten bug: https://github.com/emscripten-core/emscripten/issues/10072
|
|
|
|
config.set('TAISEI_BUILDCONF_MALLOC_ALIGNMENT', 8)
|
|
|
|
config.set('TAISEI_BUILDCONF_HAVE_MAX_ALIGN_T', false)
|
|
|
|
else
|
|
|
|
malloc_alignment = cc.alignment('max_align_t', prefix : '#include <stddef.h>\n')
|
|
|
|
config.set('TAISEI_BUILDCONF_MALLOC_ALIGNMENT', malloc_alignment)
|
|
|
|
config.set('TAISEI_BUILDCONF_HAVE_MAX_ALIGN_T', malloc_alignment > 0)
|
|
|
|
endif
|
2019-02-22 00:56:48 +01:00
|
|
|
|
2020-03-31 21:51:31 +02:00
|
|
|
config.set('TAISEI_BUILDCONF_USE_GNU_EXTENSIONS', get_option('use_gnu_ext'))
|
2020-08-15 13:51:12 +02:00
|
|
|
config.set('TAISEI_BUILDCONF_HAVE_BUILTIN_POPCOUNTLL', cc.has_function('__builtin_popcountll'))
|
|
|
|
config.set('TAISEI_BUILDCONF_HAVE_BUILTIN_POPCOUNT', cc.has_function('__builtin_popcount'))
|
2020-03-31 21:51:31 +02:00
|
|
|
|
2019-02-22 00:56:48 +01:00
|
|
|
prefer_relpath_systems = [
|
|
|
|
'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
|
|
|
]
|
|
|
|
|
|
|
|
force_relpath_systems = [
|
2019-02-22 00:56:48 +01:00
|
|
|
'emscripten',
|
2019-08-02 20:38:33 +02:00
|
|
|
'nx'
|
2019-02-22 00:56:48 +01:00
|
|
|
]
|
2018-05-28 10:10:41 +02:00
|
|
|
|
2017-11-27 14:27:32 +01:00
|
|
|
if macos_app_bundle
|
|
|
|
bundle_dir = 'Taisei.app'
|
2020-02-20 23:36:40 +01:00
|
|
|
|
|
|
|
bundle_datadir = join_paths('Contents', 'Resources')
|
|
|
|
bundle_bindir = join_paths('Contents', 'MacOS')
|
|
|
|
bundle_libdir = bundle_bindir
|
|
|
|
|
|
|
|
datadir = join_paths(bundle_dir, bundle_datadir)
|
|
|
|
bindir = join_paths(bundle_dir, bundle_bindir)
|
|
|
|
libdir = join_paths(bundle_dir, bundle_libdir)
|
|
|
|
|
|
|
|
is_relocatable_install = true
|
2017-11-27 14:27:32 +01:00
|
|
|
|
|
|
|
# arguments must be strings...
|
|
|
|
meson.add_install_script(
|
|
|
|
python3.path(),
|
|
|
|
join_paths(meson.source_root(), 'scripts', 'macos-install-dylibs.py'),
|
2019-01-24 21:21:08 +01:00
|
|
|
':'.join(meson.get_cross_property('macos_lib_path', [])),
|
|
|
|
':'.join(meson.get_cross_property('macos_tool_path', [])),
|
|
|
|
meson.get_cross_property('macos_tool_prefix', ''),
|
2017-11-27 14:27:32 +01:00
|
|
|
)
|
2017-11-12 01:28:30 +01:00
|
|
|
else
|
2017-11-27 14:27:32 +01:00
|
|
|
datadir = get_option('datadir')
|
|
|
|
|
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 force_relpath_systems.contains(host_machine.system())
|
2020-02-20 23:36:40 +01:00
|
|
|
is_relocatable_install = 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
|
|
|
elif get_option('install_relative') == 'auto'
|
2020-02-20 23:36:40 +01:00
|
|
|
is_relocatable_install = prefer_relpath_systems.contains(host_machine.system())
|
2017-11-27 14:27:32 +01:00
|
|
|
else
|
2020-02-20 23:36:40 +01:00
|
|
|
is_relocatable_install = (get_option('install_relative') == 'true')
|
2017-11-27 14:27:32 +01:00
|
|
|
endif
|
2017-12-21 05:52:25 +01:00
|
|
|
|
2020-02-20 23:36:40 +01:00
|
|
|
if is_relocatable_install
|
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
|
|
|
bindir = '.'
|
2020-02-20 23:36:40 +01:00
|
|
|
libdir = '.'
|
2017-12-21 05:52:25 +01:00
|
|
|
else
|
|
|
|
bindir = get_option('bindir')
|
2020-02-20 23:36:40 +01:00
|
|
|
libdir = get_option('libdir')
|
2017-12-21 05:52:25 +01:00
|
|
|
endif
|
2017-11-12 01:28:30 +01:00
|
|
|
endif
|
|
|
|
|
2017-11-28 14:46:28 +01:00
|
|
|
if get_option('install_freedesktop') == 'auto'
|
2020-02-20 23:36:40 +01:00
|
|
|
install_xdg = not is_relocatable_install
|
2017-11-28 14:46:28 +01:00
|
|
|
else
|
|
|
|
install_xdg = get_option('install_freedesktop') == 'true'
|
|
|
|
endif
|
|
|
|
|
2020-02-20 23:36:40 +01:00
|
|
|
if is_relocatable_install
|
2017-11-27 14:27:32 +01:00
|
|
|
data_path = 'data'
|
2019-02-22 00:56:48 +01:00
|
|
|
doc_path = '.' # Meson bug https://github.com/mesonbuild/meson/issues/4295
|
2017-11-28 14:46:28 +01:00
|
|
|
xdg_path = 'freedesktop.org'
|
2020-02-20 23:36:40 +01:00
|
|
|
lib_path = '.'
|
2017-11-12 01:28:30 +01:00
|
|
|
|
2017-12-21 05:52:25 +01:00
|
|
|
if macos_app_bundle
|
2020-02-20 23:36:40 +01:00
|
|
|
# Relative to SDL_GetBasePath() (bundle root)
|
|
|
|
config.set_quoted('TAISEI_BUILDCONF_DATA_PATH', join_paths(bundle_datadir, data_path))
|
|
|
|
config.set_quoted('TAISEI_BUILDCONF_LIB_PATH', join_paths(bundle_libdir))
|
|
|
|
|
|
|
|
# Make paths prefix-relative for installation
|
2017-11-28 14:46:28 +01:00
|
|
|
|
2020-02-20 23:36:40 +01:00
|
|
|
data_path = join_paths(datadir, data_path)
|
|
|
|
lib_path = libdir
|
2017-11-28 14:46:28 +01:00
|
|
|
# I don't know why would you do that, but more power to you
|
|
|
|
xdg_path = join_paths(datadir, xdg_path)
|
2020-02-20 23:36:40 +01:00
|
|
|
else
|
|
|
|
# Relative to SDL_GetBasePath() (typically contains the executable)
|
|
|
|
config.set_quoted('TAISEI_BUILDCONF_DATA_PATH', data_path)
|
|
|
|
config.set_quoted('TAISEI_BUILDCONF_LIB_PATH', '.')
|
2017-11-12 01:28:30 +01:00
|
|
|
endif
|
|
|
|
else
|
2017-11-27 14:27:32 +01:00
|
|
|
data_path = join_paths(datadir, 'taisei')
|
2020-02-20 23:36:40 +01:00
|
|
|
lib_path = join_paths(libdir, 'taisei')
|
2017-11-27 14:27:32 +01:00
|
|
|
doc_path = join_paths(datadir, 'doc', 'taisei')
|
2017-12-21 04:49:44 +01:00
|
|
|
xdg_path = datadir
|
2020-02-20 23:36:40 +01:00
|
|
|
|
|
|
|
# Static absolute paths
|
|
|
|
config.set_quoted('TAISEI_BUILDCONF_DATA_PATH', join_paths(get_option('prefix'), data_path))
|
|
|
|
config.set_quoted('TAISEI_BUILDCONF_LIB_PATH', join_paths(get_option('prefix'), lib_path))
|
2017-11-12 01:28:30 +01:00
|
|
|
endif
|
|
|
|
|
2020-02-20 23:36:40 +01:00
|
|
|
config.set('TAISEI_BUILDCONF_RELOCATABLE_INSTALL', is_relocatable_install)
|
2019-05-01 07:18:25 +02:00
|
|
|
config.set('TAISEI_BUILDCONF_DEBUG', is_debug_build)
|
2019-01-25 01:02:56 +01:00
|
|
|
config.set('TAISEI_BUILDCONF_DEVELOPER', is_developer_build)
|
2019-02-14 22:11:27 +01:00
|
|
|
config.set('TAISEI_BUILDCONF_LOG_FATAL_MSGBOX', (
|
|
|
|
host_machine.system() == 'windows' or
|
|
|
|
host_machine.system() == 'darwin' or
|
|
|
|
not is_developer_build
|
|
|
|
))
|
2018-01-18 18:27:03 +01:00
|
|
|
config.set('TAISEI_BUILDCONF_DEBUG_OPENGL', get_option('debug_opengl'))
|
|
|
|
|
2019-09-15 09:31:02 +02:00
|
|
|
install_docs = get_option('docs') and host_machine.system() != 'emscripten'
|
2019-02-22 00:56:48 +01:00
|
|
|
|
2017-11-12 01:28:30 +01:00
|
|
|
if host_machine.system() == 'windows'
|
2019-02-22 00:56:48 +01:00
|
|
|
if install_docs
|
|
|
|
custom_target('COPYING.txt',
|
|
|
|
command : [eolconv_command, host_eol_style, '@INPUT@', '@OUTPUT@'],
|
|
|
|
input : 'COPYING',
|
|
|
|
output : 'COPYING.txt',
|
|
|
|
install : true,
|
|
|
|
install_dir : doc_path
|
|
|
|
)
|
|
|
|
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
|
|
|
|
2017-11-12 01:28:30 +01:00
|
|
|
else
|
2019-02-22 00:56:48 +01:00
|
|
|
if install_docs
|
|
|
|
install_data('COPYING', install_dir : doc_path)
|
|
|
|
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
|
|
|
|
2020-02-20 03:16:28 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
if angle_enabled
|
|
|
|
angle_dir = 'ANGLE'
|
|
|
|
|
2020-02-20 23:36:40 +01:00
|
|
|
angle_libgles = get_option('angle_libgles')
|
|
|
|
angle_libegl = get_option('angle_libegl')
|
|
|
|
|
|
|
|
libgles_filename = angle_libgles.split('/')[-1]
|
|
|
|
libegl_filename = angle_libegl.split('/')[-1]
|
|
|
|
|
|
|
|
if build_machine.system() == 'windows'
|
|
|
|
# Windows is terrible and has TWO valid path separators
|
|
|
|
libgles_filename = angle_libgles.split('\\')[-1]
|
|
|
|
libegl_filename = angle_libegl.split('\\')[-1]
|
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
|
|
|
endif
|
2020-02-20 03:16:28 +01:00
|
|
|
|
2020-02-20 23:36:40 +01:00
|
|
|
# Where to install the libs (prefix-relative)
|
|
|
|
# Also used in docs/meson.build to install the license
|
|
|
|
angle_install_path = join_paths(lib_path, angle_dir)
|
|
|
|
|
|
|
|
# Where the game should look (either absolute or SDL_GetBasePath()-relative, depending on configuration)
|
|
|
|
angle_config_path = join_paths(config.get_unquoted('TAISEI_BUILDCONF_LIB_PATH'), angle_dir)
|
|
|
|
|
|
|
|
# use ANGLE for gles renderers by default
|
|
|
|
config.set('TAISEI_BUILDCONF_HAVE_ANGLE', true)
|
|
|
|
|
2020-02-20 03:16:28 +01:00
|
|
|
# used in gles.c for determining what libraries to use
|
2020-02-20 23:36:40 +01:00
|
|
|
config.set_quoted('TAISEI_BUILDCONF_ANGLE_GLES_PATH', join_paths(angle_config_path, libgles_filename))
|
|
|
|
config.set_quoted('TAISEI_BUILDCONF_ANGLE_EGL_PATH', join_paths(angle_config_path, libegl_filename))
|
|
|
|
|
|
|
|
if host_machine.system() == 'windows'
|
|
|
|
# Direct Intel iGPU users to the ANGLE fallback on Windows
|
|
|
|
config.set('TAISEI_BUILDCONF_WINDOWS_ANGLE_INTEL', true)
|
|
|
|
endif
|
2020-02-20 03:16:28 +01:00
|
|
|
|
|
|
|
install_data(
|
2020-02-20 23:36:40 +01:00
|
|
|
angle_libgles,
|
|
|
|
angle_libegl,
|
|
|
|
install_dir : angle_install_path,
|
2020-02-20 03:16:28 +01:00
|
|
|
)
|
2017-11-12 01:28:30 +01:00
|
|
|
endif
|
|
|
|
|
2020-02-20 23:36:40 +01:00
|
|
|
pathconv_args = ['--escape-backslashes']
|
|
|
|
|
|
|
|
if build_machine.system() == 'windows'
|
|
|
|
pathconv_args += '--from-windows'
|
|
|
|
endif
|
|
|
|
|
|
|
|
if host_machine.system() == 'windows'
|
|
|
|
pathconv_args += '--to-windows'
|
|
|
|
endif
|
|
|
|
|
|
|
|
foreach pathvar : [
|
|
|
|
'TAISEI_BUILDCONF_ANGLE_EGL_PATH',
|
|
|
|
'TAISEI_BUILDCONF_ANGLE_GLES_PATH',
|
|
|
|
'TAISEI_BUILDCONF_DATA_PATH',
|
|
|
|
'TAISEI_BUILDCONF_LIB_PATH',
|
|
|
|
]
|
|
|
|
if config.has(pathvar)
|
|
|
|
p = config.get_unquoted(pathvar)
|
|
|
|
r = run_command(fix_path_command, pathconv_args, p, check : true)
|
|
|
|
assert(r.returncode() == 0, 'path-correction script failed')
|
|
|
|
p = r.stdout()
|
|
|
|
# message('@0@ = @1@'.format(pathvar, p))
|
|
|
|
config.set_quoted(pathvar, p)
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
2017-11-27 14:27:32 +01:00
|
|
|
systype = (have_posix ? 'POSIX (@0@)' : '@0@').format(host_machine.system())
|
|
|
|
systype = '@0@, @1@, @2@'.format(systype, host_machine.cpu_family(), host_machine.cpu())
|
|
|
|
|
2019-01-24 21:21:08 +01:00
|
|
|
if meson.is_cross_build()
|
|
|
|
systype = '@0@ (cross-compiling)'.format(systype)
|
|
|
|
endif
|
|
|
|
|
2019-03-05 20:43:01 +01:00
|
|
|
version_deps = []
|
2019-04-19 22:40:39 +02:00
|
|
|
bindist_deps = []
|
2017-11-27 14:27:32 +01:00
|
|
|
|
2019-03-05 20:43:01 +01:00
|
|
|
subdir('misc')
|
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('emscripten')
|
2019-08-02 20:38:33 +02:00
|
|
|
subdir('switch')
|
2019-03-05 20:43:01 +01:00
|
|
|
subdir('external')
|
|
|
|
subdir('resources')
|
|
|
|
subdir('doc')
|
|
|
|
subdir('xdg')
|
|
|
|
subdir('atlas')
|
|
|
|
subdir('src')
|
2017-11-12 01:28:30 +01:00
|
|
|
|
2019-04-19 22:40:39 +02:00
|
|
|
if macos_app_bundle
|
|
|
|
dmg_target = run_target('dmg',
|
|
|
|
command : dmg_command,
|
|
|
|
depends : bindist_deps,
|
|
|
|
)
|
|
|
|
endif
|
|
|
|
|
|
|
|
if host_machine.system() == 'windows'
|
|
|
|
nsis_target = run_target('nsis',
|
|
|
|
command : nsis_command,
|
|
|
|
depends : bindist_deps,
|
|
|
|
)
|
|
|
|
endif
|
|
|
|
|
2019-09-24 00:27:57 +02:00
|
|
|
bindist_targets = ['zip', 'tar', 'txz', 'tgz', 'tbz']
|
|
|
|
|
|
|
|
foreach bindist_target : bindist_targets
|
|
|
|
run_target(bindist_target,
|
|
|
|
command : get_variable('@0@_command'.format(bindist_target)),
|
|
|
|
depends : bindist_deps,
|
|
|
|
)
|
|
|
|
endforeach
|
2019-04-19 22:40:39 +02:00
|
|
|
|
2019-03-05 20:43:01 +01:00
|
|
|
summary = '''
|
2017-11-12 01:28:30 +01:00
|
|
|
|
2019-03-05 20:43:01 +01:00
|
|
|
Summary:
|
|
|
|
Taisei version: @0@
|
|
|
|
System type: @1@
|
|
|
|
Build type: @2@
|
2019-05-01 07:18:25 +02:00
|
|
|
Developer mode: @15@
|
2019-03-05 20:43:01 +01:00
|
|
|
|
|
|
|
Audio backends: @3@ (default: @4@)
|
|
|
|
Renderers: @5@ (default: @6@)
|
|
|
|
Shader translation: @7@
|
|
|
|
ZIP support: @8@
|
|
|
|
Package data: @9@
|
|
|
|
|
|
|
|
Relative install paths: @10@
|
|
|
|
Prefix: @11@
|
|
|
|
Executables: @12@
|
|
|
|
Data: @13@
|
|
|
|
Documentation: @14@
|
2017-11-12 01:28:30 +01:00
|
|
|
'''.format(
|
2019-03-05 20:43:01 +01:00
|
|
|
taisei_version_string,
|
2017-11-12 01:28:30 +01:00
|
|
|
systype,
|
2019-03-05 20:43:01 +01:00
|
|
|
get_option('buildtype'),
|
|
|
|
|
|
|
|
', '.join(enabled_audio_backends),
|
|
|
|
get_option('a_default'),
|
|
|
|
', '.join(enabled_renderers),
|
2019-08-02 20:38:33 +02:00
|
|
|
default_renderer,
|
2019-03-05 20:43:01 +01:00
|
|
|
get_option('shader_transpiler'),
|
|
|
|
enable_zip,
|
|
|
|
package_data,
|
|
|
|
|
2020-02-20 23:36:40 +01:00
|
|
|
is_relocatable_install,
|
2017-11-12 01:28:30 +01:00
|
|
|
get_option('prefix'),
|
2017-11-28 14:46:28 +01:00
|
|
|
# the $ is intentional
|
|
|
|
join_paths('$prefix', bindir),
|
|
|
|
join_paths('$prefix', data_path),
|
2019-05-01 07:18:25 +02:00
|
|
|
join_paths('$prefix', doc_path),
|
|
|
|
is_developer_build
|
2017-11-12 01:28:30 +01:00
|
|
|
)
|
|
|
|
|
2017-11-25 20:45:11 +01:00
|
|
|
message(summary)
|
2019-02-20 03:55:54 +01:00
|
|
|
|
|
|
|
run_command(postconf_command)
|