xref: /aosp_15_r20/external/crosvm/rutabaga_gfx/kumquat/gpu_client/meson.build (revision bb4ee6a4ae7042d18b07a98463b9c8b875e44b39)
1# Copyright 2024 The ChromiumOS Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5project('virtgpu_kumquat_ffi', ['rust', 'c'],
6         version: '0.1.3')
7
8target_os = host_machine.system()
9
10if target_os == 'windows'
11  shared_lib = 'virtgpu_kumquat_ffi.dll'
12endif
13if target_os == 'darwin'
14  shared_lib = 'libvirtgpu_kumquat_ffi.dylib'
15endif
16if target_os == 'linux'
17  shared_lib = 'libvirtgpu_kumquat_ffi.so'
18endif
19
20shared_lib_major = '@[email protected]'.format(shared_lib)
21shared_lib_full_ver = '@0@.@1@'.format(shared_lib, meson.project_version())
22
23build_script = find_program('build.sh')
24
25buildtype = 'debug'
26cargo_release = ''
27if get_option('buildtype') == 'release'
28  buildtype = 'release'
29  cargo_release = '--release'
30endif
31
32virtgpu_kumquat_ffi_ct = custom_target(
33  'virtgpu_kumquat_ffi_build',
34  output: [shared_lib, shared_lib_major, shared_lib_full_ver],
35  input: ['src/lib.rs', 'Cargo.toml', 'build.sh'],
36  command: [build_script, meson.current_build_dir(), shared_lib,
37            meson.project_version(), buildtype, cargo_release],
38  install: true,
39  install_dir: get_option('libdir'),
40)
41
42pkg = import('pkgconfig')
43pkg.generate(
44  libraries: '-L${libdir} -lvirtgpu_kumquat_ffi',
45  name: 'virtgpu_kumquat_ffi',
46  version: meson.project_version(),
47  description: 'C FFI bindings to Rutabaga VGI',
48)
49
50virtgpu_kumquat_ffi_h = files('src/include/virtgpu_kumquat_ffi.h')
51install_headers(virtgpu_kumquat_ffi_h,
52                subdir: 'virtgpu_kumquat')
53