mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-25 04:18:46 +00:00
add vcpkg-rs for locating freetype
This commit is contained in:
parent
6d6cda275c
commit
f10cecf803
@ -33,9 +33,10 @@ cfg-if = "1"
|
|||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
cc = "1.0"
|
cc = "1.0"
|
||||||
pkg-config = { version="0.3", optional=true }
|
pkg-config = { version="0.3", optional=true }
|
||||||
|
vcpkg = { version="0.2.15", optional=true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
wasm = []
|
wasm = []
|
||||||
freetype = ["pkg-config"]
|
|
||||||
docking = []
|
docking = []
|
||||||
|
freetype = ["pkg-config", "vcpkg"]
|
||||||
|
|||||||
@ -9,11 +9,34 @@ const DEFINES: &[(&str, Option<&str>)] = &[
|
|||||||
("IMGUI_DISABLE_OSX_FUNCTIONS", None),
|
("IMGUI_DISABLE_OSX_FUNCTIONS", None),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Output define args for compiler
|
||||||
fn main() -> std::io::Result<()> {
|
fn main() -> std::io::Result<()> {
|
||||||
// Root of imgui-sys
|
// Root of imgui-sys
|
||||||
let manifest_dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR"));
|
let manifest_dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR"));
|
||||||
|
|
||||||
// Output define args for compiler
|
#[cfg(feature = "freetype")]
|
||||||
|
fn find_freetype() -> Vec<impl AsRef<std::path::Path>> {
|
||||||
|
let err_pkg_config;
|
||||||
|
let err_vcpkg;
|
||||||
|
match pkg_config::Config::new().find("freetype2") {
|
||||||
|
Ok(freetype) => return freetype.include_paths,
|
||||||
|
Err(err) => err_pkg_config = err,
|
||||||
|
}
|
||||||
|
match vcpkg::find_package("freetype") {
|
||||||
|
Ok(freetype) => return freetype.include_paths,
|
||||||
|
Err(err) => err_vcpkg = err,
|
||||||
|
}
|
||||||
|
panic!(
|
||||||
|
"cannot find freetype:\n\
|
||||||
|
- pkg-config failed with: {}\n\
|
||||||
|
- vcpkg failed with: {}",
|
||||||
|
err_pkg_config, err_vcpkg
|
||||||
|
);
|
||||||
|
}
|
||||||
|
println!(
|
||||||
|
"cargo:THIRD_PARTY={}",
|
||||||
|
manifest_dir.join("third-party").display()
|
||||||
|
);
|
||||||
for (key, value) in DEFINES.iter() {
|
for (key, value) in DEFINES.iter() {
|
||||||
println!("cargo:DEFINE_{}={}", key, value.unwrap_or(""));
|
println!("cargo:DEFINE_{}={}", key, value.unwrap_or(""));
|
||||||
}
|
}
|
||||||
@ -48,9 +71,7 @@ fn main() -> std::io::Result<()> {
|
|||||||
// Freetype font rasterizer feature
|
// Freetype font rasterizer feature
|
||||||
#[cfg(feature = "freetype")]
|
#[cfg(feature = "freetype")]
|
||||||
{
|
{
|
||||||
// Find library
|
for include in find_freetype() {
|
||||||
let freetype = pkg_config::Config::new().find("freetype2").unwrap();
|
|
||||||
for include in freetype.include_paths.iter() {
|
|
||||||
build.include(include);
|
build.include(include);
|
||||||
}
|
}
|
||||||
// Set flag for dear imgui
|
// Set flag for dear imgui
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user