From 0449fb24be412e2a76532f5a2a7c7d2e7269d283 Mon Sep 17 00:00:00 2001 From: Soren Soe <2106410+stsoe@users.noreply.github.com> Date: Thu, 16 Jan 2025 13:56:14 -0800 Subject: [PATCH] Exclude Alveo content from NPU component Ensure that Alveo specific content is built only for Alveo or legacy XRT components. E.g., only build Alveo artifacts when XRT_ALVEO is defined. Signed-off-by: Soren Soe <2106410+stsoe@users.noreply.github.com> --- src/CMake/version.cmake | 2 +- .../core/pcie/emulation/CMakeLists.txt | 10 +++-- .../core/pcie/emulation/hw_emu/CMakeLists.txt | 6 +-- .../core/pcie/emulation/sw_emu/CMakeLists.txt | 6 +-- .../core/pcie/linux/CMakeLists.txt | 8 ++-- src/runtime_src/core/pcie/noop/CMakeLists.txt | 11 +++-- .../core/pcie/tools/CMakeLists.txt | 5 +-- .../core/pcie/windows/CMakeLists.txt | 6 ++- .../core/pcie/windows/alveo/CMakeLists.txt | 6 +-- src/runtime_src/tools/scripts/CMakeLists.txt | 43 ++++++++++++------- 10 files changed, 62 insertions(+), 41 deletions(-) diff --git a/src/CMake/version.cmake b/src/CMake/version.cmake index 065000b68d2..efc3cc33ff0 100644 --- a/src/CMake/version.cmake +++ b/src/CMake/version.cmake @@ -105,7 +105,7 @@ if (${XRT_NATIVE_BUILD} STREQUAL "yes") endif() # This is not required on MPSoC platform. To avoid yocto error, do NOT intall -if ((${XRT_NATIVE_BUILD} STREQUAL "yes") AND (NOT WIN32)) +if (XRT_ALVEO AND (${XRT_NATIVE_BUILD} STREQUAL "yes") AND (NOT WIN32)) # Copied over from dkms.cmake. TODO: cleanup set (XRT_DKMS_INSTALL_DIR "/usr/src/xrt-${XRT_VERSION_STRING}") install(FILES ${PROJECT_BINARY_DIR}/gen/version.h diff --git a/src/runtime_src/core/pcie/emulation/CMakeLists.txt b/src/runtime_src/core/pcie/emulation/CMakeLists.txt index ec648246b79..f39a8be2074 100644 --- a/src/runtime_src/core/pcie/emulation/CMakeLists.txt +++ b/src/runtime_src/core/pcie/emulation/CMakeLists.txt @@ -1,6 +1,8 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright (C) 2019-2021 Xilinx, Inc. All rights reserved. -# -add_subdirectory(common_em) -add_subdirectory(sw_emu) -add_subdirectory(hw_emu) +# Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved. +if (XRT_ALVEO) + add_subdirectory(common_em) + add_subdirectory(sw_emu) + add_subdirectory(hw_emu) +endif() diff --git a/src/runtime_src/core/pcie/emulation/hw_emu/CMakeLists.txt b/src/runtime_src/core/pcie/emulation/hw_emu/CMakeLists.txt index 6cce3826758..3b67540aadb 100644 --- a/src/runtime_src/core/pcie/emulation/hw_emu/CMakeLists.txt +++ b/src/runtime_src/core/pcie/emulation/hw_emu/CMakeLists.txt @@ -63,8 +63,8 @@ target_link_libraries(xrt_hwemu_static install (TARGETS xrt_hwemu xrt_hwemu_static EXPORT xrt-targets - RUNTIME DESTINATION ${XRT_INSTALL_BIN_DIR} COMPONENT ${XRT_COMPONENT} - LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_COMPONENT} NAMELINK_COMPONENT ${XRT_DEV_COMPONENT} - ARCHIVE DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_DEV_COMPONENT} + RUNTIME DESTINATION ${XRT_INSTALL_BIN_DIR} COMPONENT ${XRT_ALVEO_COMPONENT} + LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_ALVEO_COMPONENT} NAMELINK_COMPONENT ${XRT_ALVEO_DEV_COMPONENT} + ARCHIVE DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_ALVEO_DEV_COMPONENT} ) diff --git a/src/runtime_src/core/pcie/emulation/sw_emu/CMakeLists.txt b/src/runtime_src/core/pcie/emulation/sw_emu/CMakeLists.txt index 748e636d0cb..5b55c45fac7 100644 --- a/src/runtime_src/core/pcie/emulation/sw_emu/CMakeLists.txt +++ b/src/runtime_src/core/pcie/emulation/sw_emu/CMakeLists.txt @@ -57,7 +57,7 @@ target_link_libraries(xrt_swemu_static install (TARGETS xrt_swemu xrt_swemu_static EXPORT xrt-targets - RUNTIME DESTINATION ${XRT_INSTALL_BIN_DIR} COMPONENT ${XRT_COMPONENT} - LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_COMPONENT} NAMELINK_COMPONENT ${XRT_DEV_COMPONENT} - ARCHIVE DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_DEV_COMPONENT} + RUNTIME DESTINATION ${XRT_INSTALL_BIN_DIR} COMPONENT ${XRT_ALVEO_COMPONENT} + LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_ALVEO_COMPONENT} NAMELINK_COMPONENT ${XRT_ALVEO_DEV_COMPONENT} + ARCHIVE DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_ALVEO_DEV_COMPONENT} ) diff --git a/src/runtime_src/core/pcie/linux/CMakeLists.txt b/src/runtime_src/core/pcie/linux/CMakeLists.txt index 5bb7ba4c251..42490c00d6c 100644 --- a/src/runtime_src/core/pcie/linux/CMakeLists.txt +++ b/src/runtime_src/core/pcie/linux/CMakeLists.txt @@ -68,9 +68,11 @@ target_link_libraries(xrt_core_static pthread ) +# Shim for Linux is installed in the base component as it is +# used by both Alveo and NPU components. install(TARGETS xrt_core xrt_core_static EXPORT xrt-targets - RUNTIME DESTINATION ${XRT_INSTALL_BIN_DIR} COMPONENT ${XRT_COMPONENT} - LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_COMPONENT} NAMELINK_COMPONENT ${XRT_DEV_COMPONENT} - ARCHIVE DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_DEV_COMPONENT} + RUNTIME DESTINATION ${XRT_INSTALL_BIN_DIR} COMPONENT ${XRT_BASE_COMPONENT} + LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_BASE_COMPONENT} NAMELINK_COMPONENT ${XRT_BASE_DEV_COMPONENT} + ARCHIVE DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_BASE_DEV_COMPONENT} ) diff --git a/src/runtime_src/core/pcie/noop/CMakeLists.txt b/src/runtime_src/core/pcie/noop/CMakeLists.txt index 4f68d4ae460..beb6e2d4a8d 100644 --- a/src/runtime_src/core/pcie/noop/CMakeLists.txt +++ b/src/runtime_src/core/pcie/noop/CMakeLists.txt @@ -1,5 +1,10 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright (C) 2019-2022 Xilinx, Inc. All rights reserved. +# Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved. +if (NOT XRT_ALVEO) + return() +endif() + add_library(xrt_noop SHARED device_noop.cpp shim.cpp @@ -31,7 +36,7 @@ set_target_properties(xrt_noop PROPERTIES install(TARGETS xrt_noop EXPORT xrt-targets - RUNTIME DESTINATION ${XRT_INSTALL_BIN_DIR} COMPONENT ${XRT_COMPONENT} - LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_COMPONENT} NAMELINK_COMPONENT ${XRT_DEV_COMPONENT} - ARCHIVE DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_DEV_COMPONENT} + RUNTIME DESTINATION ${XRT_INSTALL_BIN_DIR} COMPONENT ${XRT_ALVEO_COMPONENT} + LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_ALVEO_COMPONENT} NAMELINK_COMPONENT ${XRT_ALVEO_DEV_COMPONENT} + ARCHIVE DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_ALVEO_DEV_COMPONENT} ) diff --git a/src/runtime_src/core/pcie/tools/CMakeLists.txt b/src/runtime_src/core/pcie/tools/CMakeLists.txt index ef512573be6..82f4c031878 100644 --- a/src/runtime_src/core/pcie/tools/CMakeLists.txt +++ b/src/runtime_src/core/pcie/tools/CMakeLists.txt @@ -1,8 +1,7 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright (C) 2019-2021 Xilinx, Inc. All rights reserved. -# -add_subdirectory(cloud-daemon) - +# Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved. if(XRT_ALVEO) + add_subdirectory(cloud-daemon) add_subdirectory(xbflash.qspi) endif(XRT_ALVEO) diff --git a/src/runtime_src/core/pcie/windows/CMakeLists.txt b/src/runtime_src/core/pcie/windows/CMakeLists.txt index 75326369081..c4cd9da11ce 100644 --- a/src/runtime_src/core/pcie/windows/CMakeLists.txt +++ b/src/runtime_src/core/pcie/windows/CMakeLists.txt @@ -1,4 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright (C) 2019-2022 Xilinx, Inc. All rights reserved. -# -xrt_add_subdirectory(alveo) +# Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved. +if (XRT_ALVEO) + xrt_add_subdirectory(alveo) +endif() diff --git a/src/runtime_src/core/pcie/windows/alveo/CMakeLists.txt b/src/runtime_src/core/pcie/windows/alveo/CMakeLists.txt index f452b68b197..56d8a2a7ccc 100644 --- a/src/runtime_src/core/pcie/windows/alveo/CMakeLists.txt +++ b/src/runtime_src/core/pcie/windows/alveo/CMakeLists.txt @@ -49,7 +49,7 @@ endif() # platforms. install(TARGETS xrt_core xrt_core_static EXPORT xrt-targets - RUNTIME DESTINATION ${XRT_INSTALL_BIN_DIR} COMPONENT ${XRT_COMPONENT} - LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_COMPONENT} NAMELINK_COMPONENT ${XRT_DEV_COMPONENT} - ARCHIVE DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_DEV_COMPONENT} + RUNTIME DESTINATION ${XRT_INSTALL_BIN_DIR} COMPONENT ${XRT_ALVEO_COMPONENT} + LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_ALVEO_COMPONENT} NAMELINK_COMPONENT ${XRT_ALVEO_DEV_COMPONENT} + ARCHIVE DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_ALVEO_DEV_COMPONENT} ) diff --git a/src/runtime_src/tools/scripts/CMakeLists.txt b/src/runtime_src/tools/scripts/CMakeLists.txt index c70a86ffcfb..36e6db186b5 100644 --- a/src/runtime_src/tools/scripts/CMakeLists.txt +++ b/src/runtime_src/tools/scripts/CMakeLists.txt @@ -2,28 +2,39 @@ # Copyright (C) 2019-2021 Xilinx, Inc. All rights reserved. # if (NOT WIN32) + set(XRT_SETUP_SCRIPTS + setup.sh + setup.csh) -set(XRT_SETUP_SCRIPTS - setup.sh - setup.csh) + set(XRT_LOADER_SCRIPTS + loader) -set(XRT_LOADER_SCRIPTS - loader) - -set (XRT_SCRIPTS - service_bundle.sh - plp_program.sh) + set (XRT_SCRIPTS + service_bundle.sh + plp_program.sh) else() -set(XRT_SETUP_SCRIPTS - setup.bat) + set(XRT_SETUP_SCRIPTS + setup.bat) -set (XRT_LOADER_SCRIPTS - loader.bat) + set (XRT_LOADER_SCRIPTS + loader.bat) endif(NOT WIN32) -install (PROGRAMS ${XRT_SCRIPTS} DESTINATION ${XRT_INSTALL_BIN_DIR}) -install (PROGRAMS ${XRT_LOADER_SCRIPTS} DESTINATION ${XRT_INSTALL_UNWRAPPED_DIR}) -install (FILES ${XRT_SETUP_SCRIPTS} DESTINATION ${XRT_INSTALL_DIR}) +if (XRT_BASE) + install (PROGRAMS ${XRT_LOADER_SCRIPTS} + DESTINATION ${XRT_INSTALL_UNWRAPPED_DIR} + COMPONENT ${XRT_BASE_COMPONENT}) + + install (FILES ${XRT_SETUP_SCRIPTS} + DESTINATION ${XRT_INSTALL_DIR} + COMPONENT ${XRT_BASE_COMPONENT}) +endif() + +if (XRT_ALVEO) + install (PROGRAMS ${XRT_SCRIPTS} + DESTINATION ${XRT_INSTALL_BIN_DIR} + COMPONENT ${XRT_ALVEO_COMPONENT}) +endif()