1

From the information I got, in the Android 7 build system :

  • The Go provides a build support for the Soong.
  • The Soong, instead of using make, loads the .bp/.mk files, and outputs .ninja files.
  • The Ninja loads the .ninja files and builds the source code.

And I also found in the help page that CMake includes a Ninja generator.

EDIT :

CMake is included in the platform/prebuilts, but not included in the Android 7 manifests

But I checked the android code again , there being so many CMakeLists.txt and CMake being called in some scripts under /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

Also, CMake exist under folder

    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

So if the Soong could generate .ninja files , what is CMake's role in the Android 7 build system? Just an alternative choice or just not fully replaced by the Soong yet?

4

1 回答 1

2

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

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

这里有一组维护的 CMake NDK 示例 。

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

请参阅:使用 Cmake 构建 Android NDK 项目

于 2016-09-14T08:34:24.230 回答