summary refs log tree commit diff
path: root/src/meson.build
blob: 3bc0c3f6ad811d4267123fe230145d5808c14df6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
cargo_options = [ '--manifest-path', meson.project_source_root() / 'Cargo.toml' ]
cargo_options += [ '--target-dir', meson.project_build_root() / 'src' ]

if get_option('profile') == 'default'
  cargo_options += [ '--release' ]
  rust_target = 'release'
  message('Building in release mode')
else
  rust_target = 'debug'
  message('Building in debug mode')
endif

cargo_options += [ '--no-default-features' ]

if get_option('llm')
  cargo_options += [ '--features=smart-summary' ]
endif

cargo_env = [
    'CARGO_HOME=' + meson.project_build_root() / 'cargo-home',
    'PKGDATADIR=' + pkgdatadir,
    'LOCALEDIR=' + localedir,
]

cargo_build = custom_target(
  'cargo-build',
  build_by_default: true,
  build_always_stale: true,
  output: meson.project_name(),
  console: true,
  install: true,
  install_dir: bindir,
  #depends: resources,
  command: [
    'env',
    cargo_env,
    cargo, 'build',
    cargo_options,
    '&&',
    'cp', 'src' / rust_target / meson.project_name(), '@OUTPUT@',
  ]
)