File tree Expand file tree Collapse file tree 4 files changed +17
-24
lines changed
backends/mediatek/scripts Expand file tree Collapse file tree 4 files changed +17
-24
lines changed Original file line number Diff line number Diff line change @@ -14,9 +14,9 @@ build_neuron_backend() {
1414 export NEURON_BUFFER_ALLOCATOR_LIB=${MEDIATEK_SDK_ROOT} /libneuron_buffer_allocator.so
1515 export EXECUTORCH_ROOT=" $( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) /../.." && pwd) "
1616
17-
1817 cd ${EXECUTORCH_ROOT}
1918 ./backends/mediatek/scripts/mtk_build.sh
19+ ./examples/mediatek/mtk_build_examples.sh
2020}
2121
2222build_neuron_backend
Original file line number Diff line number Diff line change 44set -e
55
66# Define the directory where CMakeLists.txt is located
7- SOURCE_DIR=$( realpath " $( dirname " $0 " ) /../../.." )
7+ EXECUTORCH_ROOT=$( realpath " $( dirname " $0 " ) /../../.." )
8+ echo EXECUTORCH_ROOT=${EXECUTORCH_ROOT}
89
910# Check if the ANDROID_NDK environment variable is set
1011if [ -z " $ANDROID_NDK " ]; then
1112 echo " Error: ANDROID_NDK environment variable is not set." >&2
1213 exit 1
1314fi
1415
15- # Create and enter the build directory
16+ # Enter the build directory
17+ cd " $EXECUTORCH_ROOT "
18+
1619# Set build directory
1720build_dir=" cmake-android-out"
18- cd " $SOURCE_DIR "
1921rm -rf " ${build_dir} "
2022
2123# Configure the project with CMake
Original file line number Diff line number Diff line change @@ -28,6 +28,8 @@ examples/mediatek
2828## Environment Setup
2929- Follow the instructions of ** Prerequisites** and ** Setup** in ` backends/mediatek/scripts/README.md ` .
3030
31+ - Build required libraries by ` backends/mediatek/scripts/mtk_build.sh ` before building examples.
32+
3133## Build MediaTek Examples
32341 . Build the backend and the examples by exedcuting the script:
3335``` bash
Original file line number Diff line number Diff line change @@ -14,29 +14,18 @@ if [ -z "$ANDROID_NDK" ]; then
1414fi
1515
1616main () {
17- # Set build directory
18- local build_dir=" cmake-android-out"
19-
20- # Create and enter the build directory
17+ # Enter the build directory
2118 cd " $EXECUTORCH_ROOT "
22- rm -rf " ${build_dir} "
23-
24- # Configure the project with CMake
25- # Note: Add any additional configuration options you need here
26- cmake -DCMAKE_INSTALL_PREFIX=" ${build_dir} " \
27- -DCMAKE_TOOLCHAIN_FILE=" $ANDROID_NDK /build/cmake/android.toolchain.cmake" \
28- -DANDROID_ABI=arm64-v8a \
29- -DANDROID_NATIVE_API_LEVEL=26 \
30- -DANDROID_PLATFORM=android-26 \
31- -DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
32- -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
33- -DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \
34- -DEXECUTORCH_BUILD_NEURON=ON \
35- -B" ${build_dir} "
3619
20+ # Set build directory
21+ local build_dir=" cmake-android-out"
3722
38- # Build the project
39- cmake --build " ${build_dir} " --target install --config Release -j5
23+ # Check if the build directory exists
24+ if [ ! -d " $EXECUTORCH_ROOT /$build_dir " ]; then
25+ echo " Error: Build directory '$build_dir ' does not exist."
26+ echo " Please build MTK backend before running this script."
27+ exit 1
28+ fi
4029
4130 # # Build example
4231 local example_dir=examples/mediatek
You can’t perform that action at this time.
0 commit comments