aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJack O'Connor <[email protected]>2020-04-11 23:01:46 -0400
committerJack O'Connor <[email protected]>2020-04-11 23:03:32 -0400
commit370ba3644ae2b38b91e52033fc7e9ae705920495 (patch)
tree6037a286d0acc19bb0ca842270c0ad37736e0aa3 /tools
parent86c3174d5b4bc98ccb65ca51402763e7ede15cb3 (diff)
print the compiler version in CI, for help with debugging
Diffstat (limited to 'tools')
-rw-r--r--tools/compiler_version/Cargo.toml7
-rw-r--r--tools/compiler_version/build.rs6
-rw-r--r--tools/compiler_version/src/main.rs12
-rw-r--r--tools/instruction_set_support/Cargo.toml6
-rw-r--r--tools/instruction_set_support/src/main.rs9
5 files changed, 40 insertions, 0 deletions
diff --git a/tools/compiler_version/Cargo.toml b/tools/compiler_version/Cargo.toml
new file mode 100644
index 0000000..1046cf2
--- /dev/null
+++ b/tools/compiler_version/Cargo.toml
@@ -0,0 +1,7 @@
+[package]
+name = "compiler_version"
+version = "0.0.0"
+edition = "2018"
+
+[build-dependencies]
+cc = "1.0.50"
diff --git a/tools/compiler_version/build.rs b/tools/compiler_version/build.rs
new file mode 100644
index 0000000..3e14ebe
--- /dev/null
+++ b/tools/compiler_version/build.rs
@@ -0,0 +1,6 @@
+fn main() {
+ let build = cc::Build::new();
+ let compiler = build.get_compiler();
+ let compiler_path = compiler.path().to_string_lossy();
+ println!("cargo:rustc-env=COMPILER_PATH={}", compiler_path);
+}
diff --git a/tools/compiler_version/src/main.rs b/tools/compiler_version/src/main.rs
new file mode 100644
index 0000000..4506cf7
--- /dev/null
+++ b/tools/compiler_version/src/main.rs
@@ -0,0 +1,12 @@
+fn main() {
+ // Set in build.rs.
+ let compiler_path = env!("COMPILER_PATH");
+
+ let mut compiler_command = std::process::Command::new(compiler_path);
+ // Use the --version flag on everything other than MSVC.
+ if !cfg!(target_env = "msvc") {
+ compiler_command.arg("--version");
+ }
+ // Run the compiler to print its version. Ignore the exit status.
+ let _ = compiler_command.status().unwrap();
+}
diff --git a/tools/instruction_set_support/Cargo.toml b/tools/instruction_set_support/Cargo.toml
new file mode 100644
index 0000000..9e30174
--- /dev/null
+++ b/tools/instruction_set_support/Cargo.toml
@@ -0,0 +1,6 @@
+[package]
+name = "instruction_set_support"
+version = "0.0.0"
+edition = "2018"
+
+[dependencies]
diff --git a/tools/instruction_set_support/src/main.rs b/tools/instruction_set_support/src/main.rs
new file mode 100644
index 0000000..15f9f37
--- /dev/null
+++ b/tools/instruction_set_support/src/main.rs
@@ -0,0 +1,9 @@
+fn main() {
+ #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+ {
+ dbg!(is_x86_feature_detected!("sse4.1"));
+ dbg!(is_x86_feature_detected!("avx2"));
+ dbg!(is_x86_feature_detected!("avx512f"));
+ dbg!(is_x86_feature_detected!("avx512vl"));
+ }
+}