audrey/meson.build

75 lines
1.8 KiB
Meson
Raw Normal View History

2024-10-15 20:51:13 +00:00
project(
'audrey',
2024-11-03 19:02:07 +00:00
'c',
2024-10-15 20:51:13 +00:00
version: '0.1.0', # AUDREY_VERSION
meson_version: '>= 1.1.0',
2024-10-15 20:51:13 +00:00
default_options: ['warning_level=0', 'werror=false'],
2024-10-06 11:21:53 +00:00
)
gnome = import('gnome')
2024-11-13 21:55:10 +00:00
i18n = import('i18n')
cc = meson.get_compiler('c')
2024-10-06 11:21:53 +00:00
srcdir = meson.project_source_root() / 'src'
config_h = configuration_data()
2024-10-15 20:51:13 +00:00
config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
2024-10-12 20:52:29 +00:00
config_h.set_quoted('GETTEXT_PACKAGE', 'audrey')
2024-10-06 11:21:53 +00:00
config_h.set_quoted('LOCALEDIR', get_option('prefix') / get_option('localedir'))
configure_file(output: 'config.h', configuration: config_h)
2024-10-15 20:51:13 +00:00
add_project_arguments(
[
'-DGETTEXT_PACKAGE="' + meson.project_name() + '"',
'-DG_LOG_DOMAIN="audrey"',
],
2024-10-15 20:51:13 +00:00
language: 'c',
)
2024-10-06 11:21:53 +00:00
add_project_arguments(
2024-10-18 00:39:17 +00:00
cc.get_supported_arguments(
['-Wno-tautological-pointer-compare', '-Wno-unused-value'],
),
language: 'c',
)
2024-10-06 11:21:53 +00:00
subdir('data')
subdir('po')
subdir('resources')
2024-10-29 10:46:58 +00:00
subdir('src')
2024-10-06 11:21:53 +00:00
2024-11-25 17:08:11 +00:00
cargo = find_program('cargo')
cargo_env = environment()
2024-10-29 18:13:49 +00:00
if get_option('buildtype') == 'debug'
2024-11-25 17:08:11 +00:00
cargo_args = []
cargo_env.append('RUSTFLAGS', '-Cforce-frame-pointers=true', separator: ' ')
2024-10-29 18:13:49 +00:00
else
2024-11-25 17:08:11 +00:00
cargo_args = ['--release']
extra_rustflags = []
2024-10-29 18:13:49 +00:00
endif
if get_option('moldy')
cargo_env.append('RUSTFLAGS', '-Clink-arg=-fuse-ld=mold', separator: ' ')
endif
2024-10-29 18:44:40 +00:00
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')
2024-11-19 17:25:25 +00:00
dev_env = cargo_env
dev_env.set('RUST_BACKTRACE', 'full')
meson.add_devenv(dev_env)
2024-10-29 18:44:40 +00:00
2024-10-29 10:37:15 +00:00
custom_target(
'cargo-build',
build_by_default: true,
build_always_stale: true,
depends: blueprints,
2024-10-30 08:05:10 +00:00
input: config_rs,
2024-10-29 18:13:49 +00:00
console: true,
2024-10-29 18:44:40 +00:00
# means nothing (always stale and uncopied), we can't cp since env: drops the /bin/sh wrapper
2024-10-29 10:37:15 +00:00
output: meson.project_name(),
2024-11-25 17:08:11 +00:00
command: [cargo, 'build', cargo_args],
2024-10-29 18:44:40 +00:00
env: cargo_env,
2024-10-06 11:21:53 +00:00
)