Files
TheRock/compiler/amd-llvm/llvm/cmake/modules/LLVM-Build.cmake
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

105 lines
4.0 KiB
CMake

# Generate C code in the file provided as OUTPUT that describes the properties
# of all components. This C code is suitable for inclusion in `llvm-config`
function(LLVMBuildGenerateCFragment)
cmake_parse_arguments(ARG "" "OUTPUT" "" ${ARGN})
# Write C header
#################
get_property(llvmbuild_components GLOBAL PROPERTY LLVM_COMPONENT_LIBS)
foreach(llvmbuild_component ${llvmbuild_components})
string(REGEX REPLACE "^LLVM" "" component_name ${llvmbuild_component})
list(APPEND all_component_libdeps ${component_name})
endforeach()
list(APPEND llvmbuild_components all)
foreach(llvm_component all-targets Engine Native NativeCodeGen ${LLVM_TARGETS_TO_BUILD})
list(APPEND llvmbuild_components ${llvm_component})
list(APPEND all_component_libdeps ${llvm_component})
endforeach()
list(LENGTH llvmbuild_components llvmbuild_components_size)
file(WRITE ${ARG_OUTPUT}
"
struct AvailableComponent {
/// The name of the component.
const char *Name;
/// The name of the library for this component (or NULL).
const char *Library;
/// Whether the component is installed.
bool IsInstalled;
/// The list of libraries required when linking this component.
const char *RequiredLibraries[${llvmbuild_components_size}];
} AvailableComponents[${llvmbuild_components_size}] = {
")
foreach(llvmbuild_component ${llvmbuild_components})
if(llvmbuild_component STREQUAL "all")
unset(llvmbuild_libname)
set(llvmbuild_libdeps ${all_component_libdeps})
else()
get_property(llvmbuild_libname TARGET ${llvmbuild_component} PROPERTY LLVM_COMPONENT_NAME)
get_property(llvmbuild_libdeps TARGET ${llvmbuild_component} PROPERTY LLVM_LINK_COMPONENTS)
endif()
string(TOLOWER ${llvmbuild_component} llvmbuild_componentname)
if(NOT llvmbuild_libname)
set(llvmbuild_llvmlibname nullptr)
string(TOLOWER ${llvmbuild_component} llvmbuild_libname)
else()
set(llvmbuild_llvmlibname "\"LLVM${llvmbuild_libname}\"")
string(TOLOWER ${llvmbuild_libname} llvmbuild_libname)
endif()
set(llvmbuild_clibdeps "")
foreach(llvmbuild_libdep ${llvmbuild_libdeps})
get_property(llvmbuild_libdepname GLOBAL PROPERTY LLVM_COMPONENT_NAME_${llvmbuild_libdep})
if(NOT llvmbuild_libdepname)
string(TOLOWER ${llvmbuild_libdep} llvmbuild_clibdep)
else()
string(TOLOWER ${llvmbuild_libdepname} llvmbuild_clibdep)
endif()
list(APPEND llvmbuild_clibdeps ${llvmbuild_clibdep})
endforeach()
list(TRANSFORM llvmbuild_clibdeps PREPEND "\"")
list(TRANSFORM llvmbuild_clibdeps APPEND "\"")
list(JOIN llvmbuild_clibdeps ", " llvmbuild_clibdeps_joint)
list(APPEND llvmbuild_centries "{ \"${llvmbuild_libname}\", ${llvmbuild_llvmlibname}, true, {${llvmbuild_clibdeps_joint}} },\n")
endforeach()
list(SORT llvmbuild_centries)
foreach(llvmbuild_centry ${llvmbuild_centries})
file(APPEND ${ARG_OUTPUT} "${llvmbuild_centry}")
endforeach()
file(APPEND ${ARG_OUTPUT} "};")
endfunction()
# Resolve cross-component dependencies, for each available component.
function(LLVMBuildResolveComponentsLink)
# the native target may not be enabled when cross compiling
if(TARGET ${LLVM_NATIVE_ARCH})
get_property(llvm_has_jit_native TARGET ${LLVM_NATIVE_ARCH} PROPERTY LLVM_HAS_JIT)
else()
set(llvm_has_jit_native OFF)
endif()
if(llvm_has_jit_native)
set_property(TARGET Engine APPEND PROPERTY LLVM_LINK_COMPONENTS "MCJIT" "Native")
else()
set_property(TARGET Engine APPEND PROPERTY LLVM_LINK_COMPONENTS "Interpreter")
endif()
get_property(llvm_components GLOBAL PROPERTY LLVM_COMPONENT_LIBS)
foreach(llvm_component ${llvm_components})
get_property(link_components TARGET ${llvm_component} PROPERTY LLVM_LINK_COMPONENTS)
llvm_map_components_to_libnames(llvm_libs ${link_components})
if(llvm_libs)
get_property(libtype TARGET ${llvm_component} PROPERTY LLVM_LIBTYPE)
target_link_libraries(${llvm_component} ${libtype} ${llvm_libs})
endif()
endforeach()
endfunction()