From 919037495f7954267bae922174971ddef46d4e8c Mon Sep 17 00:00:00 2001 From: Christopher Davis Date: Mon, 22 Apr 2019 01:54:26 -0400 Subject: [PATCH] build: Place target in meson build dir Instead of putting target/ and in the source directory, we can tell our cargo script to put both target and our cargo-home in meson's build directory. This means that when triggering a rebuild through meson via tooling like Builder, Fractal will actually rebuild. --- .gitlab-ci.yml | 2 +- fractal-gtk/src/meson.build | 1 + scripts/cargo.sh | 10 ++++++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 72e5cfea..fac6a915 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,7 +16,7 @@ variables: key: "flatpak" paths: - .flatpak-builder/cache/ - - target/ + - _build/target/ - target_docs/ - target_test/ diff --git a/fractal-gtk/src/meson.build b/fractal-gtk/src/meson.build index 2e3a82bf..d529fb9e 100644 --- a/fractal-gtk/src/meson.build +++ b/fractal-gtk/src/meson.build @@ -46,6 +46,7 @@ cargo_release = custom_target('cargo-build', command: [cargo_script, '@SOURCE_ROOT@', '@OUTPUT@', + meson.build_root(), profile ]) diff --git a/scripts/cargo.sh b/scripts/cargo.sh index 7d4051a1..a8c7763e 100755 --- a/scripts/cargo.sh +++ b/scripts/cargo.sh @@ -1,13 +1,15 @@ #!/bin/sh -export CARGO_HOME=$1/target/cargo-home -export FRACTAL_PROFILE="$3" +export OUTPUT="$2" +export CARGO_TARGET_DIR="$3"/target +export CARGO_HOME="$CARGO_TARGET_DIR"/cargo-home +export FRACTAL_PROFILE="$4" if [ "$FRACTAL_PROFILE" = "Devel" ] then echo "DEBUG MODE" - cargo build --manifest-path $1/Cargo.toml -p fractal-gtk && cp $1/target/debug/fractal-gtk $2 + cargo build --manifest-path $1/Cargo.toml -p fractal-gtk && cp "$CARGO_TARGET_DIR"/debug/fractal-gtk "$OUTPUT" else echo "RELEASE MODE" - cargo build --manifest-path $1/Cargo.toml --release -p fractal-gtk && cp $1/target/release/fractal-gtk $2 + cargo build --manifest-path $1/Cargo.toml --release -p fractal-gtk && cp "$CARGO_TARGET_DIR"/release/fractal-gtk "$OUTPUT" fi