mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-24 12:34:31 +00:00
075c7bf647
The library installed by Meson actually contains no symbols right now. We have to: 1) Have Cargo place the libraries in the Meson build dir 2) Move the libraries from ${MESON_BUILD_DIR}/debug (where Cargo places them) to ${MESON_BUILD_DIR} sp Meson custom target script can reference them 3) Have meson install the libraries and generate pkg-config BUG=b:344998548 TEST=link against FFI via gfxstream guest Change-Id: I6536674fdb6ee3493433bf48ed233d6ca947e9aa Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5631146 Reviewed-by: Kaiyi Li <kaiyili@google.com> Auto-Submit: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
59 lines
1.7 KiB
Meson
59 lines
1.7 KiB
Meson
# Copyright 2024 The ChromiumOS Authors
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
project('rutabaga_gfx_ffi', ['rust', 'c'],
|
|
version: '0.1.3')
|
|
|
|
target_os = host_machine.system()
|
|
|
|
# By default cargo would generate rutabaga_gfx_ffi.dll (without the lib
|
|
# prefix) for a Windows cdylib
|
|
if target_os == 'windows'
|
|
shared_lib = 'rutabaga_gfx_ffi.dll'
|
|
endif
|
|
if target_os == 'darwin'
|
|
shared_lib = 'librutabaga_gfx_ffi.dylib'
|
|
endif
|
|
if target_os == 'linux'
|
|
shared_lib = 'librutabaga_gfx_ffi.so'
|
|
endif
|
|
|
|
shared_lib_major = '@0@.0'.format(shared_lib)
|
|
shared_lib_full_ver = '@0@.@1@'.format(shared_lib, meson.project_version())
|
|
|
|
build_script = find_program('build.sh')
|
|
with_gfxstream = get_option('gfxstream')
|
|
features = ''
|
|
if with_gfxstream
|
|
features += 'gfxstream'
|
|
endif
|
|
|
|
buildtype = 'debug'
|
|
cargo_release = ''
|
|
if get_option('buildtype') == 'release'
|
|
buildtype = 'release'
|
|
cargo_release = '--release'
|
|
endif
|
|
|
|
rutabaga_gfx_ffi_ct = custom_target(
|
|
'rutabaga_gfx_ffi_build',
|
|
output: [shared_lib, shared_lib_major, shared_lib_full_ver],
|
|
input: ['src/lib.rs', 'Cargo.toml', 'build.rs', 'build.sh'],
|
|
command: [build_script, features, meson.current_build_dir(),
|
|
shared_lib, meson.project_version(), buildtype, cargo_release],
|
|
install: true,
|
|
install_dir: get_option('libdir'),
|
|
)
|
|
|
|
pkg = import('pkgconfig')
|
|
pkg.generate(
|
|
libraries: '-L${libdir} -lrutabaga_gfx_ffi',
|
|
name: 'rutabaga_gfx_ffi',
|
|
version: meson.project_version(),
|
|
description: 'C FFI bindings to Rutabaga VGI',
|
|
)
|
|
|
|
rutabaga_gfx_ffi_h = files('src/include/rutabaga_gfx_ffi.h')
|
|
install_headers(rutabaga_gfx_ffi_h,
|
|
subdir: 'rutabaga_gfx')
|