build: Handle output files better
This commit is contained in:
14
cargo.sh
14
cargo.sh
@ -11,15 +11,21 @@ SOURCE_DIR="$(dirname "$SCRIPT_PATH")"
|
||||
|
||||
CARGO_TARGET_DIR="$(pwd)"
|
||||
export CARGO_TARGET_DIR
|
||||
if [ -n "${1}" ]; then
|
||||
OUT_PATH="$(realpath "$1")"
|
||||
if [ "${1}" = "--rename" ]; then
|
||||
shift
|
||||
FILENAME="${1}"
|
||||
shift
|
||||
OUT_PATH="$(realpath "${1}")"
|
||||
elif [ "${1}" = "--output" ]; then
|
||||
shift
|
||||
OUT_PATH="$(realpath "${1}")"
|
||||
FILENAME="$(basename "${OUT_PATH}")"
|
||||
fi
|
||||
shift
|
||||
|
||||
cd "$SOURCE_DIR"
|
||||
shift
|
||||
cargo "$@"
|
||||
|
||||
if [ -n "${OUT_PATH}" ]; then
|
||||
FILENAME="$(basename "${OUT_PATH}")"
|
||||
cp -a "${CARGO_TARGET_DIR}"/debug/"${FILENAME}" "${OUT_PATH}"
|
||||
fi
|
||||
|
||||
@ -58,7 +58,7 @@ rslibs = custom_target(
|
||||
output: ['librs.a'],
|
||||
install: false,
|
||||
console: true,
|
||||
command: [cargo_script, '@OUTPUT@', 'build', '--lib']
|
||||
command: [cargo_script, '--output', '@OUTPUT@', 'build', '--lib']
|
||||
)
|
||||
|
||||
build_rstests = custom_target(
|
||||
@ -129,8 +129,8 @@ test_layout = custom_target('squeekboard_test_layout',
|
||||
build_by_default: true,
|
||||
# meson doesn't track all inputs, cargo does
|
||||
build_always_stale: true,
|
||||
output: ['test_layout'],
|
||||
output: ['squeekboard_test_layout'],
|
||||
console: true,
|
||||
command: [cargo_script, '@OUTPUT@', 'build', '--bin', 'test_layout'],
|
||||
command: [cargo_script, '--rename', 'test_layout', '@OUTPUT@', 'build', '--bin', 'test_layout'],
|
||||
install_dir: bindir,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user