@@ -16,18 +16,17 @@ et_root_dir=$(realpath ${et_root_dir})
1616toolchain_cmake=${script_dir} /../../../examples/arm/ethos-u-setup/arm-none-eabi-gcc.cmake
1717toolchain_cmake=$( realpath ${toolchain_cmake} )
1818
19-
20-
2119et_build_root=" ${et_root_dir} /arm_test"
2220build_type=" Release"
21+ build_devtools=false
2322build_with_etdump=false
2423
25-
2624help () {
2725 echo " Usage: $( basename $0 ) [options]"
2826 echo " Options:"
2927 echo " --et_build_root=<FOLDER> Build output root folder to use, defaults to ${et_build_root} "
3028 echo " --build_type=<TYPE> Build with Release, Debug or RelWithDebInfo, default is ${build_type} "
29+ echo " --devtools Build Devtools libs"
3130 echo " --etdump Adds Devtools etdump support to track timing, etdump area will be base64 encoded in the log"
3231 exit 0
3332}
@@ -37,32 +36,33 @@ for arg in "$@"; do
3736 -h|--help) help ;;
3837 --et_build_root=* ) et_build_root=" ${arg#* =} " ;;
3938 --build_type=* ) build_type=" ${arg#* =} " ;;
39+ --devtools) build_devtools=true ;;
4040 --etdump) build_with_etdump=true ;;
4141 * )
4242 ;;
4343 esac
4444done
4545
4646et_build_dir=" ${et_build_root} /cmake-out"
47+
48+ # Used for flatcc host excutable if Devtools is used
4749et_build_host_dir=${et_build_root} /cmake-out-host-tools
4850
4951set -x
5052cd " ${et_root_dir} "
5153
52- build_with_etdump_flags=" "
5354if [ " $build_with_etdump " = true ] ; then
5455 ( set +x ;
5556 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" ;
5758 echo " --------------------------------------------------------------------------------" )
5859
59-
6060 # Build host flatcc bin
6161 # This is a way to work around that the flatcc executable get build for target (e.g. Arm) later
6262 # and get replaced. flatcc is a tool used on the host for etdump and BundleIO handling.
6363 # The way to solve this is to generate it once for the host, then copy it to ${et_build_host_dir}/bin
6464 # and later point that out with -DFLATCC_EXECUTABLE=${et_build_host_dir}/bin/flatcc later.
65- mkdir -p ${et_build_host_dir}
65+
6666 cmake \
6767 -DCMAKE_INSTALL_PREFIX=${et_build_host_dir} \
6868 -DCMAKE_BUILD_TYPE=${build_type} \
@@ -79,25 +79,39 @@ if [ "$build_with_etdump" = true ] ; then
7979 -B" ${et_build_host_dir} " \
8080 " ${et_root_dir} "
8181
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} )
8387 mkdir -p ${et_build_host_dir} /bin
8488 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 "
9489fi
9590
9691( set +x ;
9792 echo " --------------------------------------------------------------------------------" ;
9893 echo " Build ExecuTorch target libs ${build_type} into '${et_build_dir} '" ;
9994 echo " --------------------------------------------------------------------------------" )
10095
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+
101115# Build
102116cmake \
103117 -DCMAKE_INSTALL_PREFIX=${et_build_dir} \
@@ -108,6 +122,7 @@ cmake \
108122 -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \
109123 -DEXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL=ON \
110124 -DEXECUTORCH_ENABLE_LOGGING=ON \
125+ ${build_devtools_flags} \
111126 ${build_with_etdump_flags} \
112127 -DFLATC_EXECUTABLE=" $( which flatc) " \
113128 -B" ${et_build_dir} " \
0 commit comments