-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cargo: Add support for
system-deps
dependencies
- Loading branch information
1 parent
6736a54
commit db82c2d
Showing
6 changed files
with
126 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
extern crate sub; | ||
|
||
pub fn main() { | ||
sub::func(); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
project('cargo system-deps', 'rust') | ||
|
||
glib = dependency('glib-2.0', required: false) | ||
if not glib.found() | ||
error('MESON_SKIP_TEST: Need glib system dependency') | ||
endif | ||
|
||
sub_dep = dependency('sub-1-rs') | ||
exe = executable('main', 'main.rs', dependencies : sub_dep) | ||
test('main', exe) | ||
|
2 changes: 2 additions & 0 deletions
2
test cases/rust/26 cargo system deps/subprojects/sub-1-rs.wrap
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[wrap-file] | ||
method = cargo |
16 changes: 16 additions & 0 deletions
16
test cases/rust/26 cargo system deps/subprojects/sub-1-rs/Cargo.toml
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[package] | ||
name = 'sub' | ||
version = '1' | ||
|
||
[build-dependencies] | ||
system-deps = "6" | ||
|
||
[lib] | ||
name = "sub" | ||
path = "lib.rs" | ||
|
||
[package.metadata.system-deps] | ||
glib = { name = "glib-2.0", version=" 2.0 , 2.1 , <3 ", feature="default" } | ||
gobject = { name = "gobject-2.0", version=">=99", optional=true } | ||
notfound = { feature="notfound" } | ||
libffi = "1.0" |
15 changes: 15 additions & 0 deletions
15
test cases/rust/26 cargo system deps/subprojects/sub-1-rs/lib.rs
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
extern "C" { | ||
fn g_get_tmp_dir() -> *mut std::ffi::c_void; | ||
} | ||
|
||
#[cfg(system_deps_have_glib)] | ||
#[cfg(not(system_deps_have_gobject))] | ||
pub fn func() { | ||
unsafe { | ||
g_get_tmp_dir(); | ||
} | ||
} | ||
|
||
pub fn func1() { | ||
func() | ||
} |