79 lines · plain
1# This file will recurse into all subdirectories that contain CMakeLists.txt2# Setting variables that match the pattern LLVM_TOOL_{NAME}_BUILD to Off will3# prevent traversing into a directory.4#5# The only tools that need to be explicitly added are ones that have explicit6# ordering requirements.7 8# Iterates all the subdirectories to create CMake options to enable/disable9# traversing each directory.10create_llvm_tool_options()11 12if(NOT LLVM_COMPILER_IS_GCC_COMPATIBLE OR NOT LLVM_LIBC_GPU_BUILD)13 set(LLVM_TOOL_LLVM_GPU_LOADER_BUILD OFF)14endif()15 16if(NOT LLVM_BUILD_LLVM_DYLIB AND NOT LLVM_BUILD_LLVM_C_DYLIB)17 set(LLVM_TOOL_LLVM_SHLIB_BUILD Off)18endif()19 20if(NOT LLVM_USE_INTEL_JITEVENTS )21 set(LLVM_TOOL_LLVM_JITLISTENER_BUILD Off)22endif()23 24if(CYGWIN OR NOT LLVM_ENABLE_PIC)25 set(LLVM_TOOL_LTO_BUILD Off)26endif()27 28if (LLVM_TOOL_LLVM_DRIVER_BUILD)29 add_llvm_tool(llvm-driver)30endif()31 32# Add LTO, llvm-ar, llvm-config, and llvm-profdata before clang, ExternalProject33# requires targets specified in DEPENDS to exist before the call to34# ExternalProject_Add.35add_llvm_tool_subdirectory(lto)36add_llvm_tool_subdirectory(gold)37add_llvm_tool_subdirectory(llvm-ar)38add_llvm_tool_subdirectory(llvm-config)39add_llvm_tool_subdirectory(llvm-ctxprof-util)40add_llvm_tool_subdirectory(llvm-lto)41add_llvm_tool_subdirectory(llvm-profdata)42 43# Projects supported via LLVM_EXTERNAL_*_SOURCE_DIR need to be explicitly44# specified.45add_llvm_external_project(lld)46add_llvm_external_project(mlir)47# ClangIR and Flang depend on mlir, lldb and Flang depend on clang, sort them48# accordingly so place them afterwards49add_llvm_external_project(clang)50add_llvm_external_project(flang)51add_llvm_external_project(lldb)52add_llvm_external_project(bolt)53 54# Automatically add remaining sub-directories containing a 'CMakeLists.txt'55# file as external projects.56add_llvm_implicit_projects()57 58add_llvm_external_project(polly)59 60# libclc depends on clang61add_llvm_external_project(libclc)62 63# Add subprojects specified using LLVM_EXTERNAL_PROJECTS64foreach(p ${LLVM_EXTERNAL_PROJECTS})65 add_llvm_external_project(${p})66endforeach(p)67 68set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} PARENT_SCOPE)69 70if (LLVM_TOOL_LLVM_DRIVER_BUILD)71 # This is explicitly added at the end _after_ all tool projects so that it can72 # scrape up tools from other projects into itself.73 add_subdirectory(llvm-driver)74 # This must be here otherwise CMake complains in add_llvm_tool_symlink that75 # it can't add_custom_command that happens after llvm-driver is built because76 # llvm-driver was not created in that directory.77 generate_driver_tool_targets()78endif()79