- Notifications
You must be signed in to change notification settings - Fork 15.3k
[Fuchsia] Add experimental modular build cmake cache files #154414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zeroomega wants to merge 1 commit into llvm:main Choose a base branch from zeroomega:fuchsia_modular
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Member
| @llvm/pr-subscribers-clang Author: Haowei (zeroomega) ChangesThis patch adds two new cmake cache files for building the Fuchsia Clang toolchain. One will allow building the clang without building any runtimes. The other will allow building selected runtimes without building every supported runtime. Patch is 30.16 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/154414.diff 2 Files Affected:
diff --git a/clang/cmake/caches/Fuchsia-clang-only.cmake b/clang/cmake/caches/Fuchsia-clang-only.cmake new file mode 100644 index 0000000000000..59b65262a9ca5 --- /dev/null +++ b/clang/cmake/caches/Fuchsia-clang-only.cmake @@ -0,0 +1,127 @@ +# This file sets up a CMakeCache for building the clang for Fuchsia. + +set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64;RISCV CACHE STRING "") + +set(PACKAGE_VENDOR Fuchsia CACHE STRING "") + +set(_FUCHSIA_ENABLE_PROJECTS "bolt;clang;clang-tools-extra;lld;llvm;polly") +set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "") + +set(LLVM_ENABLE_BACKTRACES OFF CACHE BOOL "") +set(LLVM_ENABLE_DIA_SDK OFF CACHE BOOL "") +set(LLVM_ENABLE_FATLTO ON CACHE BOOL "") +set(LLVM_ENABLE_HTTPLIB ON CACHE BOOL "") +set(LLVM_ENABLE_LIBCXX ON CACHE BOOL "") +set(LLVM_ENABLE_LIBEDIT OFF CACHE BOOL "") +set(LLVM_ENABLE_LLD ON CACHE BOOL "") +set(LLVM_ENABLE_LTO ON CACHE BOOL "") +set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR ON CACHE BOOL "") +set(LLVM_ENABLE_PLUGINS OFF CACHE BOOL "") +set(LLVM_ENABLE_UNWIND_TABLES OFF CACHE BOOL "") +set(LLVM_ENABLE_Z3_SOLVER OFF CACHE BOOL "") +set(LLVM_ENABLE_ZLIB ON CACHE BOOL "") +set(LLVM_FORCE_BUILD_RUNTIME ON CACHE BOOL "") +set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "") +set(LLVM_INCLUDE_EXAMPLES OFF CACHE BOOL "") +set(LLVM_STATIC_LINK_CXX_STDLIB ON CACHE BOOL "") +set(LLVM_USE_RELATIVE_PATHS_IN_FILES ON CACHE BOOL "") +set(LLDB_ENABLE_CURSES OFF CACHE BOOL "") +set(LLDB_ENABLE_LIBEDIT OFF CACHE BOOL "") + +if(WIN32) + set(FUCHSIA_DISABLE_DRIVER_BUILD ON) +endif() + +if (NOT FUCHSIA_DISABLE_DRIVER_BUILD) + set(LLVM_TOOL_LLVM_DRIVER_BUILD ON CACHE BOOL "") + set(LLVM_DRIVER_TARGET llvm-driver) +endif() + +set(CLANG_DEFAULT_CXX_STDLIB libc++ CACHE STRING "") +set(CLANG_DEFAULT_LINKER lld CACHE STRING "") +set(CLANG_DEFAULT_OBJCOPY llvm-objcopy CACHE STRING "") +set(CLANG_DEFAULT_RTLIB compiler-rt CACHE STRING "") +set(CLANG_DEFAULT_UNWINDLIB libunwind CACHE STRING "") +set(CLANG_ENABLE_STATIC_ANALYZER ON CACHE BOOL "") +set(CLANG_PLUGIN_SUPPORT OFF CACHE BOOL "") + +set(ENABLE_LINKER_BUILD_ID ON CACHE BOOL "") +set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL "") + +# TODO(#67176): relative-vtables doesn't play well with different default +# visibilities. Making everything hidden visibility causes other complications +# let's choose default visibility for our entire toolchain. +set(CMAKE_C_VISIBILITY_PRESET default CACHE STRING "") +set(CMAKE_CXX_VISIBILITY_PRESET default CACHE STRING "") + +set(CMAKE_BUILD_TYPE Release CACHE STRING "") +if (APPLE) + set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "") +elseif(WIN32) + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded" CACHE STRING "") +endif() + +# Setup toolchain. +set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "") +set(LLVM_TOOLCHAIN_TOOLS + dsymutil + llvm-ar + llvm-cov + llvm-cxxfilt + llvm-debuginfod + llvm-debuginfod-find + llvm-dlltool + ${LLVM_DRIVER_TARGET} + llvm-dwarfdump + llvm-dwp + llvm-ifs + llvm-gsymutil + llvm-lib + llvm-libtool-darwin + llvm-lipo + llvm-ml + llvm-mt + llvm-nm + llvm-objcopy + llvm-objdump + llvm-otool + llvm-pdbutil + llvm-profdata + llvm-rc + llvm-ranlib + llvm-readelf + llvm-readobj + llvm-size + llvm-strings + llvm-strip + llvm-symbolizer + llvm-undname + llvm-xray + opt-viewer + sancov + scan-build-py + CACHE STRING "") + +set(LLVM_Toolchain_DISTRIBUTION_COMPONENTS + bolt + clang + lld + clang-apply-replacements + clang-doc + clang-format + clang-resource-headers + clang-include-fixer + clang-refactor + clang-scan-deps + clang-tidy + clangd + find-all-symbols + builtins + runtimes + ${LLVM_TOOLCHAIN_TOOLS} + CACHE STRING "") + +set(_FUCHSIA_DISTRIBUTIONS Toolchain) + +set(LLVM_DISTRIBUTIONS ${_FUCHSIA_DISTRIBUTIONS} CACHE STRING "") +set(LLVM_ENABLE_PROJECTS ${_FUCHSIA_ENABLE_PROJECTS} CACHE STRING "") diff --git a/clang/cmake/caches/Fuchsia-with-runtimes.cmake b/clang/cmake/caches/Fuchsia-with-runtimes.cmake new file mode 100644 index 0000000000000..5fd79fe957226 --- /dev/null +++ b/clang/cmake/caches/Fuchsia-with-runtimes.cmake @@ -0,0 +1,439 @@ +# This file sets up a CMakeCache to build the Fuchsia toolchain with selected runtimes. + +cmake_policy(SET CMP0057 NEW) +include("${CMAKE_CURRENT_SOURCE_DIR}/../clang/cmake/caches/Fuchsia-clang-only.cmake") + +set(FUCHSIA_TOOLCHAIN_ENABLE_RUNTIMES "" CACHE STRING "") +set(FUCHSIA_TOOLCHAIN_ENABLE_ALL_SUPPORTED_RUNTIMES OFF CACHE BOOL "") +set(FUCHSIA_TOOLCHAIN_ENABLE_ALL_LINUX_RUNTIMES OFF CACHE BOOL "") +set(FUCHSIA_TOOLCHAIN_ENABLE_ALL_MAC_RUNTIMES OFF CACHE BOOL "") +set(FUCHSIA_TOOLCHAIN_ENABLE_ALL_WINDOWS_RUNTIMES OFF CACHE BOOL "") +set(FUCHSIA_TOOLCHAIN_ENABLE_ALL_FUCHSIA_RUNTIMES OFF CACHE BOOL "") +set(FUCHSIA_TOOLCHAIN_ENABLE_ALL_BAREMETAL_RUNTIMES OFF CACHE BOOL "") + +set(_FUCHSIA_TOOLCHAIN_LINUX_SUPPORTED_TARGETS "aarch64-unknown-linux-gnu;armv7-unknown-linux-gnueabihf;i386-unknown-linux-gnu;riscv64-unknown-linux-gnu;x86_64-unknown-linux-gnu") +set(_FUCHSIA_TOOLCHAIN_WINDOWS_SUPPORTED_TARGETS "x86_64-pc-windows-msvc") +set(_FUCHSIA_TOOLCHAIN_FUCHSIA_SUPPORTED_TARGETS "i386-unknown-fuchsia;x86_64-unknown-fuchsia;aarch64-unknown-fuchsia;riscv64-unknown-fuchsia") +set(_FUCHSIA_TOOLCHAIN_ARM_BAREMETAL_SUPPORTED_TARGETS "armv6m-none-eabi;armv7m-none-eabi;armv7em-none-eabi;armv8m.main-none-eabi;armv8.1m.main-none-eabi;aarch64-none-elf") +set(_FUCHSIA_TOOLCHAIN_RISCV_BAREMETAL_SUPPORTED_TARGETS "riscv32-unknown-elf") + +if (FUCHSIA_ENABLE_ALL_SUPPORTED_RUNTIMES) + set(FUCHSIA_TOOLCHAIN_ENABLE_ALL_LINUX_RUNTIMES ON) + set(FUCHSIA_TOOLCHAIN_ENABLE_ALL_MAC_RUNTIMES ON) + set(FUCHSIA_TOOLCHAIN_ENABLE_ALL_WINDOWS_RUNTIMES ON) + set(FUCHSIA_TOOLCHAIN_ENABLE_ALL_FUCHSIA_RUNTIMES ON) + set(FUCHSIA_TOOLCHAIN_ENABLE_ALL_BAREMETAL_RUNTIMES ON) +endif() + +set(_FUCHSIA_LINUX_TARGETS "") +set(_FUCHSIA_WINDOWS_TARGETS "") +set(_FUCHSIA_FUCHSIA_TARGETS "") +set(_FUCHSIA_ARM_BAREMETAL_TARGETS "") +set(_FUCHSIA_RISCV_BAREMETAL_TARGETS "") +foreach(target ${FUCHSIA_TOOLCHAIN_ENABLE_RUNTIMES}) + if (${target} IN_LIST _FUCHSIA_TOOLCHAIN_LINUX_SUPPORTED_TARGETS) + list(APPEND _FUCHSIA_LINUX_TARGETS ${target}) + endif() + if (${target} IN_LIST _FUCHSIA_TOOLCHAIN_WINDOWS_SUPPORTED_TARGETS) + list(APPEND _FUCHSIA_WINDOWS_TARGETS ${target}) + endif() + if (${target} IN_LIST _FUCHSIA_TOOLCHAIN_FUCHSIA_SUPPORTED_TARGETS) + list(APPEND _FUCHSIA_FUCHSIA_TARGETS ${target}) + endif() + if (${target} IN_LIST _FUCHSIA_TOOLCHAIN_ARM_BAREMETAL_SUPPORTED_TARGETS) + list(APPEND _FUCHSIA_ARM_BAREMETAL_TARGETS ${target}) + endif() + if (${target} IN_LIST _FUCHSIA_TOOLCHAIN_RISCV_BAREMETAL_SUPPORTED_TARGETS) + list(APPEND _FUCHSIA_RISCV_BAREMETAL_TARGETS ${target}) + endif() +endforeach() + +if (FUCHSIA_TOOLCHAIN_ENABLE_ALL_LINUX_RUNTIMES) + set(_FUCHSIA_LINUX_TARGETS ${_FUCHSIA_TOOLCHAIN_LINUX_SUPPORTED_TARGETS}) +endif() + +if (FUCHSIA_TOOLCHAIN_ENABLE_ALL_WINDOWS_RUNTIMES) + set(_FUCHSIA_WINDOWS_TARGETS ${_FUCHSIA_TOOLCHAIN_WINDOWS_SUPPORTED_TARGETS}) +endif() + +if (FUCHSIA_TOOLCHAIN_ENABLE_ALL_FUCHSIA_RUNTIMES) + set(_FUCHSIA_FUCHSIA_TARGETS ${_FUCHSIA_TOOLCHAIN_FUCHSIA_SUPPORTED_TARGETS}) +endif() + +if (FUCHSIA_TOOLCHAIN_ENABLE_ALL_BAREMETAL_RUNTIMES) + set(_FUCHSIA_ARM_BAREMETAL_TARGETS ${_FUCHSIA_TOOLCHAIN_ARM_BAREMETAL_SUPPORTED_TARGETS}) + set(_FUCHSIA_RISCV_BAREMETAL_TARGETS ${_FUCHSIA_TOOLCHAIN_RISCV_BAREMETAL_SUPPORTED_TARGETS}) +endif() + +if (_FUCHSIA_WINDOWS_TARGETS) + if((NOT WIN32) AND (NOT LLVM_VFSOVERLAY)) + message(WARNING "LLVM_VFSOVERLAY should be defined.") + message(WARNING "Skip Windows targets") + else() + foreach(target ${_FUCHSIA_WINDOWS_TARGETS}) + if (LLVM_WINSYSROOT) + set(WINDOWS_COMPILER_FLAGS + -Xclang + -ivfsoverlay + -Xclang + ${LLVM_VFSOVERLAY} + # TODO: /winsysroot should be set by HandleLLVMOptions.cmake automatically + # but it current has a bug that prevents it from working under cross + # compilation. Set this flag manually for now. + /winsysroot + ${LLVM_WINSYSROOT}) + string(REPLACE ";" " " WINDOWS_COMPILER_FLAGS "${WINDOWS_COMPILER_FLAGS}") + set(WINDOWS_LINK_FLAGS + # TODO: lld-link has a bug that it cannot infer the machine type + # correctly when /winsysroot is set while Windows libraries search paths + # are not explicitly defined. + # Explicitly set the machine type for now. + /machine:X64 + /vfsoverlay:${LLVM_VFSOVERLAY} + /winsysroot:${LLVM_WINSYSROOT}) + string(REPLACE ";" " " WINDOWS_LINK_FLAGS "${WINDOWS_LINK_FLAGS}") + endif() + + list(APPEND BUILTIN_TARGETS "${target}") + set(BUILTINS_${target}_CMAKE_SYSTEM_NAME Windows CACHE STRING "") + set(BUILTINS_${target}_CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "") + set(BUILTINS_${target}_CMAKE_C_FLAGS ${WINDOWS_COMPILER_FLAGS} CACHE STRING "") + set(BUILTINS_${target}_CMAKE_CXX_FLAGS ${WINDOWS_COMPILER_FLAGS} CACHE STRING "") + set(BUILTINS_${target}_CMAKE_EXE_LINKER_FLAGS ${WINDOWS_LINK_FLAGS} CACHE STRING "") + set(BUILTINS_${target}_CMAKE_SHARED_LINKER_FLAGS ${WINDOWS_LINK_FLAGS} CACHE STRING "") + set(BUILTINS_${target}_CMAKE_MODULE_LINKER_FLAGS ${WINDOWS_LINK_FLAGS} CACHE STRING "") + + list(APPEND RUNTIME_TARGETS "${target}") + set(RUNTIMES_${target}_CMAKE_SYSTEM_NAME Windows CACHE STRING "") + set(RUNTIMES_${target}_CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "") + set(RUNTIMES_${target}_LIBCXX_ABI_VERSION 2 CACHE STRING "") + set(RUNTIMES_${target}_LIBCXX_ENABLE_ABI_LINKER_SCRIPT OFF CACHE BOOL "") + set(RUNTIMES_${target}_LIBCXX_ENABLE_SHARED OFF CACHE BOOL "") + set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx" CACHE STRING "") + set(RUNTIMES_${target}_CMAKE_C_FLAGS ${WINDOWS_COMPILER_FLAGS} CACHE STRING "") + set(RUNTIMES_${target}_CMAKE_CXX_FLAGS ${WINDOWS_COMPILER_FLAGS} CACHE STRING "") + set(RUNTIMES_${target}_CMAKE_EXE_LINKER_FLAGS ${WINDOWS_LINK_FLAGS} CACHE STRING "") + set(RUNTIMES_${target}_CMAKE_SHARED_LINKER_FLAGS ${WINDOWS_LINK_FLAGS} CACHE STRING "") + set(RUNTIMES_${target}_CMAKE_MODULE_LINKER_FLAGS ${WINDOWS_LINK_FLAGS} CACHE STRING "") + + endforeach() + endif() +endif() + + +foreach(target ${_FUCHSIA_LINUX_TARGETS}) + if (NOT LINUX_${target}_SYSROOT) + if (LINUX_SYSROOT) + set(LINUX_${target}_SYSROOT ${LINUX_SYSROOT}) + else() + message(WARNING "Sysroot not defined for ${target}, skipping.") + endif() + endif() + if(LINUX_${target}_SYSROOT) + # Set the per-target builtins options. + list(APPEND BUILTIN_TARGETS "${target}") + set(BUILTINS_${target}_CMAKE_SYSTEM_NAME Linux CACHE STRING "") + set(BUILTINS_${target}_CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "") + set(BUILTINS_${target}_CMAKE_C_FLAGS "--target=${target}" CACHE STRING "") + set(BUILTINS_${target}_CMAKE_CXX_FLAGS "--target=${target}" CACHE STRING "") + set(BUILTINS_${target}_CMAKE_ASM_FLAGS "--target=${target}" CACHE STRING "") + set(BUILTINS_${target}_CMAKE_SYSROOT ${LINUX_${target}_SYSROOT} CACHE STRING "") + set(BUILTINS_${target}_CMAKE_SHARED_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "") + set(BUILTINS_${target}_CMAKE_MODULE_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "") + set(BUILTINS_${target}_CMAKE_EXE_LINKER_FLAG "-fuse-ld=lld" CACHE STRING "") + set(BUILTINS_${target}_COMPILER_RT_BUILD_STANDALONE_LIBATOMIC ON CACHE BOOL "") + set(BUILTINS_${target}_COMPILER_RT_LIBATOMIC_USE_PTHREAD ON CACHE BOOL "") + + # Set the per-target runtimes options. + list(APPEND RUNTIME_TARGETS "${target}") + set(RUNTIMES_${target}_CMAKE_SYSTEM_NAME Linux CACHE STRING "") + set(RUNTIMES_${target}_CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "") + set(RUNTIMES_${target}_CMAKE_C_FLAGS "--target=${target}" CACHE STRING "") + set(RUNTIMES_${target}_CMAKE_CXX_FLAGS "--target=${target}" CACHE STRING "") + set(RUNTIMES_${target}_CMAKE_ASM_FLAGS "--target=${target}" CACHE STRING "") + set(RUNTIMES_${target}_CMAKE_SYSROOT ${LINUX_${target}_SYSROOT} CACHE STRING "") + set(RUNTIMES_${target}_CMAKE_SHARED_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "") + set(RUNTIMES_${target}_CMAKE_MODULE_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "") + set(RUNTIMES_${target}_CMAKE_EXE_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "") + set(RUNTIMES_${target}_COMPILER_RT_CXX_LIBRARY "libcxx" CACHE STRING "") + set(RUNTIMES_${target}_COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "") + set(RUNTIMES_${target}_COMPILER_RT_USE_ATOMIC_LIBRARY ON CACHE BOOL "") + set(RUNTIMES_${target}_COMPILER_RT_USE_LLVM_UNWINDER ON CACHE BOOL "") + set(RUNTIMES_${target}_COMPILER_RT_CAN_EXECUTE_TESTS ON CACHE BOOL "") + set(RUNTIMES_${target}_COMPILER_RT_BUILD_STANDALONE_LIBATOMIC ON CACHE BOOL "") + set(RUNTIMES_${target}_LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "") + set(RUNTIMES_${target}_LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "") + set(RUNTIMES_${target}_LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "") + set(RUNTIMES_${target}_LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "") + set(RUNTIMES_${target}_LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "") + set(RUNTIMES_${target}_LIBCXXABI_INSTALL_LIBRARY OFF CACHE BOOL "") + set(RUNTIMES_${target}_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "") + set(RUNTIMES_${target}_LIBCXX_ENABLE_SHARED OFF CACHE BOOL "") + set(RUNTIMES_${target}_LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "") + set(RUNTIMES_${target}_LIBCXX_ABI_VERSION 2 CACHE STRING "") + set(RUNTIMES_${target}_LLVM_ENABLE_ASSERTIONS OFF CACHE BOOL "") + set(RUNTIMES_${target}_SANITIZER_CXX_ABI "libc++" CACHE STRING "") + set(RUNTIMES_${target}_SANITIZER_CXX_ABI_INTREE ON CACHE BOOL "") + set(RUNTIMES_${target}_SANITIZER_TEST_CXX "libc++" CACHE STRING "") + set(RUNTIMES_${target}_SANITIZER_TEST_CXX_INTREE ON CACHE BOOL "") + set(RUNTIMES_${target}_LLVM_TOOLS_DIR "${CMAKE_BINARY_DIR}/bin" CACHE BOOL "") + set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "") + + # Enable FatLTO for Linux and baremetal runtimes + set(RUNTIMES_${target}_LLVM_ENABLE_LTO OFF CACHE BOOL "") + set(RUNTIMES_${target}_LLVM_ENABLE_FATLTO OFF CACHE BOOL "") + + # Use .build-id link. + list(APPEND RUNTIME_BUILD_ID_LINK "${target}") + endif() +endforeach() + +if(FUCHSIA_SDK) + set(FUCHSIA_aarch64-unknown-fuchsia_NAME arm64) + set(FUCHSIA_i386-unknown-fuchsia_NAME x64) + set(FUCHSIA_x86_64-unknown-fuchsia_NAME x64) + set(FUCHSIA_riscv64-unknown-fuchsia_NAME riscv64) + foreach(target ${_FUCHSIA_FUCHSIA_TARGETS}) + set(FUCHSIA_${target}_COMPILER_FLAGS "--target=${target} -I${FUCHSIA_SDK}/pkg/sync/include -I${FUCHSIA_SDK}/pkg/fdio/include") + set(FUCHSIA_${target}_LINKER_FLAGS "-L${FUCHSIA_SDK}/arch/${FUCHSIA_${target}_NAME}/lib") + set(FUCHSIA_${target}_SYSROOT "${FUCHSIA_SDK}/arch/${FUCHSIA_${target}_NAME}/sysroot") + endforeach() + + foreach(target ${_FUCHSIA_FUCHSIA_TARGETS}) + # Set the per-target builtins options. + list(APPEND BUILTIN_TARGETS "${target}") + set(BUILTINS_${target}_CMAKE_SYSTEM_NAME Fuchsia CACHE STRING "") + set(BUILTINS_${target}_CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "") + set(BUILTINS_${target}_CMAKE_ASM_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE STRING "") + set(BUILTINS_${target}_CMAKE_C_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE STRING "") + set(BUILTINS_${target}_CMAKE_CXX_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE STRING "") + set(BUILTINS_${target}_CMAKE_SHARED_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE STRING "") + set(BUILTINS_${target}_CMAKE_MODULE_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE STRING "") + set(BUILTINS_${target}_CMAKE_EXE_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE STRING "") + set(BUILTINS_${target}_CMAKE_SYSROOT ${FUCHSIA_${target}_SYSROOT} CACHE PATH "") + endforeach() + + if ("i386-unknown-fuchsia" IN_LIST _FUCHSIA_FUCHSIA_TARGETS) + list(REMOVE_ITEM _FUCHSIA_FUCHSIA_TARGETS "i386-unknown-fuchsia") + endif() + + foreach(target ${_FUCHSIA_FUCHSIA_TARGETS}) + # Set the per-target runtimes options. + list(APPEND RUNTIME_TARGETS "${target}") + set(RUNTIMES_${target}_CMAKE_SYSTEM_NAME Fuchsia CACHE STRING "") + set(RUNTIMES_${target}_CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "") + set(RUNTIMES_${target}_CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE BOOL "") + set(RUNTIMES_${target}_CMAKE_ASM_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE STRING "") + set(RUNTIMES_${target}_CMAKE_C_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE STRING "") + set(RUNTIMES_${target}_CMAKE_CXX_FLAGS ${FUCHSIA_${target}_COMPILER_FLAGS} CACHE STRING "") + set(RUNTIMES_${target}_CMAKE_SHARED_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE STRING "") + set(RUNTIMES_${target}_CMAKE_MODULE_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE STRING "") + set(RUNTIMES_${target}_CMAKE_EXE_LINKER_FLAGS ${FUCHSIA_${target}_LINKER_FLAGS} CACHE STRING "") + set(RUNTIMES_${target}_CMAKE_SYSROOT ${FUCHSIA_${target}_SYSROOT} CACHE PATH "") + set(RUNTIMES_${target}_COMPILER_RT_CXX_LIBRARY "libcxx" CACHE STRING "") + set(RUNTIMES_${target}_COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "") + set(RUNTIMES_${target}_COMPILER_RT_USE_LLVM_UNWINDER ON CACHE BOOL "") + set(RUNTIMES_${target}_LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "") + set(RUNTIMES_${target}_LIBUNWIND_HIDE_SYMBOLS ON CACHE BOOL "") + set(RUNTIMES_${target}_LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "") + set(RUNTIMES_${target}_LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "") + set(RUNTIMES_${target}_LIBCXXABI_HERMETIC_STATIC_LIBRARY ON CACHE BOOL "") + set(RUNTIMES_${target}_LIBCXXABI_INSTALL_STATIC_LIBRARY OFF CACHE BOOL "") + set(RUNTIMES_${target}_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "") + set(RUNTIMES_${target}_LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "") + set(RUNTIMES_${target}_LIBCXX_HERMETIC_STATIC_LIBRARY ON CACHE BOOL "") + set(RUNTIMES_${target}_LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY OFF CACHE BOOL "") + set(RUNTIMES_${target}_LIBCXX_ABI_VERSION 2 CACHE STRING "") + set(RUNTIMES_${target}_LLVM_ENABLE_ASSERTIONS OFF CACHE BOOL "") + set(RUNTIMES_${target}_LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "") + + # Compat multilibs. + set(RUNTIMES_${target}+compat_LLVM_BUILD_COMPILER_RT OFF CACHE BOOL "") + set(RUNTIMES_${target}+compat_LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "") + set(RUNTIMES_${target}+compat_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "") + set(RUNTIMES_${target}+compat_CMAKE_CXX_FLAGS "${FUCHSIA_${target}_COMPILER_FLAGS} -fc++-abi=itanium" CACHE STRING "") + + set(RUNTIMES_${target}+asan_LLVM_BUILD_COMPILER_RT OFF CACHE BOOL "") + set(RUNTIMES_${target}+asan_LLVM_USE_SANITIZER "Address" CACHE STRING "") + set(RUNTIMES_${target}+asan_LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "") + set(RUNTIMES_${target}+asan_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "") + + set(RUNTIMES_${target}+noexcept_LLVM_BUILD_COMPILER_RT OFF CACHE BOOL "") + set(RUNTIMES_${target}+noexcept_LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "") + set(RUNTIMES_${target}+noexcept_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "") + + set(RUNTIMES_${target}+asan+noexcept_LLVM_BUILD_COMPILER_RT OFF CACHE BOOL "") + set(RUNTIMES_${target}+asan+noexcept_LLVM_USE_SANITIZER "Address" CACHE STRING "") + set(RUNTIMES_${target}+asan+noexcept_LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "") + set(RUNTIMES_${target}+asan+noexcept_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "") + set(RUNTIMES_${target}+asan+noexcept_LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "") + set(RUNTIMES_${target}+asan+noexcept_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "") + + # Enable FatLTO for Fuchsia runtimes + set(RUNTIMES_${target}_LLVM_ENABLE_LTO OFF CACHE BOOL "") + set(RUNTIMES_${target}_LLVM_ENABLE_FATLTO OFF CACHE BOOL "") + + # Use .build-id link. + list(APPEND RUNTIME_BUILD_ID_LINK "${target}") + endforeach() + + # HWAsan + set(RUNTIMES_aarch64-unknown-fuchsia+hwasan_LLVM_BUILD_COMPILER_RT OFF CACHE BOOL "") + set(RUNTIMES_aarch64-unknown-fuchsia+hwasan_LLVM_USE_SANITI... [truncated] |
e43ff95 to dd26d96 Compare This patch adds two new cmake cache files for building the Fuchsia Clang toolchain. One will allow building the clang without building any runtimes. The other will allow building selected runtimes without building every supported runtime.
dd26d96 to 4e591cb Compare Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
This patch adds two new cmake cache files for building the Fuchsia Clang toolchain. One will allow building the clang without building any runtimes. The other will allow building selected runtimes without building every supported runtime.