From 4258d7ee00e8dff409727c2daae60a8cc2c7d989 Mon Sep 17 00:00:00 2001 From: Soren Soe <2106410+stsoe@users.noreply.github.com> Date: Wed, 11 Dec 2024 14:38:46 -0800 Subject: [PATCH 1/3] Prep for building separate packages for base, npu, and alveo Support breaking XRT build into base, npu, and alveo packages with separate packages for deployment and development. Define CMake components for legacy xrt, new base, and for npu. Add conditional CMake flags for enabling / disabling parts of the code base depending on what component is built. Add build.sh switches for building base and npu packages. By default `build.sh` continues to build legacy packages with no changes to content. Specifying `build.sh -base` builds base deployment and development packages. For the time being (as this is work-in-progress) everything not explicitly excluded when building for `base` component will be dumped into the base packages. Specifying `build.sh -npu` builds a single npu package containing both deployment and development. For the time being (as this is work-in-progress) everything not explicitly excluded with building for `npu` component will be dumped into the npu package. E.g., preserves the current behavior. No changes have been made to how aiebu submodule is built; changes will follow later as the components built for aiebu are incorrectly named. Also, it's TBD if aiebu should be included in appropriate XRT component (npu and maybe alveo). Signed-off-by: Soren Soe <2106410+stsoe@users.noreply.github.com> --- build/build.sh | 24 +++++-- src/CMake/components.cmake | 67 ++++++++++++++++--- src/CMake/nativeLnx.cmake | 3 +- src/CMake/nativeWin.cmake | 1 - src/CMake/version.cmake | 7 +- src/CMakeLists.txt | 20 ------ src/runtime_src/core/common/CMakeLists.txt | 15 ++--- .../core/include/xrt/CMakeLists.txt | 5 -- .../include/xrt/deprecated/CMakeLists.txt | 5 -- .../core/include/xrt/detail/CMakeLists.txt | 10 --- .../include/xrt/experimental/CMakeLists.txt | 5 -- src/runtime_src/core/pcie/CMakeLists.txt | 2 +- .../core/pcie/tools/CMakeLists.txt | 11 ++- 13 files changed, 87 insertions(+), 88 deletions(-) diff --git a/build/build.sh b/build/build.sh index a479a927cb7..3d7d6e66996 100755 --- a/build/build.sh +++ b/build/build.sh @@ -108,7 +108,9 @@ static_boost="" ertbsp="" ertfw="" werror=1 -alveo=1 +alveo_build=0 +npu_build=0 +base_build=0 xclbinutil=0 xrt_install_prefix="/opt/xilinx" cmake_flags="-DCMAKE_EXPORT_COMPILE_COMMANDS=ON" @@ -155,9 +157,20 @@ while [ $# -gt 0 ]; do shift cmake_flags+=" -DXRT_ENABLE_HIP=ON" ;; + -base) + shift + base_build=1 + noert=1 + cmake_flags+=" -DXRT_BASE=1" + ;; + -alveo) + shift + alveo_build=1 + cmake_flags+=" -DXRT_ALVEO=1" + ;; -npu) shift - alveo=0 + npu_build=1 noert=1 cmake_flags+=" -DXDP_CLIENT_BUILD_CMAKE=yes" cmake_flags+=" -DXRT_NPU=1" @@ -263,10 +276,9 @@ cmake_flags+=" -DXRT_ENABLE_WERROR=$werror" # set CMAKE_INSTALL_PREFIX cmake_flags+=" -DCMAKE_INSTALL_PREFIX=$xrt_install_prefix -DXRT_INSTALL_PREFIX=$xrt_install_prefix" -# Set CMake variable indicating build for Alveo -# Specifying '-npu' disables Alveo -if [[ $alveo == 1 ]]; then - cmake_flags+=" -DXRT_ALVEO=1" +# Default build is legacy xrt, cannot be built with base, npu +if [[ $alveo_build == 0 && $npu_build == 0 && $base_build == 0 ]]; then + cmake_flags+=" -DXRT_XRT=1" fi here=$PWD diff --git a/src/CMake/components.cmake b/src/CMake/components.cmake index 331ff2b1b1d..caadabb6da3 100644 --- a/src/CMake/components.cmake +++ b/src/CMake/components.cmake @@ -10,7 +10,9 @@ if (NOT WIN32) elseif (${LINUX_FLAVOR} MATCHES "^(rhel|centos)") set (XRT_DEV_COMPONENT_SUFFIX "devel") endif() -endif(NOT WIN32) +else() + set(LINUX_FLAVOR "none") +endif() # Default component name for any install() command without the COMPONENT argument # The default component is the xrt run-time component, if XRT_DEV_COMPONENT is @@ -19,18 +21,65 @@ endif(NOT WIN32) set (CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "xrt") # Enable development package by specifying development component name -# If XRT_DEV_COMPONENT is same DEFAULT_COMPONENT then only that package -# is created with both development and run-time content. -#set (XRT_DEV_COMPONENT "xrt-dev") +# If XRT_{PKG}_DEV_COMPONENT is same XRT_{PKG}_COMPONENT then only +# that package is created with both development and run-time content. set (XRT_COMPONENT "xrt") set (XRT_DEV_COMPONENT "xrt") - set (XRT_BASE_COMPONENT "base") -set (XRT_BASE_DEV_COMPONENT "base-${XRT_DEV_COMPONENT_SUFFIX}") +set (XRT_BASE_DEV_COMPONENT "base") +set (XRT_ALVEO_COMPONENT "alveo") +set (XRT_ALVEO_DEV_COMPONENT "alveo") +set (XRT_NPU_COMPONENT "npu") +set (XRT_NPU_DEV_COMPONENT "npu") + +if (NOT WIN32 AND ${LINUX_FLAVOR} MATCHES "^(ubuntu|debian|rhel|centos)") + if (${LINUX_FLAVOR} MATCHES "^(ubuntu|debian)") + set (XRT_DEV_COMPONENT_SUFFIX "dev") + elseif (${LINUX_FLAVOR} MATCHES "^(rhel|centos)") + set (XRT_DEV_COMPONENT_SUFFIX "devel") + endif() + + set (XRT_BASE_DEV_COMPONENT "base-${XRT_DEV_COMPONENT_SUFFIX}") + set (XRT_ALVEO_DEV_COMPONENT "alveo-${XRT_DEV_COMPONENT_SUFFIX}") + set (XRT_NPU_DEV_COMPONENT "npu-${XRT_DEV_COMPONENT_SUFFIX}") +endif() + +# BASE builds a deployment and development package of everything +# enabled by XRT_BASE +if (XRT_BASE) + # For the time being, dump everything into base that has not + # been explicitly marked for base + set (CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "base") + set (XRT_COMPONENT ${XRT_BASE_COMPONENT}) + set (XRT_DEV_COMPONENT ${XRT_BASE_DEV_COMPONENT}) +endif(XRT_BASE) -# For NPU builds the defalt component is "npu". +# NPU builds the one NPU package for both deployment and development +# for everything enabled by XRT_NPU. This will change into base and +# npu separated packages along with packages for development and +# deployment if (XRT_NPU) + set (XRT_BASE_COMPONENT "npu") + set (XRT_BASE_DEV_COMPONENT "npu") + set (XRT_NPU_COMPONENT "npu") + set (XRT_NPU_DEV_COMPONENT "npu") + + # For the time being, dump everything into npu that has not + # been explicitly marked alveo or npu set (CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "npu") - set (XRT_COMPONENT "npu") - set (XRT_DEV_COMPONENT "npu") + set (XRT_COMPONENT ${XRT_NPU_COMPONENT}) + set (XRT_DEV_COMPONENT ${XRT_NPU_DEV_COMPONENT}) endif(XRT_NPU) + +# Legacy, build one XRT package for both deployment and development +# This build is for alveo +if (XRT_XRT) + set (CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "xrt") + set (XRT_BASE_COMPONENT "xrt") + set (XRT_BASE_DEV_COMPONENT "xrt") + set (XRT_ALVEO_COMPONENT "xrt") + set (XRT_ALVEO_DEV_COMPONENT "xrt") + set (XRT_ALVEO 1) + set (XRT_NPU 0) +endif(XRT_XRT) + diff --git a/src/CMake/nativeLnx.cmake b/src/CMake/nativeLnx.cmake index a2344b81ce1..f86cd78c994 100644 --- a/src/CMake/nativeLnx.cmake +++ b/src/CMake/nativeLnx.cmake @@ -85,8 +85,7 @@ if ( (${CMAKE_VERSION} VERSION_GREATER "3.16.0") set(XRT_STATIC_BUILD ON) endif() -# XRT install components -include (CMake/components.cmake) +include(CMake/components.cmake) # Boost Libraries include (CMake/boostUtil.cmake) diff --git a/src/CMake/nativeWin.cmake b/src/CMake/nativeWin.cmake index fb6d23db505..d792cd8c4da 100644 --- a/src/CMake/nativeWin.cmake +++ b/src/CMake/nativeWin.cmake @@ -24,7 +24,6 @@ ELSE(GIT_FOUND) MESSAGE(FATAL_ERROR "Looking for GIT - not found") endif(GIT_FOUND) -# XRT install components include(CMake/components.cmake) include(FindBoost) diff --git a/src/CMake/version.cmake b/src/CMake/version.cmake index ffb05ba08c2..065000b68d2 100644 --- a/src/CMake/version.cmake +++ b/src/CMake/version.cmake @@ -93,11 +93,6 @@ configure_file( ${PROJECT_BINARY_DIR}/gen/version.json ) -# xrt component install -install(FILES ${PROJECT_BINARY_DIR}/gen/version.h - DESTINATION ${XRT_INSTALL_INCLUDE_DIR}/xrt/detail - COMPONENT ${XRT_DEV_COMPONENT}) - # xrt component install install(FILES ${PROJECT_BINARY_DIR}/gen/version.h DESTINATION ${XRT_INSTALL_INCLUDE_DIR}/xrt/detail @@ -106,7 +101,7 @@ install(FILES ${PROJECT_BINARY_DIR}/gen/version.h if (${XRT_NATIVE_BUILD} STREQUAL "yes") install(FILES ${PROJECT_BINARY_DIR}/gen/version.json DESTINATION ${XRT_INSTALL_DIR} - COMPONENT ${XRT_COMPONENT}) + COMPONENT ${XRT_BASE_DEV_COMPONENT}) endif() # This is not required on MPSoC platform. To avoid yocto error, do NOT intall diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fedad362bfd..5ba8a8e9314 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,26 +22,6 @@ include_directories( include(CMake/settings.cmake) -# Default component name for any install() command without the COMPONENT argument -# The default component is the xrt run-time component, if XRT_DEV_COMPONENT is -# set to something different then a development component will be created with -# link libraries and header which are then excluded from runtime component -set (CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "xrt") - -# Enable development package by specifying development component name -# If XRT_DEV_COMPONENT is same DEFAULT_COMPONENT then only that package -# is created with both development and run-time content. -#set (XRT_DEV_COMPONENT "xrt-dev") -set (XRT_COMPONENT "xrt") -set (XRT_DEV_COMPONENT "xrt") - -# For NPU builds the defalt component is "npu". -if (XRT_NPU) - set (CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "npu") - set (XRT_COMPONENT "npu") - set (XRT_DEV_COMPONENT "npu") -endif(XRT_NPU) - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${XRT_SOURCE_DIR}/CMake/") # This makes aiebu submodule use ELFIO from XRT diff --git a/src/runtime_src/core/common/CMakeLists.txt b/src/runtime_src/core/common/CMakeLists.txt index 02425a4a531..04e06309680 100644 --- a/src/runtime_src/core/common/CMakeLists.txt +++ b/src/runtime_src/core/common/CMakeLists.txt @@ -122,15 +122,8 @@ if (NOT WIN32) target_link_libraries(xrt_coreutil_static INTERFACE uuid dl rt pthread) endif() ################################################################ - -install(TARGETS xrt_coreutil - EXPORT xrt-targets - LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} ${XRT_NAMELINK_SKIP} - RUNTIME DESTINATION ${XRT_INSTALL_BIN_DIR} -) - install(TARGETS xrt_coreutil xrt_coreutil_static - EXPORT xrt-dev-targets - ARCHIVE DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_DEV_COMPONENT} - LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_DEV_COMPONENT} ${XRT_NAMELINK_ONLY} -) + EXPORT xrt-targets + 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/include/xrt/CMakeLists.txt b/src/runtime_src/core/include/xrt/CMakeLists.txt index 6fbc7416c3d..18ae7aa044e 100644 --- a/src/runtime_src/core/include/xrt/CMakeLists.txt +++ b/src/runtime_src/core/include/xrt/CMakeLists.txt @@ -10,11 +10,6 @@ set(XRT_XRT_HEADER_SRC xrt_kernel.h xrt_uuid.h) -# xrt component install -install (FILES ${XRT_XRT_HEADER_SRC} - DESTINATION ${XRT_INSTALL_INCLUDE_DIR}/xrt - COMPONENT ${XRT_DEV_COMPONENT}) - # base component install install (FILES ${XRT_XRT_HEADER_SRC} DESTINATION ${XRT_INSTALL_INCLUDE_DIR}/xrt diff --git a/src/runtime_src/core/include/xrt/deprecated/CMakeLists.txt b/src/runtime_src/core/include/xrt/deprecated/CMakeLists.txt index c4475e86f48..adf4ad766c3 100644 --- a/src/runtime_src/core/include/xrt/deprecated/CMakeLists.txt +++ b/src/runtime_src/core/include/xrt/deprecated/CMakeLists.txt @@ -9,11 +9,6 @@ set(XRT_DEPRECATED_HEADER_SRC xclerr.h ) -# Legacy install -install (FILES ${XRT_DEPRECATED_HEADER_SRC} - DESTINATION ${XRT_INSTALL_INCLUDE_DIR}/xrt/deprecated - COMPONENT ${XRT_DEV_COMPONENT}) - # Base component install install (FILES ${XRT_DEPRECATED_HEADER_SRC} DESTINATION ${XRT_INSTALL_INCLUDE_DIR}/xrt/deprecated diff --git a/src/runtime_src/core/include/xrt/detail/CMakeLists.txt b/src/runtime_src/core/include/xrt/detail/CMakeLists.txt index b371779dbe4..1490ee68e23 100644 --- a/src/runtime_src/core/include/xrt/detail/CMakeLists.txt +++ b/src/runtime_src/core/include/xrt/detail/CMakeLists.txt @@ -8,11 +8,6 @@ set(XRT_XRT_DETAIL_HEADER_SRC param_traits.h pimpl.h) -# xrt component install -install (FILES ${XRT_XRT_DETAIL_HEADER_SRC} - DESTINATION ${XRT_INSTALL_INCLUDE_DIR}/xrt/detail - COMPONENT ${XRT_DEV_COMPONENT}) - # base component install install (FILES ${XRT_XRT_DETAIL_HEADER_SRC} DESTINATION ${XRT_INSTALL_INCLUDE_DIR}/xrt/detail @@ -24,11 +19,6 @@ set(XRT_XRT_DETAIL_LEGACY_SRC xrt_error_code.h xrt_mem.h) -# xrt component install -install (FILES ${XRT_XRT_DETAIL_LEGACY_SRC} - DESTINATION ${XRT_INSTALL_INCLUDE_DIR}/xrt/detail - COMPONENT ${XRT_DEV_COMPONENT}) - # base component install install (FILES ${XRT_XRT_DETAIL_LEGACY_SRC} DESTINATION ${XRT_INSTALL_INCLUDE_DIR}/xrt/detail diff --git a/src/runtime_src/core/include/xrt/experimental/CMakeLists.txt b/src/runtime_src/core/include/xrt/experimental/CMakeLists.txt index 40ef4bbccf7..2902474465a 100644 --- a/src/runtime_src/core/include/xrt/experimental/CMakeLists.txt +++ b/src/runtime_src/core/include/xrt/experimental/CMakeLists.txt @@ -30,11 +30,6 @@ set(XRT_EXPERIMENTAL_HEADER_SRC xrt_xclbin.h xclbin_util.h) -# xrt component install -install (FILES ${XRT_EXPERIMENTAL_HEADER_SRC} - DESTINATION ${XRT_INSTALL_INCLUDE_DIR}/xrt/experimental - COMPONENT ${XRT_DEV_COMPONENT}) - # base component install install (FILES ${XRT_EXPERIMENTAL_HEADER_SRC} DESTINATION ${XRT_INSTALL_INCLUDE_DIR}/xrt/experimental diff --git a/src/runtime_src/core/pcie/CMakeLists.txt b/src/runtime_src/core/pcie/CMakeLists.txt index 4fe931e3a62..1ef7242e46a 100644 --- a/src/runtime_src/core/pcie/CMakeLists.txt +++ b/src/runtime_src/core/pcie/CMakeLists.txt @@ -6,9 +6,9 @@ include_directories( ) xrt_add_subdirectory(common) -xrt_add_subdirectory(tools) if(NOT WIN32) + xrt_add_subdirectory(tools) xrt_add_subdirectory(linux) if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") # Emulation flow only works on x86_64 diff --git a/src/runtime_src/core/pcie/tools/CMakeLists.txt b/src/runtime_src/core/pcie/tools/CMakeLists.txt index b1db0afe28e..ef512573be6 100644 --- a/src/runtime_src/core/pcie/tools/CMakeLists.txt +++ b/src/runtime_src/core/pcie/tools/CMakeLists.txt @@ -1,11 +1,8 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright (C) 2019-2021 Xilinx, Inc. All rights reserved. # -if(NOT WIN32) - add_subdirectory(cloud-daemon) +add_subdirectory(cloud-daemon) - if(XRT_ALVEO) - add_subdirectory(xbflash.qspi) - endif(XRT_ALVEO) - -endif(NOT WIN32) +if(XRT_ALVEO) + add_subdirectory(xbflash.qspi) +endif(XRT_ALVEO) From 262348203dc1a364b8480aed9282e60a0447c09c Mon Sep 17 00:00:00 2001 From: Soren Soe <2106410+stsoe@users.noreply.github.com> Date: Mon, 13 Jan 2025 20:41:42 -0800 Subject: [PATCH 2/3] Fix windows build errors Remove all xrt-dev-targets exports and consolidate install targets to modern syntax. Signed-off-by: Soren Soe <2106410+stsoe@users.noreply.github.com> --- build/build-win22.sh | 24 +++++++++++++++++++ build/build22.bat | 2 +- src/CMake/config/xrt-edge.fp.in | 3 --- src/CMake/config/xrt.fp.in | 3 --- src/CMake/findpackage.cmake | 9 ------- .../core/pcie/emulation/hw_emu/CMakeLists.txt | 11 +++------ .../core/pcie/emulation/sw_emu/CMakeLists.txt | 11 +++------ .../core/pcie/linux/CMakeLists.txt | 11 +++------ src/runtime_src/core/pcie/noop/CMakeLists.txt | 9 ++----- .../core/pcie/windows/alveo/CMakeLists.txt | 11 +++------ .../tools/xbtracer/src/lib/CMakeLists.txt | 9 ++----- src/runtime_src/hip/CMakeLists.txt | 9 ++----- src/runtime_src/xocl/CMakeLists.txt | 17 +++---------- src/runtime_src/xrt/CMakeLists.txt | 11 +++------ 14 files changed, 49 insertions(+), 91 deletions(-) diff --git a/build/build-win22.sh b/build/build-win22.sh index 94f0d18e3e7..07df6d16be2 100644 --- a/build/build-win22.sh +++ b/build/build-win22.sh @@ -38,6 +38,9 @@ nocmake=0 noabi=0 dbg=0 release=1 +alveo_build=0 +npu_build=0 +base_build=0 cmake_flags="-DCMAKE_EXPORT_COMPILE_COMMANDS=ON" while [ $# -gt 0 ]; do case "$1" in @@ -79,6 +82,22 @@ while [ $# -gt 0 ]; do cmake_flags+= " -DXRT_ENABLE_HIP=ON" shift ;; + -base) + shift + base_build=1 + cmake_flags+= " -DXRT_BASE=1" + ;; + -alveo) + shift + alveo_build=1 + cmake_flags+=" -DXRT_ALVEO=1" + ;; + -npu) + shift + npu_build=1 + cmake_flags+=" -DXDP_CLIENT_BUILD_CMAKE=yes" + cmake_flags+=" -DXRT_NPU=1" + ;; -j) shift jcore=$1 @@ -116,6 +135,11 @@ cmake_flags+=" -DMSVC_PARALLEL_JOBS=$jcore" cmake_flags+=" -DKHRONOS=$KHRONOS" cmake_flags+=" -DBOOST_ROOT=$BOOST" +# Default build is legacy xrt, cannot be built with base, npu +if [[ $alveo_build == 0 && $npu_build == 0 && $base_build == 0 ]]; then + cmake_flags+=" -DXRT_XRT=1" +fi + echo "${cmake_flags[@]}" if [ $dbg == 1 ]; then diff --git a/build/build22.bat b/build/build22.bat index 745baede207..255589c5046 100644 --- a/build/build22.bat +++ b/build/build22.bat @@ -72,7 +72,7 @@ IF DEFINED MSVC_PARALLEL_JOBS ( SET LOCAL_MSVC_PARALLEL_JOBS=%MSVC_PARALLEL_JOBS :argsParsed -set CMAKEFLAGS=%CMAKEFLAGS% -DMSVC_PARALLEL_JOBS=%LOCAL_MSVC_PARALLEL_JOBS% -DKHRONOS=%EXT_DIR% -DBOOST_ROOT=%EXT_DIR% -DCMAKE_EXPORT_COMPILE_COMMANDS=ON +set CMAKEFLAGS=%CMAKEFLAGS% -DMSVC_PARALLEL_JOBS=%LOCAL_MSVC_PARALLEL_JOBS% -DKHRONOS=%EXT_DIR% -DBOOST_ROOT=%EXT_DIR% -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DXRT_XRT=1 ECHO CMAKEFLAGS=%CMAKEFLAGS% if [%DEBUG%] == [1] ( diff --git a/src/CMake/config/xrt-edge.fp.in b/src/CMake/config/xrt-edge.fp.in index 17301bd9058..01a14b60338 100644 --- a/src/CMake/config/xrt-edge.fp.in +++ b/src/CMake/config/xrt-edge.fp.in @@ -31,9 +31,6 @@ else() if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/xrt-targets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/xrt-targets.cmake") endif() - if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/xrt-dev-targets.cmake") - include("${CMAKE_CURRENT_LIST_DIR}/xrt-dev-targets.cmake") - endif() endif() get_filename_component(@PROJECT_NAME@_CMAKE_DIR "${CMAKE_CURRENT_LIST_DIR}" ABSOLUTE) diff --git a/src/CMake/config/xrt.fp.in b/src/CMake/config/xrt.fp.in index a25d7dc1680..449dd265a21 100644 --- a/src/CMake/config/xrt.fp.in +++ b/src/CMake/config/xrt.fp.in @@ -31,9 +31,6 @@ else() if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/xrt-targets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/xrt-targets.cmake") endif() - if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/xrt-dev-targets.cmake") - include("${CMAKE_CURRENT_LIST_DIR}/xrt-dev-targets.cmake") - endif() endif() get_filename_component(@PROJECT_NAME@_CMAKE_DIR "${CMAKE_CURRENT_LIST_DIR}" ABSOLUTE) diff --git a/src/CMake/findpackage.cmake b/src/CMake/findpackage.cmake index 3cdfb4f816b..57b6d2e38c5 100644 --- a/src/CMake/findpackage.cmake +++ b/src/CMake/findpackage.cmake @@ -44,18 +44,9 @@ install ( # This will generate a file that details all targets we have marked for export # as part of the xrt-targets export group # It will provide information such as the library file names and locations post install -if (NOT WIN32) install( EXPORT xrt-targets NAMESPACE ${PROJECT_NAME}:: DESTINATION ${XRT_INSTALL_DIR}/share/cmake/${PROJECT_NAME} ) -endif() -if (${XRT_NATIVE_BUILD} STREQUAL "yes") -install( - EXPORT xrt-dev-targets - NAMESPACE ${PROJECT_NAME}:: - DESTINATION ${XRT_INSTALL_DIR}/share/cmake/${PROJECT_NAME} - ) -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 7c60dac24a3..6cce3826758 100644 --- a/src/runtime_src/core/pcie/emulation/hw_emu/CMakeLists.txt +++ b/src/runtime_src/core/pcie/emulation/hw_emu/CMakeLists.txt @@ -61,15 +61,10 @@ target_link_libraries(xrt_hwemu_static uuid ) -install (TARGETS xrt_hwemu - EXPORT xrt-targets - LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} ${XRT_NAMELINK_SKIP} - RUNTIME DESTINATION ${XRT_INSTALL_BIN_DIR} -) - install (TARGETS xrt_hwemu xrt_hwemu_static - EXPORT xrt-dev-targets + 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} - LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_DEV_COMPONENT} ${XRT_NAMELINK_ONLY} ) 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 82777ec7431..748e636d0cb 100644 --- a/src/runtime_src/core/pcie/emulation/sw_emu/CMakeLists.txt +++ b/src/runtime_src/core/pcie/emulation/sw_emu/CMakeLists.txt @@ -55,14 +55,9 @@ target_link_libraries(xrt_swemu_static uuid ) -install (TARGETS xrt_swemu - EXPORT xrt-targets - LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} ${XRT_NAMELINK_SKIP} - RUNTIME DESTINATION ${XRT_INSTALL_BIN_DIR} -) - install (TARGETS xrt_swemu xrt_swemu_static - EXPORT xrt-dev-targets + 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} - LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_DEV_COMPONENT} ${XRT_NAMELINK_ONLY} ) diff --git a/src/runtime_src/core/pcie/linux/CMakeLists.txt b/src/runtime_src/core/pcie/linux/CMakeLists.txt index 443cdb212d0..5ea1d9ab8cc 100644 --- a/src/runtime_src/core/pcie/linux/CMakeLists.txt +++ b/src/runtime_src/core/pcie/linux/CMakeLists.txt @@ -67,14 +67,9 @@ target_link_libraries(xrt_core_static pthread ) -install(TARGETS xrt_core - EXPORT xrt-targets - LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} ${XRT_NAMELINK_SKIP} - RUNTIME DESTINATION ${XRT_INSTALL_BIN_DIR} -) - install(TARGETS xrt_core xrt_core_static - EXPORT xrt-dev-targets + 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} - LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_DEV_COMPONENT} ${XRT_NAMELINK_ONLY} ) diff --git a/src/runtime_src/core/pcie/noop/CMakeLists.txt b/src/runtime_src/core/pcie/noop/CMakeLists.txt index f5f880de2f6..4f68d4ae460 100644 --- a/src/runtime_src/core/pcie/noop/CMakeLists.txt +++ b/src/runtime_src/core/pcie/noop/CMakeLists.txt @@ -31,12 +31,7 @@ set_target_properties(xrt_noop PROPERTIES install(TARGETS xrt_noop EXPORT xrt-targets - LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} ${XRT_NAMELINK_SKIP} - RUNTIME DESTINATION ${XRT_INSTALL_BIN_DIR} -) - -install(TARGETS xrt_noop - EXPORT xrt-dev-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} - LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_DEV_COMPONENT} ${XRT_NAMELINK_ONLY} ) diff --git a/src/runtime_src/core/pcie/windows/alveo/CMakeLists.txt b/src/runtime_src/core/pcie/windows/alveo/CMakeLists.txt index 8fa5fc582eb..f452b68b197 100644 --- a/src/runtime_src/core/pcie/windows/alveo/CMakeLists.txt +++ b/src/runtime_src/core/pcie/windows/alveo/CMakeLists.txt @@ -47,14 +47,9 @@ endif() # RUNTIME target and the corresponding import library is treated as an # ARCHIVE target. All Windows-based systems including Cygwin are DLL # platforms. -install(TARGETS xrt_core - EXPORT xrt-targets - LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} ${XRT_NAMELINK_SKIP} - RUNTIME DESTINATION ${XRT_INSTALL_BIN_DIR} -) - install(TARGETS xrt_core xrt_core_static - EXPORT xrt-dev-targets + 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} - LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_DEV_COMPONENT} ${XRT_NAMELINK_ONLY} ) diff --git a/src/runtime_src/core/tools/xbtracer/src/lib/CMakeLists.txt b/src/runtime_src/core/tools/xbtracer/src/lib/CMakeLists.txt index 6d166dddb4a..ffb1dacb0e7 100644 --- a/src/runtime_src/core/tools/xbtracer/src/lib/CMakeLists.txt +++ b/src/runtime_src/core/tools/xbtracer/src/lib/CMakeLists.txt @@ -20,12 +20,7 @@ endif() install(TARGETS xrt_capture EXPORT xrt-targets - LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} ${XRT_NAMELINK_SKIP} - RUNTIME DESTINATION ${XRT_INSTALL_BIN_DIR} -) - -install(TARGETS xrt_capture - EXPORT xrt-dev-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} - LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_DEV_COMPONENT} ${XRT_NAMELINK_ONLY} ) diff --git a/src/runtime_src/hip/CMakeLists.txt b/src/runtime_src/hip/CMakeLists.txt index adcca972cbf..9cb5ab6bf86 100644 --- a/src/runtime_src/hip/CMakeLists.txt +++ b/src/runtime_src/hip/CMakeLists.txt @@ -47,14 +47,9 @@ set_target_properties(xrt_hip PROPERTIES install(TARGETS xrt_hip EXPORT xrt-targets - LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} ${XRT_NAMELINK_SKIP} - RUNTIME DESTINATION ${XRT_INSTALL_BIN_DIR} -) - -install(TARGETS xrt_hip - EXPORT xrt-dev-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} - LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_DEV_COMPONENT} ${XRT_NAMELINK_ONLY} ) # Release headers diff --git a/src/runtime_src/xocl/CMakeLists.txt b/src/runtime_src/xocl/CMakeLists.txt index 4ab9d47fd7d..3fe86eec011 100644 --- a/src/runtime_src/xocl/CMakeLists.txt +++ b/src/runtime_src/xocl/CMakeLists.txt @@ -90,22 +90,11 @@ target_link_libraries(xilinxopencl endif () -# install(TARGETS xilinxopencl -# ARCHIVE DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_DEV_COMPONENT} -# LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT xrt NAMELINK_COMPONENT ${XRT_DEV_COMPONENT} -# RUNTIME DESTINATION ${XRT_INSTALL_BIN_DIR} -# ) - -install(TARGETS xilinxopencl - EXPORT xrt-targets - LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} ${XRT_NAMELINK_SKIP} - RUNTIME DESTINATION ${XRT_INSTALL_BIN_DIR} -) - install(TARGETS xilinxopencl xilinxopencl_static - EXPORT xrt-dev-targets + 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} - LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_DEV_COMPONENT} ${XRT_NAMELINK_ONLY} ) # Release OpenCL extension headers diff --git a/src/runtime_src/xrt/CMakeLists.txt b/src/runtime_src/xrt/CMakeLists.txt index 8c564f6f812..c4a402c275c 100644 --- a/src/runtime_src/xrt/CMakeLists.txt +++ b/src/runtime_src/xrt/CMakeLists.txt @@ -56,14 +56,9 @@ target_link_libraries(xrt++ set_target_properties(xrt++ PROPERTIES VERSION ${XRT_VERSION_STRING} SOVERSION ${XRT_SOVERSION}) -install(TARGETS xrt++ - EXPORT xrt-targets - LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} ${XRT_NAMELINK_SKIP} - RUNTIME DESTINATION ${XRT_INSTALL_BIN_DIR} -) - install(TARGETS xrt++ xrt++_static - EXPORT xrt-dev-targets + 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} - LIBRARY DESTINATION ${XRT_INSTALL_LIB_DIR} COMPONENT ${XRT_DEV_COMPONENT} ${XRT_NAMELINK_ONLY} ) From 83e757edea4ed432c3f85fc2582dd77a50e9ff58 Mon Sep 17 00:00:00 2001 From: Soren Soe <2106410+stsoe@users.noreply.github.com> Date: Tue, 14 Jan 2025 08:47:07 -0800 Subject: [PATCH 3/3] Default to legacy XRT build automatically By defaulting to legacy XRT build, we don't have to change windows build scripts right now. Signed-off-by: Soren Soe <2106410+stsoe@users.noreply.github.com> --- build/build-win22.sh | 10 +++++----- build/build.sh | 10 +++++----- build/build22.bat | 2 +- src/CMake/components.cmake | 12 ++++++------ 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/build/build-win22.sh b/build/build-win22.sh index 07df6d16be2..31186b82b17 100644 --- a/build/build-win22.sh +++ b/build/build-win22.sh @@ -118,6 +118,11 @@ while [ $# -gt 0 ]; do esac done +if [[ $((npu_build + alveo_build + base_build)) > 1 ]]; then + echo "build.sh: -npu, -alveo, -base are mutually exclusive" + exit 1 +fi + BOOST=$(sed -e 's|/mnt/\([A-Za-z]\)/\(.*\)|\1:/\2|' -e 's|/|\\|g' <<< $BOOST) KHRONOS=$(sed -e 's|/mnt/\([A-Za-z]\)/\(.*\)|\1:/\2|' -e 's|/|\\|g' <<< $KHRONOS) @@ -135,11 +140,6 @@ cmake_flags+=" -DMSVC_PARALLEL_JOBS=$jcore" cmake_flags+=" -DKHRONOS=$KHRONOS" cmake_flags+=" -DBOOST_ROOT=$BOOST" -# Default build is legacy xrt, cannot be built with base, npu -if [[ $alveo_build == 0 && $npu_build == 0 && $base_build == 0 ]]; then - cmake_flags+=" -DXRT_XRT=1" -fi - echo "${cmake_flags[@]}" if [ $dbg == 1 ]; then diff --git a/build/build.sh b/build/build.sh index 3d7d6e66996..9734e62b64a 100755 --- a/build/build.sh +++ b/build/build.sh @@ -264,6 +264,11 @@ while [ $# -gt 0 ]; do esac done +if [[ $((npu_build + alveo_build + base_build)) > 1 ]]; then + echo "build.sh: -npu, -alveo, -base are mutually exclusive" + exit 1 +fi + debug_dir=${DEBUG_DIR:-Debug} release_dir=${REL_DIR:-Release} edge_dir=${EDGE_DIR:-Edge} @@ -276,11 +281,6 @@ cmake_flags+=" -DXRT_ENABLE_WERROR=$werror" # set CMAKE_INSTALL_PREFIX cmake_flags+=" -DCMAKE_INSTALL_PREFIX=$xrt_install_prefix -DXRT_INSTALL_PREFIX=$xrt_install_prefix" -# Default build is legacy xrt, cannot be built with base, npu -if [[ $alveo_build == 0 && $npu_build == 0 && $base_build == 0 ]]; then - cmake_flags+=" -DXRT_XRT=1" -fi - here=$PWD cd $BUILDDIR diff --git a/build/build22.bat b/build/build22.bat index 255589c5046..745baede207 100644 --- a/build/build22.bat +++ b/build/build22.bat @@ -72,7 +72,7 @@ IF DEFINED MSVC_PARALLEL_JOBS ( SET LOCAL_MSVC_PARALLEL_JOBS=%MSVC_PARALLEL_JOBS :argsParsed -set CMAKEFLAGS=%CMAKEFLAGS% -DMSVC_PARALLEL_JOBS=%LOCAL_MSVC_PARALLEL_JOBS% -DKHRONOS=%EXT_DIR% -DBOOST_ROOT=%EXT_DIR% -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DXRT_XRT=1 +set CMAKEFLAGS=%CMAKEFLAGS% -DMSVC_PARALLEL_JOBS=%LOCAL_MSVC_PARALLEL_JOBS% -DKHRONOS=%EXT_DIR% -DBOOST_ROOT=%EXT_DIR% -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ECHO CMAKEFLAGS=%CMAKEFLAGS% if [%DEBUG%] == [1] ( diff --git a/src/CMake/components.cmake b/src/CMake/components.cmake index caadabb6da3..248d78da911 100644 --- a/src/CMake/components.cmake +++ b/src/CMake/components.cmake @@ -14,12 +14,12 @@ else() set(LINUX_FLAVOR "none") endif() -# Default component name for any install() command without the COMPONENT argument -# The default component is the xrt run-time component, if XRT_DEV_COMPONENT is -# set to something different then a development component will be created with -# link libraries and header which are then excluded from runtime component -set (CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "xrt") - +# The default XRT build is legacy +if (NOT XRT_BASE AND NOT XRT_NPU AND NOT XRT_ALVEO) + message("-- Defaulting to legacy XRT build") + set(XRT_XRT 1) +endif() + # Enable development package by specifying development component name # If XRT_{PKG}_DEV_COMPONENT is same XRT_{PKG}_COMPONENT then only # that package is created with both development and run-time content.