aboutsummaryrefslogtreecommitdiff
path: root/thirdparty/BLAKE3/tools/compiler_version
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-11-04 14:18:54 +0100
committerStefan Boberg <[email protected]>2021-11-04 14:19:05 +0100
commit472569d4a5f2daaef7e234d93b417ccb650be624 (patch)
tree085c33f178855ad5ffe48b01bf99d41516ffa011 /thirdparty/BLAKE3/tools/compiler_version
parentMerge branch 'main' of https://github.com/EpicGames/zen (diff)
downloadzen-472569d4a5f2daaef7e234d93b417ccb650be624.tar.xz
zen-472569d4a5f2daaef7e234d93b417ccb650be624.zip
Renamed 3rdparty -> thirdparty for legal compliance
Diffstat (limited to 'thirdparty/BLAKE3/tools/compiler_version')
-rw-r--r--thirdparty/BLAKE3/tools/compiler_version/Cargo.toml7
-rw-r--r--thirdparty/BLAKE3/tools/compiler_version/build.rs6
-rw-r--r--thirdparty/BLAKE3/tools/compiler_version/src/main.rs27
3 files changed, 40 insertions, 0 deletions
diff --git a/thirdparty/BLAKE3/tools/compiler_version/Cargo.toml b/thirdparty/BLAKE3/tools/compiler_version/Cargo.toml
new file mode 100644
index 000000000..1046cf29d
--- /dev/null
+++ b/thirdparty/BLAKE3/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/thirdparty/BLAKE3/tools/compiler_version/build.rs b/thirdparty/BLAKE3/tools/compiler_version/build.rs
new file mode 100644
index 000000000..3e14ebe67
--- /dev/null
+++ b/thirdparty/BLAKE3/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/thirdparty/BLAKE3/tools/compiler_version/src/main.rs b/thirdparty/BLAKE3/tools/compiler_version/src/main.rs
new file mode 100644
index 000000000..767cb31bd
--- /dev/null
+++ b/thirdparty/BLAKE3/tools/compiler_version/src/main.rs
@@ -0,0 +1,27 @@
+use std::process::Command;
+
+fn main() {
+ // Print the rustc version.
+ Command::new(env!("CARGO"))
+ .args(&["rustc", "--quiet", "--", "--version"])
+ .status()
+ .unwrap();
+ println!();
+
+ // Print the Cargo version.
+ Command::new(env!("CARGO"))
+ .args(&["--version"])
+ .status()
+ .unwrap();
+ println!();
+
+ // Print the C compiler version. This relies on C compiler detection done
+ // in build.rs, which sets the COMPILER_PATH variable.
+ let compiler_path = env!("COMPILER_PATH");
+ let mut compiler_command = Command::new(compiler_path);
+ // Use the --version flag on everything other than MSVC.
+ if !cfg!(target_env = "msvc") {
+ compiler_command.arg("--version");
+ }
+ let _ = compiler_command.status().unwrap();
+}