NDK開發使用cMake方式 - 添加其他的預編譯庫
阿新 • • 發佈:2017-09-29
csdn per highlight 方式 make ati lists sdn jni
NDK 開發使用cMake方式,網上能找到不少的教程,這裏推薦一篇博文:
http://blog.csdn.net/wl9739/article/details/52607010
關於添加其他的預編譯庫,網上很多文章寫得不太準確,這裏說下步驟:
1,將預編譯庫加入項目
2,編輯CMakeLists.txt,動態鏈接庫是SHARED,靜態是STATIC。
關鍵是IMPORTED_LOCATION。CMAKE_SOURCE_DIR不用手動定義,指向CMakeLists.txt所在的目錄。
add_library(smartcomm-lib SHARED IMPORTED)
set_target_properties( smartcomm-lib PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/libsmartcomm.so )
target_link_libraries( # Specifies the target library.
target-lib
smartcomm-lib)
NDK開發使用cMake方式 - 添加其他的預編譯庫