From 5e317b19149256deda95102f3be085ae3f387436 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=8E=E6=9C=88=E6=83=8A=E9=B9=8A?= Date: Wed, 3 Aug 2022 20:57:16 +0800 Subject: [PATCH] =?UTF-8?q?API=E7=9B=AE=E5=BD=95=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=AE=89=E5=8D=93=E7=BC=96=E8=AF=91=EF=BC=8C=E8=BE=93=E5=87=BA?= =?UTF-8?q?libmk=5Fapi.a=20(#1854)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * API目录支持安卓编译,输出libmk_api.a * API目录支持安卓编译,输出libmk_api.a[参考 wasphin大佬的指导改进了一些地方] * update ndk version Co-authored-by: 夏楚 <771730766@qq.com> --- Android/app/build.gradle | 4 ++-- api/CMakeLists.txt | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Android/app/build.gradle b/Android/app/build.gradle index 5bf67f9f..4764f8ce 100644 --- a/Android/app/build.gradle +++ b/Android/app/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.application' android { compileSdkVersion 28 - ndkVersion "21.4.7075529" + ndkVersion "25.0.8775105" defaultConfig { applicationId "com.zlmediakit.demo" minSdkVersion 15 @@ -14,7 +14,7 @@ android { externalNativeBuild { cmake { cppFlags "-std=c++11 -frtti -fexceptions" - arguments "-DENABLE_API=off", "-DENABLE_TESTS=off", "-DENABLE_PLAYER=off", "-DENABLE_SERVER_LIB=on" + arguments "-DENABLE_API=on", "-DENABLE_API_STATIC_LIB=on", "-DENABLE_TESTS=off", "-DENABLE_PLAYER=off", "-DENABLE_SERVER_LIB=on" } } ndk { diff --git a/api/CMakeLists.txt b/api/CMakeLists.txt index e7441de1..227c07cd 100644 --- a/api/CMakeLists.txt +++ b/api/CMakeLists.txt @@ -58,6 +58,9 @@ target_include_directories(mk_api if(CMAKE_SYSTEM_NAME MATCHES "Linux") target_link_libraries(mk_api -Wl,--start-group ${LINK_LIBRARIES} -Wl,--end-group) +elseif(CMAKE_SYSTEM_NAME MATCHES "Android") + include_directories("${CMAKE_BINARY_DIR}") + target_link_libraries(mk_api log -Wl,--start-group ${LINK_LIBRARIES} -Wl,--end-group) else() target_link_libraries(mk_api jsoncpp ${LINK_LIBRARIES}) endif()