comparison mupdf-source/thirdparty/zxing-cpp/wrappers/rust/build.rs @ 2:b50eed0cc0ef upstream

ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4. The directory name has changed: no version number in the expanded directory now.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:43:07 +0200
parents
children
comparison
equal deleted inserted replaced
1:1d09e1dec1d9 2:b50eed0cc0ef
1 use std::env;
2
3 fn main() -> miette::Result<()> {
4 if cfg!(feature = "bundled") {
5 // Builds the project in the directory located in `core`, installing it into $OUT_DIR
6 let mut dst = cmake::Config::new("core")
7 .define("BUILD_SHARED_LIBS", "OFF")
8 .define("ZXING_READERS", "ON")
9 .define("ZXING_WRITERS", "NEW")
10 .define("ZXING_EXPERIMENTAL_API", "ON")
11 .define("ZXING_C_API", "ON")
12 .define("ZXING_USE_BUNDLED_ZINT", "ON")
13 .define("CMAKE_CXX_STANDARD", "20")
14 .build();
15 dst.push("lib");
16 println!("cargo:rustc-link-search=native={}", dst.display());
17 println!("cargo:rustc-link-lib=static=ZXing");
18
19 if let Ok(target) = env::var("TARGET") {
20 if target.contains("apple") {
21 println!("cargo:rustc-link-lib=dylib=c++");
22 } else if target.contains("linux") {
23 println!("cargo:rustc-link-lib=dylib=stdc++");
24 }
25 }
26 } else if let Ok(lib_dir) = env::var("ZXING_CPP_LIB_DIR") {
27 println!("cargo:rustc-link-search=native={}", lib_dir);
28 println!("cargo:rustc-link-lib=dylib=ZXing");
29 } else {
30 // panic!("ZXing library not found. Use feature 'bundled' or set environment variabale ZXING_CPP_LIB_DIR.")
31 }
32
33 // manual bindings.rs generation:
34 // bindgen core/src/ZXingC.h -o src/bindings.rs --no-prepend-enum-name --merge-extern-blocks --use-core --no-doc-comments --no-layout-tests --with-derive-partialeq --allowlist-item "ZXing.*" -- -DZXING_EXPERIMENTAL_API
35
36 Ok(())
37 }