-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
87 additions
and
21 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[workspace] | ||
members = [ | ||
"cargo-dinghy", | ||
"dinghy-helper", | ||
"dinghy-build", | ||
"dinghy-lib", | ||
"dinghy-test", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
[package] | ||
name = "dinghy-helper" | ||
name = "dinghy-build" | ||
version = "0.3.0-pre" | ||
authors = ["Mathieu Poumeyrol <[email protected]>"] | ||
license = "MIT/Apache-2.0" | ||
description = "Painless tests on mobile devices" | ||
description = "Cross-compilation made easier - helpers for build.rs scripts" | ||
homepage = "https://medium.com/snips-ai/dinghy-painless-rust-tests-and-benches-on-ios-and-android-c9f94f81d305#.c2sx7two8" | ||
repository = "https://github.com/snipsco/dinghy" | ||
keywords = [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,46 @@ | ||
///! Helpers functions to output `cargo:` lines suitable for build.rs output. | ||
use std::env; | ||
use std::path::Path; | ||
use super::Result; | ||
|
||
/// Find out if we are cross-compiling. | ||
pub fn is_cross_compiling() -> Result<bool> { | ||
Ok(env::var("TARGET")? != env::var("HOST")?) | ||
} | ||
|
||
/// Adds a `cargo:rustc-link-lib=` line. | ||
pub fn include_path<P: AsRef<Path>>(lib_dir_path: P) -> Result<()> { | ||
println!("cargo:rustc-link-lib={}", lib_dir_path.as_ref().display()); | ||
Ok(()) | ||
} | ||
|
||
/// Adds a `cargo:rustc-link-search=` and `cargo:rustc-link-lib=dylib=` line. | ||
pub fn link_dylib<P: AsRef<Path>>(lib_name: &str, lib_dir_path: P) -> Result<()> { | ||
println!("cargo:rustc-link-search={}", lib_dir_path.as_ref().display()); | ||
println!("cargo:rustc-link-lib=dylib={}", lib_name); | ||
Ok(()) | ||
} | ||
|
||
/// Adds a `cargo:rustc-link-search` and `cargo:rustc-link-lib=` line. | ||
pub fn link_lib<P: AsRef<Path>>(lib_name: &str, lib_dir_path: P) -> Result<()> { | ||
println!("cargo:rustc-link-search={}", lib_dir_path.as_ref().display()); | ||
println!("cargo:rustc-link-lib={}", lib_name); | ||
Ok(()) | ||
} | ||
|
||
/// Adds a `cargo:rustc-link-lib=dylib=` line. | ||
pub fn link_system_dylib(lib_name: &str) -> Result<()> { | ||
println!("cargo:rustc-link-lib=dylib={}", lib_name); | ||
Ok(()) | ||
} | ||
|
||
/// Adds a `cargo:rustc-link-lib=` line. | ||
pub fn link_system_lib(lib_name: &str) -> Result<()> { | ||
println!("cargo:rustc-link-lib={}", lib_name); | ||
Ok(()) | ||
} | ||
|
||
/// Adds a `cargo:rerun-if-changed=` line. | ||
pub fn rerun_if_changed<P: AsRef<Path>>(filepath: P) { | ||
println!("cargo:rerun-if-changed={}", filepath.as_ref().display()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters