audrey/meson.build
2024-11-27 23:55:34 +01:00

74 lines
1.8 KiB
Meson

project(
'audrey',
'c',
version: '0.1.0', # AUDREY_VERSION
meson_version: '>= 1.0.0',
default_options: ['warning_level=0', 'werror=false'],
)
gnome = import('gnome')
i18n = import('i18n')
cc = meson.get_compiler('c')
srcdir = meson.project_source_root() / 'src'
config_h = configuration_data()
config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
config_h.set_quoted('GETTEXT_PACKAGE', 'audrey')
config_h.set_quoted('LOCALEDIR', get_option('prefix') / get_option('localedir'))
configure_file(output: 'config.h', configuration: config_h)
add_project_arguments(
[
'-DGETTEXT_PACKAGE="' + meson.project_name() + '"',
'-DG_LOG_DOMAIN="audrey"',
],
language: 'c',
)
add_project_arguments(
cc.get_supported_arguments(
['-Wno-tautological-pointer-compare', '-Wno-unused-value'],
),
language: 'c',
)
subdir('data')
subdir('po')
subdir('resources')
subdir('src')
cargo = find_program('cargo')
cargo_env = environment()
if get_option('buildtype') == 'debug'
cargo_args = []
cargo_env.append('RUSTFLAGS', '-Cforce-frame-pointers=true', separator: ' ')
else
cargo_args = ['--release']
extra_rustflags = []
endif
if get_option('moldy')
cargo_env.append('RUSTFLAGS', '-Clink-arg=-fuse-ld=mold', separator: ' ')
endif
cargo_env.set('MESON_BUILD_ROOT', meson.project_build_root())
cargo_env.set('CARGO_MANIFEST_DIR', meson.project_source_root())
cargo_env.set('CARGO_TARGET_DIR', meson.project_build_root() / 'target')
dev_env = cargo_env
dev_env.set('RUST_BACKTRACE', 'full')
meson.add_devenv(dev_env)
custom_target(
'cargo-build',
build_by_default: true,
build_always_stale: true,
depends: blueprints,
input: config_rs,
console: true,
# means nothing (always stale and uncopied), we can't cp since env: drops the /bin/sh wrapper
output: meson.project_name(),
command: [cargo, 'build', cargo_args],
env: cargo_env,
)