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.
This commit is contained in:
Andrei Alexeyev 2022-12-12 01:50:08 +01:00
parent 4cf14eeb3d
commit f9a3fbc729
No known key found for this signature in database
GPG key ID: 72D26128040B9690
7 changed files with 63 additions and 94 deletions

View file

@ -33,7 +33,7 @@ Build-Time Dependenices
"""""""""""""""""""""""
- ``gcc`` or ``clang``
- meson >= 0.53.0 (0.56.2 recommended)
- meson >= 0.56.2
- Python >= 3.6
- `python-zstandard <https://github.com/indygreg/python-zstandard>`__ >= 0.11.1
- `python-docutils <https://pypi.org/project/docutils/>`__ (optional, for generating documentation)

View file

@ -1,7 +1,7 @@
project('taisei', 'c',
license : 'MIT',
version : 'v1.4-dev',
meson_version : '>=0.53.0',
meson_version : '>=0.56.2',
default_options : [
'c_std=gnu11',
@ -136,11 +136,6 @@ elif deprecation_warnings == 'ignore'
taisei_c_args += '-Wno-deprecated-declarations'
endif
if meson.version().version_compare('<0.50.0') and get_option('b_pch')
# 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)
foreach arglist : [
@ -151,7 +146,7 @@ foreach arglist : [
endif
endforeach
sm_check = run_command(check_submodules_command)
sm_check = run_command(check_submodules_command, check : false)
if sm_check.stdout() != ''
foreach line : sm_check.stdout().strip().split('\n')
@ -197,11 +192,7 @@ taisei_deps = [
# don't add glad here
]
if meson.version().version_compare('<0.49.0')
wrap_mode_forcefallback = false
else
wrap_mode_forcefallback = (get_option('wrap_mode') == 'forcefallback')
endif
wrap_mode_forcefallback = (get_option('wrap_mode') == 'forcefallback')
if dep_webpdecoder.found() and not wrap_mode_forcefallback
# distro libwebpdecoder
@ -518,7 +509,7 @@ config.set('TAISEI_BUILDCONF_TESTING_STAGES', use_testing_stages)
# Stolen from Sway
# Compute the relative path used by compiler invocations.
source_root = meson.current_source_dir().split('/')
build_root = meson.build_root().split('/')
build_root = meson.project_build_root().split('/')
if build_machine.system() == 'windows'
source_root = source_root.replace('\\', '/')
build_root = build_root.replace('\\', '/')
@ -632,4 +623,4 @@ Summary:
message(summary)
run_command(postconf_command)
run_command(postconf_command, check : false)

View file

@ -184,7 +184,8 @@ if validate_glsl != 'false'
glslc_frag_args,
glslc_test_uniform_location_file,
'-o', '-',
capture : false
capture : false,
check : false
)
if test_result.returncode() == 0
@ -199,7 +200,8 @@ if validate_glsl != 'false'
glslc_frag_args,
glslc_test_basic_file,
'-o', '-',
capture : false
capture : false,
check : false
)
if test_result.returncode() == 0

View file

@ -65,8 +65,7 @@ foreach pkg : packages
var_files = 'em_bundle_@0@_files'.format(bundle)
var_packer_args = 'em_bundle_@0@_packer_args'.format(bundle)
glob_result = run_command(glob_command, pkg_path, get_variable(var_patterns))
assert(glob_result.returncode() == 0, 'Glob script failed')
glob_result = run_command(glob_command, pkg_path, get_variable(var_patterns), check : true)
foreach file : glob_result.stdout().strip().split('\n')
if file != ''
@ -95,8 +94,7 @@ foreach pkg : packages
console : true,
)
else
glob_result = run_command(glob_command, pkg_path, '**/meson.build')
assert(glob_result.returncode() == 0, 'Glob script failed')
glob_result = run_command(glob_command, pkg_path, '**/meson.build', check : true)
install_subdir(pkg_pkgdir, install_dir : data_path, exclude_files : glob_result.stdout().split('\n'))
endif
endforeach
@ -122,8 +120,7 @@ if host_machine.system() == 'nx'
console : true,
)
else
glob_result = run_command(glob_command, shaders_build_dir, '**/*.spv', '**/meson.build')
assert(glob_result.returncode() == 0, 'Glob script failed')
glob_result = run_command(glob_command, shaders_build_dir, '**/*.spv', '**/meson.build', check : true)
install_subdir(shaders_build_dir, install_dir : data_path, exclude_files : glob_result.stdout().split('\n'))
endif
endif

View file

@ -3,23 +3,19 @@ ver_fb = get_option('version_fallback').strip()
version_fallback = ver_fb != '' ? ver_fb : meson.project_version()
common_taiseilib_args = [
'--rootdir', meson.source_root(),
'--rootdir', meson.project_source_root(),
'--fallback-version', version_fallback
]
common_taiseilib_defs = [
'-DMESON_BUILD_ROOT=@0@'.format(meson.build_root()),
'-DMESON_SOURCE_ROOT=@0@'.format(meson.source_root()),
'-DMESON_BUILD_ROOT=@0@'.format(meson.project_build_root()),
'-DMESON_SOURCE_ROOT=@0@'.format(meson.project_source_root()),
]
# Workaround for Meson bug: https://github.com/mesonbuild/meson/issues/4947
python_thunk = find_program(files('thunk.py'))
version_script = find_program(files('version.py'))
version_command = [version_script, common_taiseilib_args]
version_script = files('version.py')
version_command = [python_thunk, version_script, common_taiseilib_args]
taisei_version_result = run_command(version_command, '{string}')
assert(taisei_version_result.returncode() == 0, 'Version script failed')
taisei_version_result = run_command(version_command, '{string}', check : true)
if taisei_version_result.stderr() != ''
warning(taisei_version_result.stderr().strip())
@ -27,20 +23,18 @@ endif
taisei_version_string = taisei_version_result.stdout().strip()
preprocess_script = files('configure-file.py')
# generators are string supremacists apparently...
preprocess_script_path = join_paths(meson.source_root(), '@0@'.format(preprocess_script[0]))
preprocess_args = [preprocess_script_path] + common_taiseilib_args + common_taiseilib_defs
preprocess_command = [python_thunk, preprocess_args]
preprocess_script = find_program(files('configure-file.py'))
preprocess_args = common_taiseilib_args + common_taiseilib_defs
preprocess_command = [preprocess_script, preprocess_args]
preprocessor = generator(preprocess_command[0],
preprocessor = generator(preprocess_script,
arguments: preprocess_args + ['@EXTRA_ARGS@', '--depfile', '@DEPFILE@', '@INPUT@', '@OUTPUT@'],
output: '@BASENAME@',
depfile: '@BASENAME@.d',
)
eolconv_script = files('eolconv.py')
eolconv_command = [python_thunk, eolconv_script]
eolconv_script = find_program(files('eolconv.py'))
eolconv_command = [eolconv_script]
package_system_name = host_machine.system()
@ -62,39 +56,39 @@ if is_debug_build
dist_version_string = '@0@-debug'.format(dist_version_string)
endif
dist_script = files('gen-dist.py')
dist_script = find_program(files('gen-dist.py'))
dist_name = 'Taisei-@0@-@1@-@2@'.format(dist_version_string, package_system_name, host_machine.cpu_family())
dist_command = [python_thunk, dist_script, common_taiseilib_args]
dist_command = [dist_script, common_taiseilib_args]
dist_prefix_args = ['--prefix=@0@'.format(dist_name)]
zip_filename = '@0@.zip'.format(dist_name)
zip_outpath = join_paths(meson.build_root(), zip_filename)
zip_command = [dist_command, '--format=zip', meson.build_root(), zip_outpath]
zip_outpath = join_paths(meson.project_build_root(), zip_filename)
zip_command = [dist_command, '--format=zip', meson.project_build_root(), zip_outpath]
txz_filename = '@0@.tar.xz'.format(dist_name)
txz_outpath = join_paths(meson.build_root(), txz_filename)
txz_command = [dist_command, '--format=xztar', dist_prefix_args, meson.build_root(), txz_outpath]
txz_outpath = join_paths(meson.project_build_root(), txz_filename)
txz_command = [dist_command, '--format=xztar', dist_prefix_args, meson.project_build_root(), txz_outpath]
tgz_filename = '@0@.tar.gz'.format(dist_name)
tgz_outpath = join_paths(meson.build_root(), tgz_filename)
tgz_command = [dist_command, '--format=gztar', dist_prefix_args, meson.build_root(), tgz_outpath]
tgz_outpath = join_paths(meson.project_build_root(), tgz_filename)
tgz_command = [dist_command, '--format=gztar', dist_prefix_args, meson.project_build_root(), tgz_outpath]
tbz_filename = '@0@.tar.bz2'.format(dist_name)
tbz_outpath = join_paths(meson.build_root(), tbz_filename)
tbz_command = [dist_command, '--format=bztar', dist_prefix_args, meson.build_root(), tbz_outpath]
tbz_outpath = join_paths(meson.project_build_root(), tbz_filename)
tbz_command = [dist_command, '--format=bztar', dist_prefix_args, meson.project_build_root(), tbz_outpath]
tar_filename = '@0@.tar'.format(dist_name)
tar_outpath = join_paths(meson.build_root(), tar_filename)
tar_command = [dist_command, '--format=tar', dist_prefix_args, meson.build_root(), tar_outpath]
tar_outpath = join_paths(meson.project_build_root(), tar_filename)
tar_command = [dist_command, '--format=tar', dist_prefix_args, meson.project_build_root(), tar_outpath]
dmg_script = files('macos-gen-dmg.py')
dmg_script = find_program(files('macos-gen-dmg.py'))
dmg_filename = '@0@.dmg'.format(dist_name)
dmg_command = [python_thunk, dmg_script, join_paths(meson.build_root(), dmg_filename), meson.build_root()]
dmg_command = [dmg_script, join_paths(meson.project_build_root(), dmg_filename), meson.project_build_root()]
angle_enabled = get_option('install_angle')
if package_system_name == 'windows'
nsis_script = files('win-gen-nsis.py')
nsis_script = find_program(files('win-gen-nsis.py'))
nsis_filename = 'Taisei-@0@-setup-@1@.exe'.format(dist_version_string, host_machine.cpu_family())
nsis_outpath = join_paths(meson.build_root(), nsis_filename)
@ -115,7 +109,6 @@ if package_system_name == 'windows'
endif
nsis_command = [
python_thunk,
nsis_script,
common_taiseilib_args,
common_taiseilib_defs,
@ -125,33 +118,33 @@ if package_system_name == 'windows'
]
endif
gen_atlas_script = files('gen-atlas.py')
gen_atlas_command = [python_thunk, gen_atlas_script]
gen_atlas_script = find_program(files('gen-atlas.py'))
gen_atlas_command = [gen_atlas_script]
gen_atlases_script = files('gen-atlases.py')
gen_atlases_command = [python_thunk, gen_atlases_script]
gen_atlases_script = find_program(files('gen-atlases.py'))
gen_atlases_command = [gen_atlases_script]
upkeep_script = files('upkeep.py')
upkeep_command = [python_thunk, upkeep_script, common_taiseilib_args]
upkeep_script = find_program(files('upkeep.py'))
upkeep_command = [upkeep_script, common_taiseilib_args]
upkeep_target = run_target('upkeep', command: upkeep_command)
postconf_script = files('dump-build-options.py')
postconf_command = [python_thunk, postconf_script]
postconf_script = find_program(files('dump-build-options.py'))
postconf_command = [postconf_script]
pack_script = files('pack.py')
pack_command = [python_thunk, pack_script, common_taiseilib_args]
pack_script = find_program(files('pack.py'))
pack_command = [pack_script, common_taiseilib_args]
glob_script = files('glob-search.py')
glob_command = [python_thunk, glob_script]
glob_script = find_program(files('glob-search.py'))
glob_command = [glob_script]
check_submodules_script = files('check-submodules.py')
check_submodules_command = [python_thunk, check_submodules_script]
check_submodules_script = find_program(files('check-submodules.py'))
check_submodules_command = [check_submodules_script]
em_set_bundle_uuid_script = files('em-set-bundle-uuid.py')
em_set_bundle_uuid_command = [python_thunk, em_set_bundle_uuid_script]
em_set_bundle_uuid_script = find_program(files('em-set-bundle-uuid.py'))
em_set_bundle_uuid_command = [em_set_bundle_uuid_script]
fix_path_script = files('unfuck-path.py')
fix_path_command = [python_thunk, fix_path_script]
fix_path_script = find_program(files('unfuck-path.py'))
fix_path_command = [fix_path_script]
format_array_script = files('format-array.py')
format_array_command = [python_thunk, format_array_script]
format_array_script = find_program(files('format-array.py'))
format_array_command = [format_array_script]

View file

@ -1,10 +0,0 @@
#!/usr/bin/env python3
import os
import sys
import runpy
assert len(sys.argv) > 1
sys.argv = sys.argv[1:]
sys.path.insert(0, os.path.dirname(sys.argv[0]))
runpy.run_path(sys.argv[0], run_name='__main__')

View file

@ -445,19 +445,15 @@ elif host_machine.system() == 'nx'
taisei_nro_name = '@0@.nro'.format(taisei_basename)
taisei_nro = custom_target(taisei_nro_name,
# NOTE: Unfortunately we can't just put 'taisei_elf' directly into the command array.
# Meson then makes an invalid assumption that we are going to execute it ("use as a generator"),
# and aborts because there's no exe wrapper in the cross file (which wouldn't make sense to have).
command : [
find_program('elf2nro'),
taisei_elf.full_path(), # workaround for the above issue
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,
depends : [taisei_elf, taisei_nacp],
depends : [taisei_nacp],
install : true,
install_dir : bindir,
output : taisei_nro_name,
@ -468,7 +464,7 @@ else
dependencies : taisei_deps,
c_args : taisei_c_args,
c_pch : 'pch/taisei_pch.h',
gui_app : not get_option('win_console'),
win_subsystem : get_option('win_console') ? 'console' : 'windows',
install : true,
install_dir : bindir,
export_dynamic : stages_live_reload,