Skip to content

Commit

Permalink
feat: enable bundled build
Browse files Browse the repository at this point in the history
  • Loading branch information
uulm-janbaudisch committed Dec 7, 2023
1 parent b787a73 commit 4bfa880
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "mt-kahypar"]
path = mt-kahypar
url = https://github.com/kahypar/mt-kahypar.git
10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,13 @@ authors = ["Jan Baudisch <[email protected]>"]
readme = "README.md"
homepage = "https://github.com/SoftVarE-Group/mt-kahypar-sys"
repository = "https://github.com/SoftVarE-Group/mt-kahypar-sys.git"

[features]
bundled = ["dep:cmake", "dep:tbb-sys", "dep:hwlocality-sys"]

[dependencies]
tbb-sys = { version = "1.1", optional = true }
hwlocality-sys = { version = "0.2", optional = true }

[build-dependencies]
cmake = { version = "0.1", optional = true }
27 changes: 27 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,34 @@ use std::path::PathBuf;

fn main() {
let link_type;
#[cfg(feature = "bundled")]
{
panic!("Bundling is currently not supported, as Mt-KaHyPar can not be built statically.");

link_type = "static";

// When bundling mt-kahypar, build it with CMake ...
let build_dir = cmake::Config::new("mt-kahypar")
.define("BUILD_SHARED_LIBS", "OFF")
.build_target("install.mtkahypar")
.build();

// ... and set the path to the built library to be linked (statically).
println!(
"cargo:rustc-link-search={}",
build_dir.join("lib64").display()
);

println!(
"cargo:rustc-link-search={}",
build_dir.join("lib").display()
);

// Set include path for other libraries depending on mt-kahypar.
println!("cargo:include-dir={}", build_dir.join("include").display());
}

#[cfg(not(feature = "bundled"))]
{
link_type = "dylib";

Expand Down
1 change: 1 addition & 0 deletions mt-kahypar
Submodule mt-kahypar added at aa1dbb

0 comments on commit 4bfa880

Please sign in to comment.