mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-24 20:48:55 +00:00
2314c4701b
BUG=b:213146388 TEST=presubmit Change-Id: I59e6b7ad7aff8d4659c62e310a7955146a10d743 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3777405 Tested-by: Vikram Auradkar <auradkar@google.com> Reviewed-by: Noah Gold <nkgold@google.com> Auto-Submit: Vikram Auradkar <auradkar@google.com> Commit-Queue: Vikram Auradkar <auradkar@google.com>
43 lines
1.5 KiB
Rust
43 lines
1.5 KiB
Rust
// Copyright 2020 The Chromium OS Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#[cfg(all(feature = "slirp", windows))]
|
|
mod win_slirp {
|
|
use std::env;
|
|
|
|
pub(super) fn main() {
|
|
// This must be an absolute path or linking issues will result when a consuming crate
|
|
// tries to link since $PWD will be different.
|
|
let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
|
|
|
#[cfg(debug_assertions)]
|
|
let build_type = "debug";
|
|
|
|
#[cfg(not(debug_assertions))]
|
|
let build_type = "release";
|
|
|
|
println!(
|
|
r#"cargo:rustc-link-search={}\..\..\..\third_party\libslirp\{}"#,
|
|
manifest_dir, build_type
|
|
);
|
|
println!(
|
|
r#"cargo:rustc-env=PATH={};{}\..\..\..\third_party\libslirp\{};"#,
|
|
env::var("PATH").unwrap(),
|
|
manifest_dir,
|
|
build_type,
|
|
);
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
// We (the Windows crosvm maintainers) submitted upstream patches to libslirp-sys so it doesn't
|
|
// try to link directly on Windows. This is because linking on Windows tends to be specific
|
|
// to the build system that invokes Cargo (e.g. the crosvm jCI scripts that also produce the
|
|
// required libslirp DLL & lib). The integration here (win_slirp::main) is specific to crosvm's
|
|
// build process.
|
|
#[cfg(all(feature = "slirp", windows))]
|
|
win_slirp::main();
|
|
|
|
// For unix, libslirp-sys's build script will make the appropriate linking calls to pkg_config.
|
|
}
|