wasm support

This commit is contained in:
T0b1
2023-04-28 20:41:17 +02:00
parent e2480e9f85
commit 9263c3d6b2
2 changed files with 14 additions and 5 deletions

View File

@@ -11,6 +11,12 @@ if not py_version.version_compare('>=3.6')
endif
cc = meson.get_compiler('c')
if get_option('wasm_build')
add_project_arguments('--target=wasm32', language: 'c')
add_project_arguments(['-nostdlib', '-fvisibility=default'], language: 'c')
endif
if cc.has_argument('-fstrict-aliasing')
add_project_arguments('-fstrict-aliasing', language: 'c')
endif
@@ -99,11 +105,13 @@ fadec = declare_dependency(link_with: libfadec,
sources: tables)
install_headers(headers)
foreach component : components
test(component, executable('@0@-test'.format(component),
'@0@-test.c'.format(component),
dependencies: fadec))
endforeach
if get_option('wasm_build') == false
foreach component : components
test(component, executable('@0@-test'.format(component),
'@0@-test.c'.format(component),
dependencies: fadec))
endforeach
endif
if meson.version().version_compare('>=0.54.0')
meson.override_dependency('fadec', fadec)

View File

@@ -4,3 +4,4 @@ option('with_decode', type: 'boolean', value: true)
option('with_encode', type: 'boolean', value: true)
# encode2 is off-by-default to reduce size and compile-time
option('with_encode2', type: 'boolean', value: false)
option('wasm_build', type: 'boolean', value: false)