android-cmake环境变量

1.配置profile

export PATH=$PATH:/home/opt/Qt5.5.0/5.5/gcc_64/bin:/lbg/arm-tools/bin:/home/lbg/download/gcc-arm-none-eabi-4_9-2015q2/bin:/home/lbg/download/Solaar-0.9.2/bin

#export ANDROID_NDK_ROOT=/opt/android/android-ndk-r8e

export ANDROID_NDK_ROOT=/lbg/android/android-ndk-r10

export ANDROID_SDK_ROOT=/lbg/android/sdk

export ANDROID_HOME=$ANDROID_SDK_ROOT

export ANDROID_NDK_HOME=$ANDROID_NDK_ROOT

export PATH=$PATH:$ANDROID_NDK_ROOT:$ANDROID_SDK_ROOT:$ANDROID_SDK_ROOT/platform-tools:/opt/Qt5.4.0/5.4/gcc_64/bin



export JAVA_HOME=/lbg/java/jdk1.7.0_79

export JRE_HOME=$JAVA_HOME/jre

export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH

export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH



export ANDROID_NDK_TOOLCHAIN_ROOT=/lbg/android/android-toolchain

export ANDROIDTOOLCHAIN=/lbg/android/android-cmake/android-cmake/toolchain/android.toolchain.cmake

alias android-cmake='cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROIDTOOLCHAIN'



export GRADLE_HOME=/opt/gradle/gradle-2.10

export PATH=$GRADLE_HOME/bin:$PATH

2. source /etc/profile                       是让/etc/profile文件修改后立即生效,

3. 使用NDK创建单独的工具链:

./build/tools/make-standalone-toolchain.sh --platform=android-22 --install-dir=/lbg/android/android-toolchain-ndk-12 --arch=x86_64

4.进入android-cmake,执行: android-cmake ..

make -j8

make clean

1.添加cpp文件到 cmakelist

2.配置文件:# 指定生成目标

add_library (${target_name} SHARED ${source_files})

target_link_libraries (${target_name} ${thread_lib})

set (test_pvsdkapi_files

    src/tests/pvsdktest/pvsdkapitest.cpp)

add_library (test_pvsdkapi SHARED ${test_pvsdkapi_files})

target_link_libraries (test_pvsdkapi ${target_name} ${thread_lib} ${log_lib})

你可能感兴趣的:(android开发)