Index: cmake/caches/Android-stage2.cmake =================================================================== --- /dev/null +++ cmake/caches/Android-stage2.cmake @@ -0,0 +1,55 @@ +set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64 CACHE STRING "") + +set(CLANG_VENDOR Android CACHE STRING "") +set(CMAKE_BUILD_TYPE Release CACHE STRING "") +set(CMAKE_BUILD_TYPE Debug CACHE STRING "") +set(LLVM_ENABLE_THREADS OFF CACHE BOOL "") +set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "") +set(LLVM_LIBDIR_SUFFIX 64 CACHE STRING "") +set(LLVM_ENABLE_LIBCXX ON CACHE BOOL "") + +set(ANDROID_RUNTIMES_ENABLE_ASSERTIONS ON CACHE BOOL "") +set(ANDROID_RUNTIMES_BUILD_TYPE Release CACHE STRING "") +set(ANDROID_BUILTINS_BUILD_TYPE Release CACHE STRING "") + +#set(LLVM_BUILTIN_TARGETS "i686-linux-android;x86_64-linux-android;aarch64-linux-android;armv7-linux-android" CACHE STRING "") +set(LLVM_BUILTIN_TARGETS "armv7-linux-android" CACHE STRING "") +foreach(target i686;x86_64;aarch64;armv7) + set(BUILTINS_${target}-linux-android_ANDROID 1 CACHE STRING "") + set(BUILTINS_${target}-linux-android_CMAKE_BUILD_TYPE ${ANDROID_BUILTINS_BUILD_TYPE} CACHE STRING "") + set(BUILTINS_${target}-linux-android_CMAKE_ASM_FLAGS ${ANDROID_${target}_C_FLAGS} CACHE PATH "") + set(BUILTINS_${target}-linux-android_CMAKE_C_FLAGS ${ANDROID_${target}_C_FLAGS} CACHE PATH "") + set(BUILTINS_${target}-linux-android_CMAKE_SYSROOT ${ANDROID_${target}_SYSROOT} CACHE PATH "") + set(BUILTINS_${target}-linux-android_CMAKE_EXE_LINKER_FLAGS ${ANDROID_${target}_LINKER_FLAGS} CACHE PATH "") + set(BUILTINS_${target}-linux-android_CMAKE_SHARED_LINKER_FLAGS ${ANDROID_${target}_LINKER_FLAGS} CACHE PATH "") + set(BUILTINS_${target}-linux-android_CMAKE_MOUDLE_LINKER_FLAGS ${ANDROID_${target}_LINKER_FLAGS} CACHE PATH "") +endforeach() + + +#set(LLVM_RUNTIME_TARGETS "i686-linux-android;x86_64-linux-android;aarch64-linux-android;armv7-linux-android" CACHE STRING "") +set(LLVM_RUNTIME_TARGETS "armv7-linux-android" CACHE STRING "") +foreach(target i686;x86_64;aarch64;armv7) + set(RUNTIMES_${target}-linux-android_ANDROID 1 CACHE STRING "") + set(RUNTIMES_${target}-linux-android_CMAKE_ASM_FLAGS ${ANDROID_${target}_C_FLAGS} CACHE PATH "") + set(RUNTIMES_${target}-linux-android_CMAKE_BUILD_TYPE ${ANDROID_RUNTIMES_BUILD_TYPE} CACHE STRING "") + set(RUNTIMES_${target}-linux-android_CMAKE_C_FLAGS ${ANDROID_${target}_C_FLAGS} CACHE PATH "") + set(RUNTIMES_${target}-linux-android_CMAKE_CXX_FLAGS ${ANDROID_${target}_CXX_FLAGS} CACHE PATH "") + set(RUNTIMES_${target}-linux-android_CMAKE_SYSROOT ${ANDROID_${target}_SYSROOT} CACHE PATH "") + set(RUNTIMES_${target}-linux-android_CMAKE_EXE_LINKER_FLAGS ${ANDROID_${target}_LINKER_FLAGS} CACHE PATH "") + set(RUNTIMES_${target}-linux-android_CMAKE_SHARED_LINKER_FLAGS ${ANDROID_${target}_LINKER_FLAGS} CACHE PATH "") + set(RUNTIMES_${target}-linux-android_CMAKE_MODULE_LINKER_FLAGS ${ANDROID_${target}_LINKER_FLAGS} CACHE PATH "") + set(RUNTIMES_${target}-linux-android_COMPILER_RT_ENABLE_WERROR ON CACHE BOOL "") + set(RUNTIMES_${target}-linux-android_COMPILER_RT_TEST_COMPILER_CFLAGS ${ANDROID_${target}_C_FLAGS} CACHE PATH "") + set(RUNTIMES_${target}-linux-android_COMPILER_RT_INCLUDE_TESTS OFF CACHE BOOL "") + set(RUNTIMES_${target}-linux-android_LLVM_ENABLE_ASSERTIONS ${ANDROID_RUNTIMES_ENABLE_ASSERTIONS} CACHE BOOL "") + set(RUNTIMES_${target}-linux-android_LLVM_ENABLE_LIBCXX ON CACHE BOOL "") + set(RUNTIMES_${target}-linux-android_LLVM_ENABLE_THREADS OFF CACHE BOOL "") + set(RUNTIMES_${target}-linux-android_LLVM_INCLUDE_TESTS OFF CACHE BOOL "") + set(RUNTIMES_${target}-linux-android_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "") + set(RUNTIMES_${target}-linux-android_LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "") + set(RUNTIMES_${target}-linux-android_LIBUNWIND_HAS_NO_EXCEPTIONS_FLAG ON CACHE BOOL "") + set(RUNTIMES_${target}-linux-android_LIBUNWIND_HAS_FUNWIND_TABLES ON CACHE BOOL "") +endforeach() + +set(RUNTIMES_armv7-linux-android_LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "") + Index: cmake/caches/Android.cmake =================================================================== --- /dev/null +++ cmake/caches/Android.cmake @@ -0,0 +1,43 @@ +# This file sets up a CMakeCache for an Android toolchain build. + +set(LLVM_TARGETS_TO_BUILD X86 CACHE STRING "") + +set(CLANG_ENABLE_ARCMT OFF CACHE BOOL "") +set(CLANG_ENABLE_STATIC_ANALYZER OFF CACHE BOOL "") +set(CLANG_VENDOR Android CACHE STRING "") + +set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "") + +set(HAVE_LIBCXXABI ON CACHE BOOL "") +set(LLVM_BUILD_TOOLS OFF CACHE BOOL "") +set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "") +set(LLVM_ENABLE_THREADS OFF CACHE BOOL "") +set(LLVM_LIBDIR_SUFFIX 64 CACHE STRING "") +set(LLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD OFF CACHE BOOL "") +set(LLVM_TOOL_OPENMP_BUILD OFF CACHE BOOL "") +set(LLVM_ENABLE_LIBCXX ON CACHE BOOL "") + +if (LIBCXX_ENABLE_ABI_LINKER_SCRIPT) + list(APPEND EXTRA_ARGS -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=${LIBCXX_ENABLE_ABI_LINKER_SCRIPT}) +endif() + +if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY) + list(APPEND EXTRA_ARGS -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=${LIBCXX_ENABLE_STATIC_ABI_LIBRARY}) +endif() + +if (LLVM_BUILD_EXTERNAL_COMPILER_RT) + set(APPEND EXTRA_ARGS -DLLVM_BUILD_EXTERNAL_COMPILER_RT=${LLVM_BUILD_EXTERNAL_COMPILER_RT}) +endif() + +get_cmake_property(variableNames VARIABLES) +foreach(variableName ${variableNames}) + if(variableName MATCHES "^STAGE2_") + string(REPLACE "STAGE2_" "" new_name ${variableName}) + list(APPEND EXTRA_ARGS "-D${new_name}=${${variableName}}") + endif() +endforeach() + +set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "") +set(CLANG_BOOTSTRAP_CMAKE_ARGS + ${EXTRA_ARGS} + -C${CMAKE_CURRENT_LIST_DIR}/Android-stage2.cmake CACHE STRING "")