Skip to content

Commit

Permalink
Add ccache, remove linking with STL
Browse files Browse the repository at this point in the history
  • Loading branch information
louwers committed Jan 28, 2025
1 parent 1c1773e commit c6fc555
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions platform/rust/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,23 @@ fn main() {
.to_path_buf();

let mut cmake_cfg = cmake::Config::new(&project_root);

cmake_cfg
.define("MLN_WITH_CORE_ONLY", "ON")
.generator("Ninja")
.define("CMAKE_C_COMPILER_LAUNCHER", "ccache")
.define("CMAKE_CXX_COMPILER_LAUNCHER", "ccache")
.define("MLN_WITH_CORE_ONLY", "ON")
.build_target("mbgl-core");

let build_output = cmake_cfg.build();

// The library is in build_output/build/libmbgl-core.a
let lib_dir = build_output.join("build");
println!("cargo:rustc-link-search=native={}", lib_dir.display());
println!("cargo:rustc-link-lib=static=mbgl-core");

// If on macOS/Clang:
println!("cargo:rustc-link-lib=c++");
// If on Linux/GCC:
// println!("cargo:rustc-link-lib=stdc++");

// cxx build
let mut cxx = cxx_build::bridge("src/lib.rs");
cxx.include(project_root.join("include"))
.flag_if_supported("-std=c++20")
.compile("maplibre_rust_bindings");
.flag_if_supported("-std=c++20")
.compile("maplibre_rust_bindings");
}

0 comments on commit c6fc555

Please sign in to comment.