-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·60 lines (53 loc) · 1.41 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·60 lines (53 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
set -euo pipefail
usage() {
cat <<EOF
Usage: $0 [--conan [profile]] [--build-dir DIR] [MESON_OPTIONS...]
Options:
--conan [profile] Resolve dependencies with Conan (default profile: default).
--build-dir DIR Build directory (default: "build").
-h, --help Show this help.
Dependencies are resolved from system packages and Meson subprojects.
Remaining arguments are forwarded to meson setup.
EOF
}
build_folder="build"
use_conan=false
conan_profile="default"
meson_options=()
while [[ $# -gt 0 ]]; do
case "$1" in
--conan)
use_conan=true
if [[ -n "${2:-}" && "${2:0:1}" != "-" ]]; then
conan_profile="$2"
shift
fi
;;
--build-dir)
if [[ -z "${2:-}" ]]; then
echo "--build-dir requires a value" >&2
exit 1
fi
build_folder="$2"
shift
;;
-h|--help)
usage
exit 0
;;
*)
meson_options+=("$1")
;;
esac
shift
done
if $use_conan; then
conan install . \
--output-folder="$build_folder/conan" \
--build=missing \
--profile="$conan_profile"
meson_options+=("--native-file" "$build_folder/conan/conan_meson_native.ini")
fi
meson setup "$build_folder" "${meson_options[@]}"
meson compile -C "$build_folder"