Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prep for building separate packages for base, npu, and alveo #8691

Merged
merged 3 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions build/build-win22.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -99,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)

Expand Down
28 changes: 20 additions & 8 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -251,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}
Expand All @@ -263,12 +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"

# Set CMake variable indicating build for Alveo
# Specifying '-npu' disables Alveo
if [[ $alveo == 1 ]]; then
cmake_flags+=" -DXRT_ALVEO=1"
fi

here=$PWD
cd $BUILDDIR

Expand Down
81 changes: 65 additions & 16 deletions src/CMake/components.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,76 @@ if (NOT WIN32)
elseif (${LINUX_FLAVOR} MATCHES "^(rhel|centos)")
set (XRT_DEV_COMPONENT_SUFFIX "devel")
endif()
endif(NOT WIN32)

# 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")

else()
set(LINUX_FLAVOR "none")
endif()

# 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_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)

3 changes: 0 additions & 3 deletions src/CMake/config/xrt-edge.fp.in
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 0 additions & 3 deletions src/CMake/config/xrt.fp.in
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 0 additions & 9 deletions src/CMake/findpackage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
3 changes: 1 addition & 2 deletions src/CMake/nativeLnx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion src/CMake/nativeWin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 1 addition & 6 deletions src/CMake/version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
20 changes: 0 additions & 20 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 4 additions & 11 deletions src/runtime_src/core/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
5 changes: 0 additions & 5 deletions src/runtime_src/core/include/xrt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions src/runtime_src/core/include/xrt/deprecated/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 0 additions & 10 deletions src/runtime_src/core/include/xrt/detail/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/runtime_src/core/pcie/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading
Loading