mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-12-01 04:28:48 +00:00
f7095ff46a
This is a step towards upstreaming Perfetto support (adding the Perfetto Rust wrappers). These wrappers won't compile until we have the Perfetto source & libraries in place. BUG=b:277138899 TEST=n/a Change-Id: Ic9cc86285383b114cecf7cfe574b3e2511d7afeb Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4428221 Reviewed-by: Steven Moreland <smoreland@google.com> Reviewed-by: Morg <morg@chromium.org> Reviewed-by: Dennis Kempin <denniskempin@google.com> Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org> Commit-Queue: Noah Gold <nkgold@google.com>
62 lines
2 KiB
Rust
62 lines
2 KiB
Rust
// Copyright 2023 The ChromiumOS Authors
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
use std::env;
|
|
use std::path::PathBuf;
|
|
|
|
fn main() {
|
|
#[cfg(windows)]
|
|
main_windows();
|
|
|
|
#[cfg(unix)]
|
|
main_unix();
|
|
|
|
// TODO: enable once Perfetto is in third_party/perfetto.
|
|
/*
|
|
let proto_files = vec![proto_path(&["config", "perfetto_config.proto"])];
|
|
let mut out_dir = PathBuf::from(env::var("OUT_DIR").expect("OUT_DIR env does not exist."));
|
|
out_dir.push("perfetto_protos");
|
|
proto_build_tools::build_protos(&out_dir, proto_files.as_slice());
|
|
*/
|
|
}
|
|
|
|
#[cfg(windows)]
|
|
fn main_windows() {
|
|
// TODO: enable once we have Perfetto libraries available on Windows,
|
|
// download them with prebuilts::download_prebuilts.
|
|
//
|
|
// Ideally paths will be identical in the long term and we
|
|
// can have a single version of this code.
|
|
/*
|
|
println!("cargo:rustc-link-lib=dylib=cperfetto");
|
|
#[cfg(debug_assertions)]
|
|
println!("cargo:rustc-link-search=..\\..\\libs\\debug");
|
|
#[cfg(all(windows, not(debug_assertions)))]
|
|
println!("cargo:rustc-link-search=..\\..\\libs\\release");
|
|
*/
|
|
}
|
|
|
|
#[cfg(unix)]
|
|
fn main_unix() {
|
|
// TODO: enable once we have Perfetto libraries available on unix. We may
|
|
// want to use a prebuilt here too, in which case this would be identical
|
|
// to the Windows version above. The paths will need to be adjusted to
|
|
// wherever we make the Perfetto binary available.
|
|
/*
|
|
println!("cargo:rustc-link-lib=dylib=cperfetto");
|
|
#[cfg(debug_assertions)]
|
|
println!("cargo:rustc-link-search=../../libs/debug");
|
|
#[cfg(not(debug_assertions))]
|
|
println!("cargo:rustc-link-search=../../libs/release");
|
|
*/
|
|
}
|
|
|
|
#[allow(dead_code)]
|
|
fn proto_path(path: &[&str]) -> PathBuf {
|
|
let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
|
|
let mut full_path = manifest_dir;
|
|
full_path.extend(["..", "third_party", "perfetto", "protos", "perfetto"]);
|
|
full_path.extend(path);
|
|
full_path
|
|
}
|