Intelligent Assistant
Chat with our virtual assistant to get answers promptly.
When building the NAPI of the inference model, for example, in a NPU-based scenario, you need to pack libhiai.so, libhiai_ir.so (optional), libhiai_ir_build.so (optional), libhiai_ir_build_aipp.so (optional), and libentry.so when packing the HAP, where libentry.so is the binary file for the demo packed using NAPI.
The CMakeLists.txt file is as follows:
# Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved.
# the minimum version of CMake.
cmake_minimum_required(VERSION 3.4.1)
project(CANNDemo)
set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${NATIVERENDER_ROOT_PATH}
${NATIVERENDER_ROOT_PATH}/include)
add_library(libhiai SHARED IMPORTED )
set_target_properties(libhiai PROPERTIES IMPORTED_LOCATION
${NATIVERENDER_ROOT_PATH}/../../../libs/arm64-v8a/libhiai.so)
add_library(libhiai_ir SHARED IMPORTED )
set_target_properties(libhiai_ir PROPERTIES IMPORTED_LOCATION
${NATIVERENDER_ROOT_PATH}/../../../libs/arm64-v8a/libhiai_ir.so)
add_library(libhiai_ir_build SHARED IMPORTED )
set_target_properties(libhiai_ir_build PROPERTIES IMPORTED_LOCATION
${NATIVERENDER_ROOT_PATH}/../../../libs/arm64-v8a/libhiai_ir_build.so)
add_library(libhiai_ir_build_aipp SHARED IMPORTED )
set_target_properties(libhiai_ir_build_aipp PROPERTIES IMPORTED_LOCATION
${NATIVERENDER_ROOT_PATH}/../../../libs/arm64-v8a/libhiai_ir_build_aipp.so)
add_library(entry SHARED Classification.cpp HIAIModelManager.cpp)
target_link_libraries(entry PUBLIC libace_napi.z.so libhilog_ndk.z.so librawfile.z.so)
target_link_libraries(entry LINK_PUBLIC
libhiai # Mandatory
libhiai_ir # Mandatory only for IR graph building
libhiai_ir_build # Mandatory only for IR graph building
libhiai_ir_build_aipp.so # Mandatory only for AIPP-based IR graph building
) Copy .so files of the CANN DDK to the corresponding location of the project. In the demo, the .so files are stored under the entry/libs directory.

Copy header files of the CANN DDK to the corresponding location of the project. In the demo, the header files are stored under the entry/src/main/cpp/include directory.
