Skip to content

Commit

Permalink
minion: fix linking path errors
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasdewally committed Sep 28, 2023
1 parent 8659767 commit 5d359ae
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
19 changes: 17 additions & 2 deletions solvers/minion/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,25 @@ use std::process::Command;
fn main() {
println!("cargo:rustc-rerun-if-changed=vendor");
println!("cargo:rerun-if-changed=build.rs");

// must be ./ to be recognised as relative path
// from project root
println!("cargo:rustc-link-search=all=./solvers/minion/vendor/build/");
println!("cargo:rustc-link-lib=static=minion");

// also need to (dynamically) link to c++ stdlib
// https://flames-of-code.netlify.app/blog/rust-and-cmake-cplusplus/
let target = env::var("TARGET").unwrap();
if target.contains("apple") {
println!("cargo:rustc-link-lib=dylib=c++");
} else if target.contains("linux") {
println!("cargo:rustc-link-lib=dylib=stdc++");
} else {
unimplemented!();
}

build();
bind();
println!("cargo:rustc-link-lib=libminion");
println!("cargo:rustc-link-search=vendor/build");
}

fn build() {
Expand Down
2 changes: 1 addition & 1 deletion solvers/minion/vendor
Submodule vendor updated 1 files
+1 −1 configure.py

0 comments on commit 5d359ae

Please sign in to comment.