Browse Source

fix: build error on `docs.rs`

master
Dnomd343 4 days ago
parent
commit
a736108791
  1. 38
      src/core_ffi/rust_ffi/build.rs

38
src/core_ffi/rust_ffi/build.rs

@ -7,25 +7,29 @@
use cxx_build::CFG; use cxx_build::CFG;
// TODO: assert version info
fn main() { fn main() {
cmake::Config::new("klotski") if std::env::var("DOCS_RS").is_err() {
.define("CARGO_BUILD:BOOL", "ON") cmake::Config::new("klotski")
.define("KLSK_ENABLE_TESTING:BOOL", "OFF") .define("CARGO_BUILD:BOOL", "ON")
.define("KLSK_ENABLE_BENCHMARK:BOOL", "OFF") .define("KLSK_ENABLE_TESTING:BOOL", "OFF")
.define("KLSK_C_FFI:BOOL", "OFF") .define("KLSK_ENABLE_BENCHMARK:BOOL", "OFF")
.define("KLSK_PYTHON_FFI:BOOL", "OFF") .define("KLSK_C_FFI:BOOL", "OFF")
.build(); .define("KLSK_PYTHON_FFI:BOOL", "OFF")
println!("cargo:rustc-link-lib=static=klotski_core"); .build();
println!("cargo:rustc-link-lib=static=klotski_core");
CFG.include_prefix = "rust_ffi"; CFG.include_prefix = "rust_ffi";
cxx_build::bridge("src/bridge.rs") cxx_build::bridge("src/bridge.rs")
.file("adapter/short_code.cc") .file("adapter/short_code.cc")
.file("adapter/common_code.cc") .file("adapter/common_code.cc")
.include("klotski/src/core") .include("klotski/src/core")
.flag("-std=c++23") .flag("-std=c++23")
.flag("-fno-rtti") .flag("-fno-rtti")
.flag("-fno-exceptions") .flag("-fno-exceptions")
.compile("klotski"); .compile("klotski");
}
println!("cargo:rerun-if-changed=src/bridge.rs"); println!("cargo:rerun-if-changed=src/bridge.rs");
println!("cargo:rerun-if-changed=adapter/short_code.cc"); println!("cargo:rerun-if-changed=adapter/short_code.cc");

Loading…
Cancel
Save