mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-24 20:48:55 +00:00
97dff044f8
Updates are made to source and documentation. This more accurately represents the currently supported platforms of Android/Linux and Windows, without unexpectedly including other unix-like operating systems. Command to reproduce: $ find . -type f -not -path '*/\.git/*' | xargs -I {} sed -i 's/cfg(unix)/cfg(any(target_os = "android", target_os = "linux"))/g' {} $ cargo fmt md files manually updated to fix line lengths. Renaming `unix` modules to `linux` will be done in a later CL. Test: ./tools/dev_container ./tools/presubmit Bug: b/298269162 Change-Id: I42c1bf0abf80b9a0df25551613910293217c7295 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4909059 Commit-Queue: Cody Schuffelen <schuffelen@google.com> Reviewed-by: Frederick Mayle <fmayle@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-by: Noah Gold <nkgold@google.com>
62 lines
2.1 KiB
Rust
62 lines
2.1 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(any(target_os = "android", target_os = "linux"))]
|
|
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(any(target_os = "android", target_os = "linux"))]
|
|
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
|
|
}
|