mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-24 10:08:00 -06:00
@@ -5,15 +5,20 @@
|
||||
//! cross-compile from macOS or Linux still links, unless `PDFCRAFT_REQUIRE_WINRES=1` turns it
|
||||
//! into an error (for release builds).
|
||||
|
||||
#[path = "src/windows_manifest.rs"]
|
||||
mod windows_manifest;
|
||||
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
println!("cargo:rerun-if-changed=../../assets/app-icon/pdfcraft.ico");
|
||||
println!("cargo:rerun-if-changed=src/windows_manifest.rs");
|
||||
println!("cargo:rerun-if-env-changed=PDFCRAFT_REQUIRE_WINRES");
|
||||
if std::env::var("CARGO_CFG_TARGET_OS").as_deref() != Ok("windows") {
|
||||
return;
|
||||
}
|
||||
let mut res = winresource::WindowsResource::new();
|
||||
res.set_icon("../../assets/app-icon/pdfcraft.ico")
|
||||
.set_manifest(windows_manifest::WINDOWS_MANIFEST)
|
||||
.set("ProductName", "PdfCraft")
|
||||
.set("FileDescription", "PdfCraft PDF workbench")
|
||||
.set("LegalCopyright", "Copyright (c) the PdfCraft contributors. MIT OR Apache-2.0.")
|
||||
|
||||
@@ -29,6 +29,9 @@ use pdfcraft_ui_egui::PdfCraftApp;
|
||||
mod apple_events;
|
||||
mod logging;
|
||||
mod updates;
|
||||
#[cfg(test)]
|
||||
#[path = "windows_manifest.rs"]
|
||||
mod windows_manifest;
|
||||
|
||||
/// Freedesktop app id: the `.desktop` file name and the hicolor icon name.
|
||||
const APP_ID: &str = "ai.storyteller.pdfcraft";
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
pub(crate) const WINDOWS_MANIFEST: &str = r#"<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
</assembly>
|
||||
"#;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::WINDOWS_MANIFEST;
|
||||
|
||||
#[test]
|
||||
fn declares_per_monitor_v2_with_per_monitor_fallback() {
|
||||
assert!(
|
||||
WINDOWS_MANIFEST
|
||||
.contains("<dpiAwareness xmlns=\"http://schemas.microsoft.com/SMI/2016/WindowsSettings\">PerMonitorV2, PerMonitor</dpiAwareness>")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn legacy_declaration_is_per_monitor_aware() {
|
||||
assert!(WINDOWS_MANIFEST.contains("<dpiAware xmlns=\"http://schemas.microsoft.com/SMI/2005/WindowsSettings\">true/pm</dpiAware>"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn windows_resource_build_script_embeds_this_manifest() {
|
||||
let build_script = include_str!("../build.rs");
|
||||
assert!(build_script.contains("set_manifest(windows_manifest::WINDOWS_MANIFEST)"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user