diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 90c5d16..8d7a5b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -136,17 +136,23 @@ jobs: - name: docking feature run: cargo test --workspace --all-targets --features docking - - name: freetype feature + - name: freetype feature (non-Windows, pkg-config) if: matrix.os != 'windows-latest' run: cargo test --workspace --all-targets --features freetype - - name: all features + - name: freetype and docking (non-Windows, pkg-config) if: matrix.os != 'windows-latest' - run: cargo test --workspace --all-targets --features docking,freetype + run: cargo test --workspace --all-targets --features freetype,docking - - name: doc tests - run: cargo test --workspace --doc + - name: freetype feature (Windows, vcpkg) + if: matrix.os == 'windows-latest' + run: cargo test --workspace --all-targets --features freetype,use-vcpkg + - name: freetype and docking (Windows, vcpkg) + if: matrix.os == 'windows-latest' + run: cargo test --workspace --all-targets --features freetype,docking,use-vcpkg + + - run: cargo test --workspace --doc # run to check for lint problems - name: build documentation run: cargo doc diff --git a/imgui-sys/Cargo.toml b/imgui-sys/Cargo.toml index 9779e54..be3391b 100644 --- a/imgui-sys/Cargo.toml +++ b/imgui-sys/Cargo.toml @@ -39,4 +39,5 @@ vcpkg = { version="0.2.15", optional=true } default = [] wasm = [] docking = [] -freetype = ["pkg-config", "vcpkg"] +freetype = ["pkg-config"] +use-vcpkg = ["vcpkg"] diff --git a/imgui-sys/build.rs b/imgui-sys/build.rs index fe7be78..20a85f3 100644 --- a/imgui-sys/build.rs +++ b/imgui-sys/build.rs @@ -11,22 +11,16 @@ const DEFINES: &[(&str, Option<&str>)] = &[ #[cfg(feature = "freetype")] fn find_freetype() -> Vec> { - let err_pkg_config; - let err_vcpkg; + #[cfg(not(feature = "use-vcpkg"))] match pkg_config::Config::new().find("freetype2") { Ok(freetype) => return freetype.include_paths, - Err(err) => err_pkg_config = err, + Err(err) => panic!("cannot find freetype: {}", err), } + #[cfg(feature = "use-vcpkg")] match vcpkg::find_package("freetype") { Ok(freetype) => return freetype.include_paths, - Err(err) => err_vcpkg = err, + Err(err) => panic!("cannot find freetype: {}", err), } - panic!( - "cannot find freetype:\n\ - - pkg-config failed with: {}\n\ - - vcpkg failed with: {}", - err_pkg_config, err_vcpkg - ); } // Output define args for compiler