Files
TheRock/base/aux-overlay/CMakeLists.txt
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

100 lines
4.2 KiB
CMake

# Copyright Advanced Micro Devices, Inc.
# SPDX-License-Identifier: MIT
# Auxiliary Overlay
#
# This project contains some odds and ends needed in order to complete
# assembly of a full SDK. This includes:
#
# * Various redirect files to account for where things live in the tree from
# a user perspective.
# * Symlinks to account for distribution-level layout changes.
# * Other hacks as needed.
cmake_minimum_required(VERSION 3.25)
project(therock-aux-overlay)
if(NOT WIN32)
add_custom_target(symlinks ALL
COMMAND "${CMAKE_COMMAND}" -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/bin"
COMMAND "${CMAKE_COMMAND}" -E create_symlink "lib/llvm" "${CMAKE_CURRENT_BINARY_DIR}/llvm"
COMMAND "${CMAKE_COMMAND}" -E create_symlink "lib/llvm/amdgcn" "${CMAKE_CURRENT_BINARY_DIR}/amdgcn"
COMMAND "${CMAKE_COMMAND}" -E create_symlink "../lib/llvm/bin/amdclang" "${CMAKE_CURRENT_BINARY_DIR}/bin/amdclang"
COMMAND "${CMAKE_COMMAND}" -E create_symlink "../lib/llvm/bin/amdflang" "${CMAKE_CURRENT_BINARY_DIR}/bin/amdflang"
COMMAND "${CMAKE_COMMAND}" -E create_symlink "../lib/llvm/bin/amdclang++" "${CMAKE_CURRENT_BINARY_DIR}/bin/amdclang++"
COMMAND "${CMAKE_COMMAND}" -E create_symlink "../lib/llvm/bin/amdclang-cl" "${CMAKE_CURRENT_BINARY_DIR}/bin/amdclang-cl"
COMMAND "${CMAKE_COMMAND}" -E create_symlink "../lib/llvm/bin/amdclang-cpp" "${CMAKE_CURRENT_BINARY_DIR}/bin/amdclang-cpp"
COMMAND "${CMAKE_COMMAND}" -E create_symlink "../lib/llvm/bin/amdlld" "${CMAKE_CURRENT_BINARY_DIR}/bin/amdlld"
COMMAND "${CMAKE_COMMAND}" -E create_symlink "../lib/llvm/bin/amdllvm" "${CMAKE_CURRENT_BINARY_DIR}/bin/amdllvm"
COMMAND "${CMAKE_COMMAND}" -E create_symlink "../lib/llvm/bin/offload-arch" "${CMAKE_CURRENT_BINARY_DIR}/bin/offload-arch"
)
# llvm and amdgcn are symlinks to directories; install(FILES) rejects
# directories, so create the symlinks directly at install time.
# Targets must match those created by the symlinks target above.
# See https://github.com/ROCm/TheRock/issues/3714
install(CODE "
file(MAKE_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}\")
file(CREATE_LINK \"lib/llvm\"
\"\${CMAKE_INSTALL_PREFIX}/llvm\" SYMBOLIC)
file(CREATE_LINK \"lib/llvm/amdgcn\"
\"\${CMAKE_INSTALL_PREFIX}/amdgcn\" SYMBOLIC)
")
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/bin/amdclang"
"${CMAKE_CURRENT_BINARY_DIR}/bin/amdflang"
"${CMAKE_CURRENT_BINARY_DIR}/bin/amdclang++"
"${CMAKE_CURRENT_BINARY_DIR}/bin/amdclang-cl"
"${CMAKE_CURRENT_BINARY_DIR}/bin/amdclang-cpp"
"${CMAKE_CURRENT_BINARY_DIR}/bin/amdlld"
"${CMAKE_CURRENT_BINARY_DIR}/bin/amdllvm"
"${CMAKE_CURRENT_BINARY_DIR}/bin/offload-arch"
DESTINATION bin
)
endif()
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/overlay/" DESTINATION ".")
# Generate distribution info.
string(JSON dist_info_json_str SET "{}"
"dist_amdgpu_targets" "\"${GPU_TARGETS}\""
)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dist_info.json" "${dist_info_json_str}")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/dist_info.json"
DESTINATION "share/therock"
)
# ---------------------------------------------------------------------------
# TheRock manifest generation
# ---------------------------------------------------------------------------
find_package(Python3 COMPONENTS Interpreter REQUIRED)
set(THEROCK_MANIFEST_JSON "${CMAKE_CURRENT_BINARY_DIR}/therock_manifest.json")
set(THEROCK_MANIFEST_SCRIPT "${THEROCK_SOURCE_DIR}/build_tools/generate_therock_manifest.py")
set(_manifest_flag_args)
if(THEROCK_FLAG_SETTINGS_FILE)
list(APPEND _manifest_flag_args --flag-settings "${THEROCK_FLAG_SETTINGS_FILE}")
endif()
if(THEROCK_PACKAGE_VERSION)
list(APPEND _manifest_flag_args --rocm-package-version "${THEROCK_PACKAGE_VERSION}")
endif()
add_custom_command(
OUTPUT "${THEROCK_MANIFEST_JSON}"
COMMAND "${Python3_EXECUTABLE}" "${THEROCK_MANIFEST_SCRIPT}"
-o "${THEROCK_MANIFEST_JSON}"
${_manifest_flag_args}
WORKING_DIRECTORY "${THEROCK_SOURCE_DIR}"
DEPENDS "${THEROCK_MANIFEST_SCRIPT}" "${THEROCK_SOURCE_DIR}/.gitmodules"
COMMENT "Generating TheRock manifest"
VERBATIM
)
add_custom_target(aux-overlay-manifest ALL DEPENDS "${THEROCK_MANIFEST_JSON}")
install(FILES "${THEROCK_MANIFEST_JSON}" DESTINATION "share/therock")