-
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
8fe7d86
commit 7ab8559
Showing
8 changed files
with
93 additions
and
1 deletion.
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() { | ||
std::process::exit(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,10 @@ | ||
project('cargo system-deps', 'rust') | ||
|
||
rust = import('unstable-rust') | ||
|
||
sub = rust.cargo('sub') | ||
|
||
exe = executable('main', 'main.rs', dependencies : sub.get_variable('dep')) | ||
|
||
test('main', exe) | ||
|
14 changes: 14 additions & 0 deletions
14
test cases/cargo/06 system deps link/subprojects/sub/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,14 @@ | ||
[package] | ||
name = 'sub' | ||
version = '0.1.1' | ||
edition = '2021' | ||
description = 'a project with a system dependency' | ||
|
||
[build-dependencies] | ||
system-deps = "6" | ||
|
||
[lib] | ||
name = "sub" | ||
|
||
[package.metadata.system-deps.system] | ||
version = "0.1" |
12 changes: 12 additions & 0 deletions
12
test cases/cargo/06 system deps link/subprojects/sub/src/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,12 @@ | ||
mod ffi { | ||
extern "C" { | ||
pub fn func() -> i32; | ||
} | ||
} | ||
|
||
pub fn func() -> i32 { | ||
unsafe { | ||
ffi::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,5 @@ | ||
[wrap-file] | ||
path = 'system' | ||
|
||
[provide] | ||
system = system_dep |
5 changes: 5 additions & 0 deletions
5
test cases/cargo/06 system deps link/subprojects/system/lib.c
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 @@ | ||
#include <stdio.h> | ||
|
||
int func() { | ||
return 0; | ||
} |
5 changes: 5 additions & 0 deletions
5
test cases/cargo/06 system deps link/subprojects/system/meson.build
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 @@ | ||
project('system', 'c', version: '0.2') | ||
|
||
|
||
system_dep = declare_dependency(link_with: library('system', 'lib.c')) | ||
meson.override_dependency('system', system_dep) |