• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1cmake_minimum_required(VERSION 3.6)
2project("Android Resources")
3
4set(ROOT ${CMAKE_CURRENT_LIST_DIR}/../../../../)
5set(ROOT_OUT ${CMAKE_CURRENT_LIST_DIR}/cmake_out)
6set(AAPT2_BASE ${ROOT}/frameworks/base/tools/aapt2)
7set(IDMAP2_BASE ${ROOT}/frameworks/base/cmds/idmap2)
8set(ANDROIDFW_BASE ${ROOT}/frameworks/base/libs/androidfw)
9set(JNI_BASE ${ROOT}/frameworks/base/core/jni)
10set(AAPT_BASE ${ROOT}/frameworks/base/tools/aapt)
11
12# Set host arch
13if(EXISTS ${AAPT2_BASE}/aapt2-x86_64-linux_glibc)
14    message(NOTICE, "Applying HOST_ARCH x86_64-linux_glibc")
15    set(HOST_ARCH x86_64-linux_glibc)
16elseif(EXISTS ${AAPT2_BASE}/aapt2-x86-linux_glibc)
17    message(NOTICE, "Applying HOST_ARCH x86-linux_glibc")
18    set(HOST_ARCH x86-linux_glibc)
19elseif(EXISTS ${AAPT2_BASE}/aapt2-x86_64-windows)
20    message(NOTICE, "Applying HOST_ARCH x86_64-windows")
21    set(HOST_ARCH x86_64-windows)
22elseif(EXISTS ${AAPT2_BASE}/aapt2-x86-windows)
23    message(NOTICE, "Applying HOST_ARCH x86-windows")
24    set(HOST_ARCH x86-windows)
25else()
26    message(NOTICE, "Applying default HOST_ARCH x86_64-linux_glibc")
27    set(HOST_ARCH x86_64-linux_glibc)
28endif()
29
30# Set target arch
31if(EXISTS ${IDMAP2_BASE}/idmap2-arm64-android)
32    message(NOTICE, "Applying TARGET_ARCH arm64-android")
33    set(TARGET_ARCH arm64-android)
34elseif(EXISTS ${IDMAP2_BASE}/idmap2-arm-android)
35    message(NOTICE, "Applying TARGET_ARCH arm-android")
36    set(TARGET_ARCH arm-android)
37elseif(EXISTS ${IDMAP2_BASE}/idmap2-x86_64-linux_glibc)
38    message(NOTICE, "Applying TARGET_ARCH x86_64-linux_glibc")
39    set(TARGET_ARCH x86_64-linux_glibc)
40elseif(EXISTS ${IDMAP2_BASE}/idmap2-x86-linux_glibc)
41    message(NOTICE, "Applying TARGET_ARCH x86-linux_glibc")
42    set(TARGET_ARCH x86-linux_glibc)
43else()
44    message(NOTICE, "Applying default TARGET_ARCH arm64-android")
45    set(TARGET_ARCH arm64-android)
46endif()
47
48# aapt2
49add_subdirectory(${AAPT2_BASE}/aapt2-${HOST_ARCH} ${ROOT_OUT}/aapt2)
50add_subdirectory(${AAPT2_BASE}/aapt2_tests-${HOST_ARCH} ${ROOT_OUT}/aapt2_tests)
51add_subdirectory(${AAPT2_BASE}/libaapt2-${HOST_ARCH} ${ROOT_OUT}/libaapt2)
52
53# idmap2
54add_subdirectory(${IDMAP2_BASE}/idmap2-${TARGET_ARCH} ${ROOT_OUT}/idmap2)
55add_subdirectory(${IDMAP2_BASE}/idmap2d-${TARGET_ARCH} ${ROOT_OUT}/idmap2d)
56add_subdirectory(${IDMAP2_BASE}/libidmap2-${TARGET_ARCH} ${ROOT_OUT}/libidmap2)
57add_subdirectory(${IDMAP2_BASE}/libidmap2_protos-${TARGET_ARCH} ${ROOT_OUT}/libidmap2_protos)
58add_subdirectory(${IDMAP2_BASE}/libidmap2daidl-${TARGET_ARCH} ${ROOT_OUT}/libidmap2daidl)
59add_subdirectory(${IDMAP2_BASE}/idmap2_tests-${TARGET_ARCH} ${ROOT_OUT}/idmap2_tests)
60
61# Android Runtime
62add_subdirectory(${ANDROIDFW_BASE}/libandroidfw-${TARGET_ARCH} ${ROOT_OUT}/libandroidfw)
63add_subdirectory(${ANDROIDFW_BASE}/libandroidfw_tests-${TARGET_ARCH} ${ROOT_OUT}/libandroidfw_tests)
64add_subdirectory(${ANDROIDFW_BASE}/libandroidfw_benchmarks-${TARGET_ARCH} ${ROOT_OUT}/libandroidfw_benchmarks)
65add_subdirectory(${ANDROIDFW_BASE}/libandroidfw_fuzzer_lib-${TARGET_ARCH} ${ROOT_OUT}/libandroidfw_fuzzer_lib)
66add_subdirectory(${ANDROIDFW_BASE}/fuzz/resourcefile_fuzzer/resourcefile_fuzzer-${TARGET_ARCH}
67        ${ROOT_OUT}/fuzz/resourcefile_fuzzer/resourcefile_fuzzer)
68
69# JNI
70add_subdirectory(${JNI_BASE}/libandroid_runtime-${TARGET_ARCH} ${ROOT_OUT}/jni)
71
72# aapt
73add_subdirectory(${AAPT_BASE}/aapt-${HOST_ARCH} ${ROOT_OUT}/aapt)
74add_subdirectory(${AAPT_BASE}/libaapt-${HOST_ARCH} ${ROOT_OUT}/libaapt)
75add_subdirectory(${AAPT_BASE}/libaapt_tests-${HOST_ARCH} ${ROOT_OUT}/libaapt_tests)
76