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