Skip to content

Commit ee58c1e

Browse files
vincent-udenVincent UdénVincent Udén
authored
Allow for compilation of mupdf-sys on Windows with Visual Studio 2022 (#125)
* Add env check * Removed debugging print statement --------- Co-authored-by: Vincent Udén <[email protected]> Co-authored-by: Vincent Udén <[email protected]>
1 parent 67f75a3 commit ee58c1e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

mupdf-sys/build.rs

+10
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ fn build_libmupdf() {
209209

210210
#[cfg(target_env = "msvc")]
211211
fn build_libmupdf() {
212+
use cc::windows_registry::find_vs_version;
213+
212214
let target = env::var("TARGET").expect("TARGET not found in environment");
213215
let msvc_platform = if target.contains("x86_64") {
214216
"x64"
@@ -258,12 +260,20 @@ fn build_libmupdf() {
258260
}
259261
// Enable parallel compilation
260262
cl_env.push("/MP".to_string());
263+
let platform_toolset = env::var("MUPDF_MSVC_PLATFORM_TOOLSET").unwrap_or(
264+
(match find_vs_version() {
265+
Ok(cc::windows_registry::VsVers::Vs17) => "v143",
266+
_ => "v142",
267+
})
268+
.to_string(),
269+
);
261270
let d = msbuild
262271
.args(&[
263272
"platform\\win32\\mupdf.sln",
264273
"/target:libmupdf",
265274
&format!("/p:Configuration={}", profile),
266275
&format!("/p:Platform={}", msvc_platform),
276+
&format!("/p:PlatformToolset={}", platform_toolset),
267277
])
268278
.current_dir(&build_dir)
269279
.env("CL", cl_env.join(" "))

0 commit comments

Comments
 (0)