aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorpravic <[email protected]>2016-04-16 00:46:29 +0300
committerpravic <[email protected]>2016-04-16 00:46:29 +0300
commit419308de54870bb2c7ebab4ac7d178aac0adb254 (patch)
treeae66f5048fd52d57b319162e493fbbe9b03f7001 /examples
parent`fn main` is required when building with `--target target.json` (diff)
downloadwinapi-kmd-rs-419308de54870bb2c7ebab4ac7d178aac0adb254.tar.xz
winapi-kmd-rs-419308de54870bb2c7ebab4ac7d178aac0adb254.zip
simplify build: remove links from toml and provide path to the libs via single build.rs
Diffstat (limited to 'examples')
-rw-r--r--examples/01.minimal/Cargo.toml3
-rw-r--r--examples/01.minimal/build.rs1
-rw-r--r--examples/02.unload/Cargo.toml3
-rw-r--r--examples/02.unload/build.rs1
-rw-r--r--examples/03.urandom/Cargo.toml3
-rw-r--r--examples/03.urandom/build.rs1
-rw-r--r--examples/build.rs12
7 files changed, 15 insertions, 9 deletions
diff --git a/examples/01.minimal/Cargo.toml b/examples/01.minimal/Cargo.toml
index a2177af..9d525f6 100644
--- a/examples/01.minimal/Cargo.toml
+++ b/examples/01.minimal/Cargo.toml
@@ -5,8 +5,7 @@ version = "0.1.0"
authors = ["pravic <[email protected]>"]
readme = "../README.md"
-build = "build.rs"
-links = "ntoskrnl"
+build = "../build.rs"
[lib]
path = "driver.rs"
diff --git a/examples/01.minimal/build.rs b/examples/01.minimal/build.rs
deleted file mode 100644
index f328e4d..0000000
--- a/examples/01.minimal/build.rs
+++ /dev/null
@@ -1 +0,0 @@
-fn main() {}
diff --git a/examples/02.unload/Cargo.toml b/examples/02.unload/Cargo.toml
index e3d298c..9c380d6 100644
--- a/examples/02.unload/Cargo.toml
+++ b/examples/02.unload/Cargo.toml
@@ -5,8 +5,7 @@ version = "0.1.0"
authors = ["pravic <[email protected]>"]
readme = "../README.md"
-build = "build.rs"
-links = "ntoskrnl"
+build = "../build.rs"
[lib]
path = "driver.rs"
diff --git a/examples/02.unload/build.rs b/examples/02.unload/build.rs
deleted file mode 100644
index f328e4d..0000000
--- a/examples/02.unload/build.rs
+++ /dev/null
@@ -1 +0,0 @@
-fn main() {}
diff --git a/examples/03.urandom/Cargo.toml b/examples/03.urandom/Cargo.toml
index 8b45bdf..f41fc36 100644
--- a/examples/03.urandom/Cargo.toml
+++ b/examples/03.urandom/Cargo.toml
@@ -5,8 +5,7 @@ version = "0.1.0"
authors = ["pravic <[email protected]>"]
readme = "../README.md"
-build = "build.rs"
-links = "ntoskrnl"
+build = "../build.rs"
[lib]
path = "driver.rs"
diff --git a/examples/03.urandom/build.rs b/examples/03.urandom/build.rs
deleted file mode 100644
index f328e4d..0000000
--- a/examples/03.urandom/build.rs
+++ /dev/null
@@ -1 +0,0 @@
-fn main() {}
diff --git a/examples/build.rs b/examples/build.rs
new file mode 100644
index 0000000..06a0e4f
--- /dev/null
+++ b/examples/build.rs
@@ -0,0 +1,12 @@
+use std::env;
+
+fn main() {
+ let target = env::var("TARGET").unwrap();
+ let triple: Vec<_> = target.split('-').collect();
+ let mapped = match triple.get(0) {
+ Some(&"i686") => "i386",
+ Some(&"x86_64") => "amd64",
+ _ => panic!("unknown architecture of {:?}", target),
+ };
+ println!("cargo:rustc-link-search=../../../native/win7/{}", mapped);
+}