@@ -16,18 +16,17 @@ et_root_dir=$(realpath ${et_root_dir})
16
16
toolchain_cmake=${script_dir} /../../../examples/arm/ethos-u-setup/arm-none-eabi-gcc.cmake
17
17
toolchain_cmake=$( realpath ${toolchain_cmake} )
18
18
19
-
20
-
21
19
et_build_root=" ${et_root_dir} /arm_test"
22
20
build_type=" Release"
21
+ build_devtools=false
23
22
build_with_etdump=false
24
23
25
-
26
24
help () {
27
25
echo " Usage: $( basename $0 ) [options]"
28
26
echo " Options:"
29
27
echo " --et_build_root=<FOLDER> Build output root folder to use, defaults to ${et_build_root} "
30
28
echo " --build_type=<TYPE> Build with Release, Debug or RelWithDebInfo, default is ${build_type} "
29
+ echo " --devtools Build Devtools libs"
31
30
echo " --etdump Adds Devtools etdump support to track timing, etdump area will be base64 encoded in the log"
32
31
exit 0
33
32
}
@@ -37,32 +36,33 @@ for arg in "$@"; do
37
36
-h|--help) help ;;
38
37
--et_build_root=* ) et_build_root=" ${arg#* =} " ;;
39
38
--build_type=* ) build_type=" ${arg#* =} " ;;
39
+ --devtools) build_devtools=true ;;
40
40
--etdump) build_with_etdump=true ;;
41
41
* )
42
42
;;
43
43
esac
44
44
done
45
45
46
46
et_build_dir=" ${et_build_root} /cmake-out"
47
+
48
+ # Used for flatcc host excutable if Devtools is used
47
49
et_build_host_dir=${et_build_root} /cmake-out-host-tools
48
50
49
51
set -x
50
52
cd " ${et_root_dir} "
51
53
52
- build_with_etdump_flags=" "
53
54
if [ " $build_with_etdump " = true ] ; then
54
55
( set +x ;
55
56
echo " --------------------------------------------------------------------------------" ;
56
- echo " Build ExecuTorch Libraries host flatcc bin ${build_type} into ${et_build_host_dir} - ${et_build_host_dir} /bin/flatcc" ;
57
+ echo " Build ExecuTorch Libraries host flatcc bin ${build_type} into ${et_build_host_dir} /bin/flatcc" ;
57
58
echo " --------------------------------------------------------------------------------" )
58
59
59
-
60
60
# Build host flatcc bin
61
61
# This is a way to work around that the flatcc executable get build for target (e.g. Arm) later
62
62
# and get replaced. flatcc is a tool used on the host for etdump and BundleIO handling.
63
63
# The way to solve this is to generate it once for the host, then copy it to ${et_build_host_dir}/bin
64
64
# and later point that out with -DFLATCC_EXECUTABLE=${et_build_host_dir}/bin/flatcc later.
65
- mkdir -p ${et_build_host_dir}
65
+
66
66
cmake \
67
67
-DCMAKE_INSTALL_PREFIX=${et_build_host_dir} \
68
68
-DCMAKE_BUILD_TYPE=${build_type} \
@@ -79,25 +79,39 @@ if [ "$build_with_etdump" = true ] ; then
79
79
-B" ${et_build_host_dir} " \
80
80
" ${et_root_dir} "
81
81
82
- # Copy host flatcc excutable to it's saved when we build for target (Arm) later
82
+ # third-party/flatcc/bin/flatcc gets build already in the in the cmake config step above
83
+ # so there is no cmake building step done
84
+
85
+ # Copy host flatcc excutable so it's saved when we build for target (Arm) later
86
+ et_build_host_dir=$( realpath ${et_build_host_dir} )
83
87
mkdir -p ${et_build_host_dir} /bin
84
88
cp third-party/flatcc/bin/flatcc ${et_build_host_dir} /bin
85
-
86
- # Add DevTools flags use in the Target build below
87
- build_with_etdump_flags=" -DEXECUTORCH_BUILD_DEVTOOLS=ON \
88
- -DEXECUTORCH_ENABLE_EVENT_TRACER=ON \
89
- -DEXECUTORCH_SEPARATE_FLATCC_HOST_PROJECT=OFF \
90
- -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=OFF \
91
- -DFLATCC_ALLOW_WERROR=OFF \
92
- -DFLATCC_EXECUTABLE=${et_build_host_dir} /bin/flatcc "
93
- echo " build_with_etdump_flags=$build_with_etdump_flags "
94
89
fi
95
90
96
91
( set +x ;
97
92
echo " --------------------------------------------------------------------------------" ;
98
93
echo " Build ExecuTorch target libs ${build_type} into '${et_build_dir} '" ;
99
94
echo " --------------------------------------------------------------------------------" )
100
95
96
+ build_devtools_flags=" -DEXECUTORCH_BUILD_DEVTOOLS=OFF "
97
+ if [ " $build_devtools " = true ] ; then
98
+ build_devtools_flags=" -DEXECUTORCH_BUILD_DEVTOOLS=ON "
99
+ fi
100
+
101
+ build_with_etdump_flags=" -DEXECUTORCH_ENABLE_EVENT_TRACER=OFF "
102
+ if [ " $build_with_etdump " = true ] ; then
103
+ # Add DevTools flags use in the Target build below
104
+ build_with_etdump_flags=" -DEXECUTORCH_BUILD_DEVTOOLS=ON \
105
+ -DEXECUTORCH_ENABLE_EVENT_TRACER=ON \
106
+ -DEXECUTORCH_SEPARATE_FLATCC_HOST_PROJECT=OFF \
107
+ -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=OFF \
108
+ -DFLATCC_ALLOW_WERROR=OFF \
109
+ -DFLATCC_EXECUTABLE=${et_build_host_dir} /bin/flatcc "
110
+ fi
111
+
112
+ echo " Building with Devtools: ${build_devtools_flags} ${build_with_etdump_flags} "
113
+
114
+
101
115
# Build
102
116
cmake \
103
117
-DCMAKE_INSTALL_PREFIX=${et_build_dir} \
@@ -108,6 +122,7 @@ cmake \
108
122
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \
109
123
-DEXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL=ON \
110
124
-DEXECUTORCH_ENABLE_LOGGING=ON \
125
+ ${build_devtools_flags} \
111
126
${build_with_etdump_flags} \
112
127
-DFLATC_EXECUTABLE=" $( which flatc) " \
113
128
-B" ${et_build_dir} " \
0 commit comments