Rename cargo executable to cargo-clif

This allows executing it like cargo clif build if you add it to your
PATH. It also fixes infinite recursion on Windows when invoking it as
Windows includes the current directory in PATH by default.

Fixes #971
This commit is contained in:
bjorn3 2021-12-30 11:35:58 +01:00
parent 0467c6a307
commit 0dd3d28cff
5 changed files with 24 additions and 24 deletions

View File

@ -37,7 +37,7 @@ Assuming `$cg_clif_dir` is the directory you cloned this repo into and you follo
In the directory with your project (where you can do the usual `cargo build`), run: In the directory with your project (where you can do the usual `cargo build`), run:
```bash ```bash
$ $cg_clif_dir/build/cargo build $ $cg_clif_dir/build/cargo-clif build
``` ```
This will build your project with rustc_codegen_cranelift instead of the usual LLVM backend. This will build your project with rustc_codegen_cranelift instead of the usual LLVM backend.

View File

@ -46,9 +46,9 @@ pub(crate) fn build_sysroot(
// Build and copy cargo wrapper // Build and copy cargo wrapper
let mut build_cargo_wrapper_cmd = Command::new("rustc"); let mut build_cargo_wrapper_cmd = Command::new("rustc");
build_cargo_wrapper_cmd build_cargo_wrapper_cmd
.arg("scripts/cargo.rs") .arg("scripts/cargo-clif.rs")
.arg("-o") .arg("-o")
.arg(target_dir.join("cargo")) .arg(target_dir.join("cargo-clif"))
.arg("-g"); .arg("-g");
spawn_and_wait(build_cargo_wrapper_cmd); spawn_and_wait(build_cargo_wrapper_cmd);

View File

@ -9,7 +9,7 @@ Assuming `$cg_clif_dir` is the directory you cloned this repo into and you follo
In the directory with your project (where you can do the usual `cargo build`), run: In the directory with your project (where you can do the usual `cargo build`), run:
```bash ```bash
$ $cg_clif_dir/build/cargo build $ $cg_clif_dir/build/cargo-clif build
``` ```
This will build your project with rustc_codegen_cranelift instead of the usual LLVM backend. This will build your project with rustc_codegen_cranelift instead of the usual LLVM backend.
@ -32,7 +32,7 @@ In jit mode cg_clif will immediately execute your code without creating an execu
> The jit mode will probably need cargo integration to make this possible. > The jit mode will probably need cargo integration to make this possible.
```bash ```bash
$ $cg_clif_dir/build/cargo jit $ $cg_clif_dir/build/cargo-clif jit
``` ```
or or
@ -45,7 +45,7 @@ There is also an experimental lazy jit mode. In this mode functions are only com
first called. first called.
```bash ```bash
$ $cg_clif_dir/build/cargo lazy-jit $ $cg_clif_dir/build/cargo-clif lazy-jit
``` ```
## Shell ## Shell

View File

@ -80,73 +80,73 @@ function base_sysroot_tests() {
function extended_sysroot_tests() { function extended_sysroot_tests() {
pushd rand pushd rand
../build/cargo clean ../build/cargo-clif clean
if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
echo "[TEST] rust-random/rand" echo "[TEST] rust-random/rand"
../build/cargo test --workspace ../build/cargo-clif test --workspace
else else
echo "[AOT] rust-random/rand" echo "[AOT] rust-random/rand"
../build/cargo build --workspace --target $TARGET_TRIPLE --tests ../build/cargo-clif build --workspace --target $TARGET_TRIPLE --tests
fi fi
popd popd
pushd simple-raytracer pushd simple-raytracer
if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
echo "[BENCH COMPILE] ebobby/simple-raytracer" echo "[BENCH COMPILE] ebobby/simple-raytracer"
hyperfine --runs "${RUN_RUNS:-10}" --warmup 1 --prepare "../build/cargo clean" \ hyperfine --runs "${RUN_RUNS:-10}" --warmup 1 --prepare "../build/cargo-clif clean" \
"RUSTC=rustc RUSTFLAGS='' cargo build" \ "RUSTC=rustc RUSTFLAGS='' cargo build" \
"../build/cargo build" "../build/cargo-clif build"
echo "[BENCH RUN] ebobby/simple-raytracer" echo "[BENCH RUN] ebobby/simple-raytracer"
cp ./target/debug/main ./raytracer_cg_clif cp ./target/debug/main ./raytracer_cg_clif
hyperfine --runs "${RUN_RUNS:-10}" ./raytracer_cg_llvm ./raytracer_cg_clif hyperfine --runs "${RUN_RUNS:-10}" ./raytracer_cg_llvm ./raytracer_cg_clif
else else
../build/cargo clean ../build/cargo-clif clean
echo "[BENCH COMPILE] ebobby/simple-raytracer (skipped)" echo "[BENCH COMPILE] ebobby/simple-raytracer (skipped)"
echo "[COMPILE] ebobby/simple-raytracer" echo "[COMPILE] ebobby/simple-raytracer"
../build/cargo build --target $TARGET_TRIPLE ../build/cargo-clif build --target $TARGET_TRIPLE
echo "[BENCH RUN] ebobby/simple-raytracer (skipped)" echo "[BENCH RUN] ebobby/simple-raytracer (skipped)"
fi fi
popd popd
pushd build_sysroot/sysroot_src/library/core/tests pushd build_sysroot/sysroot_src/library/core/tests
echo "[TEST] libcore" echo "[TEST] libcore"
../../../../../build/cargo clean ../../../../../build/cargo-clif clean
if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
../../../../../build/cargo test ../../../../../build/cargo-clif test
else else
../../../../../build/cargo build --target $TARGET_TRIPLE --tests ../../../../../build/cargo-clif build --target $TARGET_TRIPLE --tests
fi fi
popd popd
pushd regex pushd regex
echo "[TEST] rust-lang/regex example shootout-regex-dna" echo "[TEST] rust-lang/regex example shootout-regex-dna"
../build/cargo clean ../build/cargo-clif clean
export RUSTFLAGS="$RUSTFLAGS --cap-lints warn" # newer aho_corasick versions throw a deprecation warning export RUSTFLAGS="$RUSTFLAGS --cap-lints warn" # newer aho_corasick versions throw a deprecation warning
# Make sure `[codegen mono items] start` doesn't poison the diff # Make sure `[codegen mono items] start` doesn't poison the diff
../build/cargo build --example shootout-regex-dna --target $TARGET_TRIPLE ../build/cargo-clif build --example shootout-regex-dna --target $TARGET_TRIPLE
if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
cat examples/regexdna-input.txt \ cat examples/regexdna-input.txt \
| ../build/cargo run --example shootout-regex-dna --target $TARGET_TRIPLE \ | ../build/cargo-clif run --example shootout-regex-dna --target $TARGET_TRIPLE \
| grep -v "Spawned thread" > res.txt | grep -v "Spawned thread" > res.txt
diff -u res.txt examples/regexdna-output.txt diff -u res.txt examples/regexdna-output.txt
fi fi
if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
echo "[TEST] rust-lang/regex tests" echo "[TEST] rust-lang/regex tests"
../build/cargo test --tests -- --exclude-should-panic --test-threads 1 -Zunstable-options -q ../build/cargo-clif test --tests -- --exclude-should-panic --test-threads 1 -Zunstable-options -q
else else
echo "[AOT] rust-lang/regex tests" echo "[AOT] rust-lang/regex tests"
../build/cargo build --tests --target $TARGET_TRIPLE ../build/cargo-clif build --tests --target $TARGET_TRIPLE
fi fi
popd popd
pushd portable-simd pushd portable-simd
echo "[TEST] rust-lang/portable-simd" echo "[TEST] rust-lang/portable-simd"
../build/cargo clean ../build/cargo-clif clean
../build/cargo build --all-targets --target $TARGET_TRIPLE ../build/cargo-clif build --all-targets --target $TARGET_TRIPLE
if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
../build/cargo test -q ../build/cargo-clif test -q
fi fi
popd popd
} }