cmake编译android平台的libPoco

时间:2023-03-09 16:01:53
cmake编译android平台的libPoco

1、下载源代码,解压到POCO-1.7.8-ALL

2、从$ANDROID_NDK\cmake下复制android.toolchain.cmake AndroidNdkGdb.cmake AndroidNdkModules.cmake至POCO-1.7.8-ALL\cmake\下

3、vim POCO-1.7.8-ALL\cmake\android.cmake,内容如下

#cd POCO-1.7.8-ALL
#mkdir BUILD && cd BUILD
#cmake -DCMAKE_CXX_FLAGS='-frtti -fexceptions -fpermissive'  ..
#make -j4
set(CMAKE_BUILD_TYPE Release)
set(ANDROID 1)
set(CMAKE_CXX_FLAGS "-fexceptions")
set(CMAKE_CXX_FLAGS_DEBUG -fexceptions)
#set( $ANDROID_NDK/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/android.toolchain.cmake)
set(ANDROID_STL stlport_static)
set(ANDROID_NDK /Users/musictom/Library/Android/sdk/ndk-bundle/)
set(ANDROID_TOOLCHAIN_NAME aarch64-linux-android-4.9)
set(ANDROID_ABI arm64-v8a)
set(ANDROID_NATIVE_API_LEVEL android-24)
set(CPACK_PACKAGE_INSTALL_DIRECTORY "/libs")
#add_compile_options(-std=c++11)
#message(STATUS "optional:-std=c++11") 
4、
cd POCO-1.7.8-ALL
mkdir BUILD && cd BUILD
cmake -DCMAKE_CXX_FLAGS='-frtti -fexceptions -fpermissive'  ..
make -j4