podcasts/scripts/cargo.sh
Christopher Davis 7a77f31aa3
build: Place target in meson build dir
Instead of putting target/ and target_test/ in the source
directory, we can tell our cargo script to put both target
and our cargo-home in meson's build directory.

In addition, makes tests and builds use the same target
directory, significantly reducing the time it takes to run tests.
2019-03-07 07:04:23 +02:00

26 lines
477 B
Bash
Executable File

#!/bin/bash
set -ex
export OUTPUT="$2"
export CARGO_TARGET_DIR="$3"/target
export CARGO_HOME="$CARGO_TARGET_DIR"/cargo-home
export PROFILE="$4"
TARGET=debug
ARGS=()
if test "$PROFILE" != "Devel"; then
echo "RELEASE MODE"
ARGS+=('--release')
TARGET=release
fi
if test -d vendor; then
echo "VENDORED"
ARGS+=('--frozen')
fi
cargo build ${ARGS[@]} --manifest-path="$1"/Cargo.toml -p podcasts-gtk &&
cp "$CARGO_TARGET_DIR"/${TARGET}/podcasts-gtk "$OUTPUT"