Skip to content

Place source and build products in OUT_DIR #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ cblas = []
lapacke = []
static = []
system = []
shared-build-cache = []

[dev-dependencies]
libc = "0.2"
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ The following Cargo features are supported:

* `cblas` to build CBLAS (enabled by default),
* `lapacke` to build LAPACKE (enabled by default),
* `static` to link to OpenBLAS statically, and
* `system` to skip building the bundled OpenBLAS.
* `static` to link to OpenBLAS statically,
* `system` to skip building the bundled OpenBLAS, and
* `shared-build-cache` to place most of the OpenBLAS build products in
`~/.cargo` instead of the `target` directory. (This allows them to be reused
between crates which have different `target` directories, in order to avoid
rebuilding OpenBLAS unnecessarily. However, it prevents `cargo clean` from
removing the OpenBLAS build products.)

## Cross Compilation

Expand Down
6 changes: 5 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ fn main() {
_ => variable!("TARGET"),
};
env::remove_var("TARGET");
let source = PathBuf::from(format!("source_{}", target.to_lowercase()));
let source = if feature!("SHARED_BUILD_CACHE") {
PathBuf::from(format!("source_{}", target.to_lowercase()))
} else {
output.join(format!("source_{}", target.to_lowercase()))
};
if !source.exists() {
let source_tmp = PathBuf::from(format!("{}_tmp", source.display()));
if source_tmp.exists() {
Expand Down