关于鸿蒙自己搭建项目环境要注意的点
具体步骤如下
https://xie.infoq.cn/article/4c72d00fab3499bc78de4fdd3
但是与native c++相关的东西不止上面还少不了CMakeList.txt,
# the minimum version of CMake. cmake_minimum_required(VERSION 3.5.0) project(MyApplication) set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}) #这是自己添加的 主要放入了些鸿蒙自己相关的so文件 set(BASE_LIBRARY libace_napi.z.so libEGL.so libGLESv3.so libace_ndk.z.so libuv.so libhilog_ndk.z.so libnative_media_codecbase.so libnative_media_core.so libnative_media_vdec.so libnative_window.so libnative_media_venc.so libnative_media_acodec.so libnative_media_avdemuxer.so libnative_media_avsource.so libnative_media_avmuxer.so libohaudio.so ) if(DEFINED PACKAGE_FIND_FILE) include(${PACKAGE_FIND_FILE}) endif() #这里也是自己添加的,包含了一些自己的第三方库目录 include_directories(${NATIVERENDER_ROOT_PATH} ${NATIVERENDER_ROOT_PATH}/include ${NATIVERENDER_ROOT_PATH}/test ${NATIVERENDER_ROOT_PATH}/export ${NATIVERENDER_ROOT_PATH}/ijkplayer ${NATIVERENDER_ROOT_PATH}/ijksdl ${NATIVERENDER_ROOT_PATH}/third_party/ffmpeg ) #这里需要改成自己的so文件,第二个library是我自己添加的,需要添加相应的cpp add_library(entry SHARED napi_init.cpp) add_library(export SHARED export/ExportModule.cpp test/MyTest.cpp) target_link_libraries(entry PUBLIC libace_napi.z.so) #这个要link也是我自己添加的 target_link_libraries(entry PUBLIC ${BASE_LIBRARY}) target_link_libraries(export PUBLIC ${BASE_LIBRARY}) target_link_libraries(export PUBLIC ${BASE_LIBRARY})