Skip to content

Fix build on windows-2022 and windows-2025 (visual studio 2022) #139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-2019]
os: [ubuntu-latest, macos-latest, windows-2019, windows-2022, windows-2025]
steps:
- uses: actions/checkout@v3
with:
Expand Down
6 changes: 6 additions & 0 deletions mupdf-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,12 @@ fn build_libmupdf() {
fn build_libmupdf() {
use cc::windows_registry::find_vs_version;

// Patch geometry.c to compile on vs 2022
let file_path = "mupdf/source/fitz/geometry.c";
let content = fs::read_to_string(file_path).expect("Failed to read geometry.c file");
let patched_content = content.replace("NAN", "(0.0/0.0)");
fs::write(file_path, patched_content).expect("Failed to write patched geometry.c file");

let target = env::var("TARGET").expect("TARGET not found in environment");
let msvc_platform = if target.contains("x86_64") {
"x64"
Expand Down