build: Simplified the calling of cargo.sh

This commit is contained in:
Dorota Czaplejewicz
2019-09-24 11:26:22 +00:00
parent 169f33c67a
commit e7d30d933f
4 changed files with 9 additions and 9 deletions

View File

@ -42,7 +42,7 @@ Use the `cargo.sh` script for maintaining the Cargo part of the build. The scrip
``` ```
cd build_dir cd build_dir
sh /source_path/cargo.sh /source_path '' test sh /source_path/cargo.sh '' test
``` ```
### Cargo dependencies ### Cargo dependencies
@ -53,6 +53,6 @@ Dependencies must be specified in `Cargo.toml` with 2 numbers: "major.minor". Si
``` ```
cd build_dir cd build_dir
sh /source_path/cargo.sh /source_path '' update sh /source_path/cargo.sh '' update
ninja test ninja test
``` ```

8
cargo.sh Normal file → Executable file
View File

@ -6,16 +6,16 @@
set -e set -e
SOURCE_DIR="$1" SCRIPT_PATH=`realpath $0`
SOURCE_DIR=`dirname $0`
export CARGO_TARGET_DIR=`pwd` export CARGO_TARGET_DIR=`pwd`
if [ ! -z ${2} ]; then if [ ! -z ${1} ]; then
OUT_PATH=`realpath "${2}"` OUT_PATH=`realpath "${1}"`
fi fi
cd $SOURCE_DIR cd $SOURCE_DIR
shift shift
shift
cargo $BUILD_ARG $@ cargo $BUILD_ARG $@
if [ ! -z ${OUT_PATH} ]; then if [ ! -z ${OUT_PATH} ]; then

View File

@ -60,13 +60,13 @@ rslibs = custom_target(
output: ['librs.a'], output: ['librs.a'],
install: false, install: false,
console: true, console: true,
command: [cargo_script, '@CURRENT_SOURCE_DIR@', '@OUTPUT@', 'build'] command: [cargo_script, '@OUTPUT@', 'build']
) )
test( test(
'rstest', 'rstest',
cargo_script, cargo_script,
args: [meson.source_root(), '', 'test'] args: ['', 'test']
) )
libsqueekboard = static_library('libsqueekboard', libsqueekboard = static_library('libsqueekboard',

View File

@ -51,7 +51,7 @@ foreach layout : ['us', 'nb', 'number']
test( test(
'test_layout_' + layout, 'test_layout_' + layout,
cargo_script, cargo_script,
args: [meson.source_root(), '', 'run', '--example', 'test_layout', layout] args: ['', 'run', '--example', 'test_layout', layout]
) )
endforeach endforeach