Index: cmake/caches/Fuchsia-stage2.cmake =================================================================== --- /dev/null +++ cmake/caches/Fuchsia-stage2.cmake @@ -0,0 +1,59 @@ +# This file sets up a CMakeCache for the second stage of a Fuchsia toolchain +# build. + +set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64 CACHE STRING "") + +set(PACKAGE_VENDOR Fuchsia CACHE STRING "") + +set(LLVM_INCLUDE_EXAMPLES OFF CACHE BOOL "") +set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "") +set(LLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD OFF CACHE BOOL "") +set(LLVM_ENABLE_ZLIB ON CACHE BOOL "") +set(LLVM_ENABLE_BACKTRACES OFF CACHE BOOL "") +set(CLANG_PLUGIN_SUPPORT OFF CACHE BOOL "") + +set(LLVM_ENABLE_LTO ON CACHE BOOL "") +if(NOT APPLE) + set(LLVM_ENABLE_LLD ON CACHE BOOL "") +endif() + +set(CLANG_DEFAULT_LINKER lld CACHE STRING "") + +set(CMAKE_BUILD_TYPE Release CACHE STRING "") + +set(LLVM_BUILTIN_TARGETS "x86_64-fuchsia-none;aarch64-fuchsia-none" CACHE STRING "") +set(BUILTINS_x86_64-fuchsia-none_CMAKE_SYSROOT ${FUCHSIA_SYSROOT} CACHE STRING "") +set(BUILTINS_x86_64-fuchsia-none_CMAKE_SYSTEM_NAME Fuchsia CACHE STRING "") +set(BUILTINS_aarch64-fuchsia-none_CMAKE_SYSROOT ${FUCHSIA_SYSROOT} CACHE STRING "") +set(BUILTINS_aarch64-fuchsia-none_CMAKE_SYSTEM_NAME Fuchsia CACHE STRING "") + +# Setup toolchain. +set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "") +set(LLVM_TOOLCHAIN_TOOLS + llvm-ar + llvm-cov + llvm-cxxfilt + llvm-dwarfdump + llvm-dsymutil + llvm-lib + llvm-nm + llvm-objdump + llvm-profdata + llvm-ranlib + llvm-readobj + llvm-size + llvm-symbolizer + CACHE STRING "") + +set(LLVM_DISTRIBUTION_COMPONENTS + clang + lld + lldb + LTO + clang-format + clang-headers + builtins-x86_64-fuchsia-none + builtins-aarch64-fuchsia-none + runtimes + ${LLVM_TOOLCHAIN_TOOLS} + CACHE STRING "") Index: cmake/caches/Fuchsia.cmake =================================================================== --- /dev/null +++ cmake/caches/Fuchsia.cmake @@ -0,0 +1,44 @@ +# This file sets up a CMakeCache for a Fuchsia toolchain build. + +set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "") + +set(PACKAGE_VENDOR Fuchsia CACHE STRING "") + +set(LLVM_INCLUDE_EXAMPLES OFF CACHE BOOL "") +set(LLVM_INCLUDE_TESTS OFF CACHE BOOL "") +set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "") +set(CLANG_INCLUDE_TESTS OFF CACHE BOOL "") +set(LLVM_ENABLE_ZLIB OFF CACHE BOOL "") +set(LLVM_ENABLE_BACKTRACES OFF CACHE BOOL "") +set(CLANG_PLUGIN_SUPPORT OFF CACHE BOOL "") + +set(CMAKE_BUILD_TYPE Release CACHE STRING "") + +set(BOOTSTRAP_LLVM_ENABLE_LTO ON CACHE BOOL "") +if(NOT APPLE) + set(BOOTSTRAP_LLVM_ENABLE_LLD ON CACHE BOOL "") +endif() + +set(CLANG_BOOTSTRAP_TARGETS + check-all + check-llvm + check-clang + llvm-config + test-suite + test-depends + llvm-test-depends + clang-test-depends + distribution + install-distribution + clang CACHE STRING "") + +if(FUCHSIA_SYSROOT) + set(EXTRA_ARGS -DFUCHSIA_SYSROOT=${FUCHSIA_SYSROOT}) +endif() + +# Setup the bootstrap build. +set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "") +set(CLANG_BOOTSTRAP_CMAKE_ARGS + ${EXTRA_ARGS} + -C ${CMAKE_CURRENT_LIST_DIR}/Fuchsia-stage2.cmake + CACHE STRING "")