CMake在Android 7构建系统中使用Ninja做了什么?

时间:2016-09-13 10:02:34

标签: android go cmake ninja

根据我获得的信息,在Android 7构建系统中:

  • Go为Soong提供构建支持。
  • Soong,而不是使用make,加载.bp / .mk文件,并输出.ninja文件。
  • Ninja加载.ninja文件并构建源代码。

我还在help page中发现CMake包含一个Ninja生成器。

编辑:

CMake包含在platform/prebuilts中,但未包含在Android 7 manifests

但我再次检查了android代码,有很多CMakeLists.txt和CMake在/ external下的某些脚本中被调用。

    ./external/clang/CMakeLists.txt:686:  get_cmake_property(variableNames VARIABLES)
    ./external/clang/CMakeLists.txt:711:    ${cmake_3_1_EXCLUDE_FROM_ALL}
    ./external/clang/CMakeLists.txt:725:    ${cmake_3_4_USES_TERMINAL_OPTIONS}
    ./external/clang/CMakeLists.txt:734:    ${cmake_3_4_USES_TERMINAL}
    ./external/clang/CMakeLists.txt:750:      ${cmake_3_4_USES_TERMINAL}
    ./external/clang/runtime/CMakeLists.txt:28:    set(cmake_3_4_USES_TERMINAL_OPTIONS
    ./external/clang/runtime/CMakeLists.txt:49:  get_cmake_property(variableNames VARIABLES)
    ./external/clang/runtime/CMakeLists.txt:78:    ${cmake_3_4_USES_TERMINAL_OPTIONS}
    ./external/dbus/cmake/cross-compile.sh
    ./external/compiler-rt/lib/tsan/check_cmake.sh
    ./external/opencv3/platforms/scripts/cmake_android_mips.sh
    ./external/opencv3/platforms/scripts/cmake_arm_gnueabi_softfp.sh
    ./external/opencv3/platforms/scripts/cmake_carma.sh
    ./external/opencv3/platforms/scripts/cmake_android_x86.sh
    ./external/opencv3/platforms/scripts/cmake_android_arm.sh
    ./external/opencv3/platforms/scripts/cmake_arm_gnueabi_hardfp.sh
    ./external/opencv3/platforms/scripts/cmake_android_service.sh
    ./external/opencv3/samples/android/hello-android/cmake_android.sh

此外,CMake存在于文件夹

    butter@server131:~/code/AOSP/N$ find ./ -name "cmake"
    ./prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/sysroot/usr/lib/cmake
    ./prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/sysroot/usr/lib32/cmake
    ./external/dbus/cmake
    ./external/llvm/cmake
    ./external/compiler-rt/cmake
    ./external/deqp/framework/delibs/cmake
    ./external/eigen/cmake
    ./external/eigen/bench/btl/cmake
    ./external/ceres-solver/cmake
    ./external/google-benchmark/cmake
    ./external/libcxx/cmake
    ./external/libcxxabi/cmake
    ./external/opencv3/platforms/ios/cmake
    ./external/opencv3/cmake
    ./external/clang/cmake
    ./external/google-breakpad/src/testing/gtest/cmake
    ./external/libunwind_llvm/cmake
    ./external/pcre/dist/cmake

因此,如果Soong可以生成.ninja文件,那么CMake在Android 7构建系统中的作用是什么?只是一个替代选择或者还没有完全取代宋楚瑜呢?

1 个答案:

答案 0 :(得分:2)

  

从2.2开始,64位操作系统上的Android Studio,支持构建C / C ++   通过CMake和ndk-build通过稳定的gradle。

     

在这两种情况下,Gradle都配置为指向外部版本   系统。它询问外部构建系统以确定列表   在项目中构建并使用它的所有C / C ++源代码   列表以填充Studio项目,启用编辑和调试   在Studio内部仍然使用外部构建系统进行编译   并链接C / C ++源代码。

     

有一组维护的CMake NDK样本   here

参考:http://tools.android.com/tech-docs/external-c-builds

请参阅:Build Android NDK project with Cmake