meson: Cleanups

This commit is contained in:
Sophie Herold 2024-07-17 13:28:14 +02:00
parent 895babbe82
commit 9b56f30c3b
2 changed files with 15 additions and 28 deletions

View file

@ -47,11 +47,6 @@ base_id = 'org.gnome.Loupe'
app_id = 'org.gnome.Loupe@0@'.format(profile)
iv_version = meson.project_version() + version_suffix
cargo_sources = files(
'Cargo.lock',
'Cargo.toml',
)
conf = configuration_data()
conf.set('APP_ID', app_id)
conf.set('PROFILE', profile)
@ -66,12 +61,6 @@ subdir('help')
subdir('src')
subdir('po')
# Pre-commit hook for rust formatting
if get_option('profile') == 'development'
message('Setting up git pre-commit hook..')
run_command('cp', '-f', 'hooks/pre-commit.hook', '.git/hooks/pre-commit', check: false)
endif
gnome.post_install(
gtk_update_icon_cache: true,
update_desktop_database: true,

View file

@ -1,8 +1,4 @@
configure_file(
input: 'config.rs.in',
output: 'config.rs',
configuration: conf
)
configure_file(input: 'config.rs.in', output: 'config.rs', configuration: conf)
build_root = meson.project_build_root()
source_root = meson.project_source_root()
@ -12,26 +8,26 @@ run_command(
'cp',
build_root / 'src' / 'config.rs',
source_root / 'src' / 'config.rs',
check: true
check: true,
)
cargo_options = [ '--manifest-path', source_root / 'Cargo.toml' ]
cargo_options += [ '--target-dir', build_root / 'src' ]
cargo_options = ['--manifest-path', source_root / 'Cargo.toml']
cargo_options += ['--target-dir', build_root / 'src']
if get_option('profile') == 'development'
rust_target = 'debug'
message('Building in debug mode')
else
cargo_options += [ '--release' ]
cargo_options += ['--release']
rust_target = 'release'
message('Building in release mode')
endif
if gtk4_x11.found()
cargo_options += [ '--features', 'x11' ]
cargo_options += ['--features', 'x11']
endif
cargo_env = { 'CARGO_HOME': build_root / 'cargo-home' }
cargo_env = {'CARGO_HOME': build_root / 'cargo-home'}
cargo_build = custom_target(
'cargo-build',
@ -41,12 +37,13 @@ cargo_build = custom_target(
console: true,
env: cargo_env,
command: [
cargo, 'build',
cargo,
'build',
cargo_options,
]
],
)
copy_binary = custom_target(
custom_target(
'cp-binary',
depends: cargo_build,
build_by_default: true,
@ -61,14 +58,15 @@ copy_binary = custom_target(
],
)
cargo_doc = custom_target(
custom_target(
'cargo-doc',
build_by_default: false,
build_always_stale: true,
output: 'doc',
console: true,
command: [
cargo, 'doc',
cargo,
'doc',
cargo_options + ['--no-deps', '--document-private-items'],
],
)
@ -84,4 +82,4 @@ test(
],
is_parallel: false,
timeout: 1800,
)
)