- 写一个Hello World
# include <iostream>
int main(int argc, char const *argv[])
{
for(int i = 0; i < 5; ++i)
std::cout << "Hello World" << std::endl;
return 0;
}
- build_for_android.sh脚本文件
#/bin/bash
export ANDROID_NDK=/PATH/TO/ANDROID-NDK/android-ndk-r25c/
rm -rf build
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
-DANDROID_ABI="arm64-v8a" \
-DANDROID_NDK=$ANDROID_NDK \
-DANDROID_PLATFORM=android-22 \
../
make
#make && make install
cd ..
参考:https://blog.csdn.net/qq_38410730/article/details/103622813
标签:NDK,CMake,int,make,C++,build,ANDROID,android From: https://www.cnblogs.com/Todd-Qi/p/18042883