Skip to content

Commit 864ae45

Browse files
TEST: change build-tools.sh to newest version
tldr Signed-off-by: Kamil Paszkiet <[email protected]>
1 parent 246a4cb commit 864ae45

File tree

1 file changed

+63
-42
lines changed

1 file changed

+63
-42
lines changed

scripts/build-tools.sh

Lines changed: 63 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,28 @@ SOF_TOP=$(cd "$(dirname "$0")/.." && pwd)
1010
print_usage()
1111
{
1212
cat <<EOFUSAGE
13-
Deletes and re-builds from scratch CMake projects in the tools/
14-
directory.
15-
Attention: the list below is _not_ exhaustive. To re-build _everything_
16-
from scratch don't select any particular target; this will build the
13+
14+
Configures and builds selected CMake projects in the tools/ directory.
15+
Attention: the list of selected shortcuts below is _not_ exhaustive. To
16+
build _everything_ don't select any particular target; this will build
1717
CMake's default target "ALL".
1818
19-
usage: $0 [-c|-f|-h|-l|-p|-t|-T]
19+
usage: $0 [-c|-f|-h|-l|-p|-t|-T|-X|-Y|-A]
2020
-h Display help
2121
2222
-c Rebuild ctl/
23-
-f Rebuild fuzzer/ # deprecated, see fuzzer/README.md
2423
-l Rebuild logger/
2524
-p Rebuild probes/
2625
-T Rebuild topology/ (not topology/development/! Use ALL)
26+
-X Rebuild topology1 only
27+
-Y Rebuild topology2 only
2728
-t Rebuild test/topology/ (or tools/test/topology/tplg-build.sh directly)
29+
-A Clone and rebuild local ALSA lib and utils.
2830
2931
-C No build, only CMake re-configuration. Shows CMake targets.
3032
EOFUSAGE
33+
34+
warn_if_incremental_build
3135
}
3236

3337
# generate Makefiles
@@ -37,12 +41,7 @@ reconfigure_build()
3741
mkdir -p "$BUILD_TOOLS_DIR"
3842

3943
( cd "$BUILD_TOOLS_DIR"
40-
cmake -DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" "${SOF_REPO}/tools"
41-
)
42-
43-
mkdir "$BUILD_TOOLS_DIR/fuzzer"
44-
( cd "$BUILD_TOOLS_DIR/fuzzer"
45-
cmake -DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" "${SOF_REPO}/tools/fuzzer"
44+
cmake -GNinja -DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" "${SOF_REPO}/tools"
4645
)
4746
}
4847

@@ -58,37 +57,45 @@ make_tool()
5857
)
5958
}
6059

61-
make_fuzzer()
62-
{
63-
( set -x
64-
cmake --build "$BUILD_TOOLS_DIR"/fuzzer -- -j "$NO_PROCESSORS"
65-
)
66-
}
67-
6860
print_build_info()
6961
{
7062
cat <<EOFUSAGE
7163
7264
Build commands for respective tools:
73-
ctl: make -C "$BUILD_TOOLS_DIR" sof-ctl
74-
logger: make -C "$BUILD_TOOLS_DIR" sof-logger
75-
probes: make -C "$BUILD_TOOLS_DIR" sof-probes
76-
topologies: make -C "$BUILD_TOOLS_DIR" topologies
77-
test tplgs: make -C "$BUILD_TOOLS_DIR" tests
65+
ctl: ninja -C "$BUILD_TOOLS_DIR" sof-ctl
66+
logger: ninja -C "$BUILD_TOOLS_DIR" sof-logger
67+
probes: ninja -C "$BUILD_TOOLS_DIR" sof-probes
68+
topologies: ninja -C "$BUILD_TOOLS_DIR" topologies
69+
topologies1: ninja -C "$BUILD_TOOLS_DIR" topologies1
70+
topologies2: ninja -C "$BUILD_TOOLS_DIR" topologies2
71+
72+
test tplgs: ninja -C "$BUILD_TOOLS_DIR" tests
7873
(or ./tools/test/topology/tplg-build.sh directly)
7974
80-
fuzzer: make -C "$BUILD_TOOLS_DIR/fuzzer"
81-
8275
list of targets:
83-
make -C "$BUILD_TOOLS_DIR/" help
76+
ninja -C "$BUILD_TOOLS_DIR/" help
8477
EOFUSAGE
78+
79+
warn_if_incremental_build
80+
}
81+
82+
warn_if_incremental_build()
83+
{
84+
$warn_incremental_build || return 0
85+
cat <<EOF
86+
87+
WARNING: building tools/ is now incremental by default!
88+
To build from scratch delete: $BUILD_TOOLS_DIR
89+
or use the -C option.
90+
91+
EOF
8592
}
8693

