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() {
14
14
export NEURON_BUFFER_ALLOCATOR_LIB=${MEDIATEK_SDK_ROOT} /libneuron_buffer_allocator.so
15
15
export EXECUTORCH_ROOT=" $( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) /../.." && pwd) "
16
16
17
-
18
17
cd ${EXECUTORCH_ROOT}
19
18
./backends/mediatek/scripts/mtk_build.sh
19
+ ./examples/mediatek/mtk_build_examples.sh
20
20
}
21
21
22
22
build_neuron_backend
Original file line number Diff line number Diff line change 4
4
set -e
5
5
6
6
# 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}
8
9
9
10
# Check if the ANDROID_NDK environment variable is set
10
11
if [ -z " $ANDROID_NDK " ]; then
11
12
echo " Error: ANDROID_NDK environment variable is not set." >&2
12
13
exit 1
13
14
fi
14
15
15
- # Create and enter the build directory
16
+ # Enter the build directory
17
+ cd " $EXECUTORCH_ROOT "
18
+
16
19
# Set build directory
17
20
build_dir=" cmake-android-out"
18
- cd " $SOURCE_DIR "
19
21
rm -rf " ${build_dir} "
20
22
21
23
# Configure the project with CMake
Original file line number Diff line number Diff line change @@ -28,6 +28,8 @@ examples/mediatek
28
28
## Environment Setup
29
29
- Follow the instructions of ** Prerequisites** and ** Setup** in ` backends/mediatek/scripts/README.md ` .
30
30
31
+ - Build required libraries by ` backends/mediatek/scripts/mtk_build.sh ` before building examples.
32
+
31
33
## Build MediaTek Examples
32
34
1 . Build the backend and the examples by exedcuting the script:
33
35
``` bash
Original file line number Diff line number Diff line change @@ -14,29 +14,18 @@ if [ -z "$ANDROID_NDK" ]; then
14
14
fi
15
15
16
16
main () {
17
- # Set build directory
18
- local build_dir=" cmake-android-out"
19
-
20
- # Create and enter the build directory
17
+ # Enter the build directory
21
18
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} "
36
19
20
+ # Set build directory
21
+ local build_dir=" cmake-android-out"
37
22
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
40
29
41
30
# # Build example
42
31
local example_dir=examples/mediatek
You can’t perform that action at this time.
0 commit comments