about summary refs log tree commit diff
path: root/library/stdarch/crates/assert-instr-macro/build.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2018-02-18 10:07:35 +0900
committerGitHub <noreply@github.com>2018-02-18 10:07:35 +0900
commit39b5ec91ae361355f53b0906976081405c09910c (patch)
treeca8933e34bafd16fa6ef8e53e5ee51e1156193b8 /library/stdarch/crates/assert-instr-macro/build.rs
parentd097221fafc3100d4d139a6180ebdc6840258bb0 (diff)
downloadrust-39b5ec91ae361355f53b0906976081405c09910c.tar.gz
rust-39b5ec91ae361355f53b0906976081405c09910c.zip
Reorganize and refactor source tree (#324)
With RFC 2325 looking close to being accepted, I took a crack at
reorganizing this repository to being more amenable for inclusion in
libstd/libcore. My current plan is to add stdsimd as a submodule in
rust-lang/rust and then use `#[path]` to include the modules directly
into libstd/libcore.

Before this commit, however, the source code of coresimd/stdsimd
themselves were not quite ready for this. Imports wouldn't compile for
one reason or another, and the organization was also different than the
RFC itself!

In addition to moving a lot of files around, this commit has the
following major changes:

* The `cfg_feature_enabled!` macro is now renamed to
  `is_target_feature_detected!`
* The `vendor` module is now called `arch`.
* Under the `arch` module is a suite of modules like `x86`, `x86_64`,
  etc. One per `cfg!(target_arch)`.
* The `is_target_feature_detected!` macro was removed from coresimd.
  Unfortunately libcore has no ability to export unstable macros, so for
  now all feature detection is canonicalized in stdsimd.

The `coresimd` and `stdsimd` crates have been updated to the planned
organization in RFC 2325 as well. The runtime bits saw the largest
amount of refactoring, seeing a good deal of simplification without the
core/std split.
Diffstat (limited to 'library/stdarch/crates/assert-instr-macro/build.rs')
-rw-r--r--library/stdarch/crates/assert-instr-macro/build.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/library/stdarch/crates/assert-instr-macro/build.rs b/library/stdarch/crates/assert-instr-macro/build.rs
new file mode 100644
index 00000000000..45a868441c4
--- /dev/null
+++ b/library/stdarch/crates/assert-instr-macro/build.rs
@@ -0,0 +1,13 @@
+use std::env;
+
+fn main() {
+    println!("cargo:rerun-if-changed=build.rs");
+    let opt_level = env::var("OPT_LEVEL")
+        .ok()
+        .and_then(|s| s.parse().ok())
+        .unwrap_or(0);
+    let profile = env::var("PROFILE").unwrap_or(String::new());
+    if profile == "release" || opt_level >= 2 {
+        println!("cargo:rustc-cfg=optimized");
+    }
+}