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

标签 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代码,在/external下的一些脚本中调用了很多CMakeLists.txt和CMake。

    ./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 构建系统中的作用是什么?只是另一种选择还是还没有完全被宋代取代?

最佳答案

Starting in 2.2, Android Studio on 64 bit OS, supports building C/C++ via CMake and ndk-build through stable gradle.

In both cases, Gradle is configured to point at the external build system. It interrogates the external build system to determine a list of all C/C++ sources that are being built in the project and uses this list to populate the Studio project, enabling editing and debugging inside Studio while still using the external build system to compile and link the C/C++ sources.

There is a set of maintained CMake NDK samples here.

引用:http://tools.android.com/tech-docs/external-c-builds

参见:Build Android NDK project with Cmake

关于android - CMake 在 Android 7 构建系统中使用 Ninja 做什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39467278/

相关文章:

android - 在android上获取动态创建的 View

google-app-engine - 云发布/订阅 : Pull subscriber with GAE/Go Standard

c++ - CMAKE_CXX_FLAGS 中的标志 '-l' 不起作用

go - 将 Elasticsearch 与 Logrus 集成(golang 日志记录)

json - 如何使用 Go map 创建对象的 JSON 数组?

c++ - 使用 cmake 时对 `glfwInit' 问题的 undefined reference Clion OpenGL

android-studio - 如何在Android Studio中使用CMake -C选项(等级)?

java - 如何从登录API改造成功的字符串格式获取数据?

java - 无法从 ArrayList 填充 ListView

android - 将目标 SDK 更新到 android P 后 APK 安装失败