85 lines
2 KiB
Meson
85 lines
2 KiB
Meson
project(
|
|
'audrey',
|
|
['c', 'vala'],
|
|
version: '0.1.0', # AUDREY_VERSION
|
|
meson_version: '>= 1.0.0',
|
|
default_options: ['warning_level=0', 'werror=false'],
|
|
)
|
|
|
|
i18n = import('i18n')
|
|
gnome = import('gnome')
|
|
fs = import('fs')
|
|
cc = meson.get_compiler('c')
|
|
valac = meson.get_compiler('vala')
|
|
|
|
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)
|
|
|
|
config_dep = valac.find_library('config', dirs: srcdir)
|
|
config_inc = include_directories('.')
|
|
|
|
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')
|
|
|
|
if get_option('buildtype') == 'debug'
|
|
rust_args = []
|
|
rust_target = 'debug'
|
|
else
|
|
rust_args = ['--release']
|
|
rust_target = 'release'
|
|
endif
|
|
|
|
cargo = find_program('cargo')
|
|
cargo_env = environment()
|
|
cargo_env.set('MESON_BUILD_ROOT', meson.project_build_root())
|
|
cargo_env.append(
|
|
'RUSTFLAGS',
|
|
'-L ' + fs.parent(audrey_c.full_path()),
|
|
separator: ' ',
|
|
)
|
|
|
|
custom_target(
|
|
'cargo-build',
|
|
build_by_default: true,
|
|
build_always_stale: true,
|
|
depends: [audrey_c, 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',
|
|
rust_args,
|
|
'--manifest-path',
|
|
meson.project_source_root() / 'Cargo.toml',
|
|
'--target-dir',
|
|
meson.project_build_root() / 'cargo-target',
|
|
],
|
|
env: cargo_env,
|
|
)
|
|
|
|
run_target('clippy', command: [cargo, 'clippy'], env: cargo_env)
|
|
run_target('cargo-doc', command: [cargo, 'doc'], env: cargo_env)
|