配置项目NAPI
========

编译HAP时，NAPI层的so需要编译依赖NDK中的libneural\_network\_core.so和libhiai\_foundation.so。

#### 头文件引用

按需引用[NNCore](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/capi-neuralnetworkruntime)和[CANN Kit](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/cannkit-hiai-aipp-param-8h)的头文件。

#include "neural\_network\_runtime/neural\_network\_core.h"
#include "CANNKit/hiai\_options.h"

#### 编写CMakeLists.txt

CMakeLists.txt示例代码如下。

\# 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)

include\_directories(${HMOS\_SDK\_NATIVE}/sysroot/usr/lib)
FIND\_LIBRARY(cann-lib hiai\_foundation)

add\_library(entry SHARED Classification.cpp HIAIModelManager.cpp)

target\_link\_libraries(entry PUBLIC libace\_napi.z.so
    libhilog\_ndk.z.so
    librawfile.z.so
    ${cann-lib}
    libneural\_network\_core.so
    )