8794
main()
8895
{
89-
local DO_BUILD_ctl DO_BUILD_fuzzer DO_BUILD_logger DO_BUILD_probes \
90-
DO_BUILD_tests DO_BUILD_topologies SCRIPT_DIR SOF_REPO CMAKE_ONLY \
91-
BUILD_ALL
96+
local DO_BUILD_ctl DO_BUILD_logger DO_BUILD_probes \
97+
DO_BUILD_tests DO_BUILD_topologies1 DO_BUILD_topologies2 SCRIPT_DIR SOF_REPO \
98+
CMAKE_ONLY BUILD_ALL
9299
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
93100
SOF_REPO=$(dirname "$SCRIPT_DIR")
94101
: "${BUILD_TOOLS_DIR:=$SOF_REPO/tools/build_tools}"
@@ -100,46 +107,62 @@ main()
100107
fi
101108

102109
DO_BUILD_ctl=false
103-
DO_BUILD_fuzzer=false
110+
DO_BUILD_alsa=false
104111
DO_BUILD_logger=false
105112
DO_BUILD_probes=false
106113
DO_BUILD_tests=false
107-
DO_BUILD_topologies=false
114+
DO_BUILD_topologies1=false
115+
DO_BUILD_topologies2=false
108116
CMAKE_ONLY=false
109117

118+
# better safe than sorry
119+
local warn_incremental_build=true
120+
110121
# eval is a sometimes necessary evil
111122
# shellcheck disable=SC2034
112-
while getopts "cfhlptTC" OPTION; do
123+
while getopts "cfhlptTCXYA" OPTION; do
113124
case "$OPTION" in
114125
c) DO_BUILD_ctl=true ;;
115-
f) DO_BUILD_fuzzer=true ;;
116126
l) DO_BUILD_logger=true ;;
117127
p) DO_BUILD_probes=true ;;
118128
t) DO_BUILD_tests=true ;;
119-
T) DO_BUILD_topologies=true ;;
129+
T) DO_BUILD_topologies1=true ; DO_BUILD_topologies2=true ;;
130+
X) DO_BUILD_topologies1=true ;;
131+
Y) DO_BUILD_topologies2=true ;;
120132
C) CMAKE_ONLY=true ;;
133+
A) DO_BUILD_alsa=true ;;
121134
h) print_usage; exit 1;;
122135
*) print_usage; exit 1;;
123136
esac
124137
done
125138
shift "$((OPTIND - 1))"
126-
reconfigure_build
139+
140+
if "$DO_BUILD_alsa"; then
141+
$SOF_TOP/scripts/build-alsa-tools.sh
142+
fi
127143

128144
if "$CMAKE_ONLY"; then
145+
reconfigure_build
129146
print_build_info
130147
exit
131148
fi
132149

150+
test -e "$BUILD_TOOLS_DIR"/build.ninja ||
151+
test -e "$BUILD_TOOLS_DIR"/Makefile || {
152+
warn_incremental_build=false
153+
reconfigure_build
154+
}
155+
133156
if "$BUILD_ALL"; then
134157
# default CMake targets
135158
make_tool # trust set -e
136159

137-
make_fuzzer
138-
exit $?
160+
warn_if_incremental_build
161+
exit 0
139162
fi
140163

141164
# Keep 'topologies' first because it's the noisiest.
142-
for util in topologies tests; do
165+
for util in topologies1 topologies2 tests; do
143166
if eval '$DO_BUILD_'$util; then
144167
make_tool $util
145168
fi
@@ -151,9 +174,7 @@ main()
151174
fi
152175
done
153176

154-
if "$DO_BUILD_fuzzer"; then
155-
make_fuzzer
156-
fi
177+
warn_if_incremental_build
157178
}
158179

159180
main "$@"

0 commit comments

Comments
 (0)