Skip to content

Commit

Permalink
Modified CMakeLists.txt to build xclbinutil independently of XRT
Browse files Browse the repository at this point in the history
Signed-off-by: Manoj Takasi <[email protected]>
  • Loading branch information
ManojTakasi committed Nov 1, 2023
1 parent 7ebfd23 commit 8187624
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 47 deletions.
5 changes: 5 additions & 0 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ usage()
echo "[-ccache] Build using RDI's compile cache"
echo "[-toolchain <file>] Extra toolchain file to configure CMake"
echo "[-driver] Include building driver code"
echo "[-xclbinutil] Build xclbinutil only"
echo "[-checkpatch] Run checkpatch.pl on driver code"
echo "[-verbose] Turn on verbosity when compiling"
echo "[-ertbsp <dir>] Path to directory with pre-downloaded BSP files for building ERT (default: download BSP files during build time)"
Expand Down Expand Up @@ -207,6 +208,10 @@ while [ $# -gt 0 ]; do
cmake_flags+=" -DXRT_PSKERNEL_BUILD=ON"
shift
;;
-xclbinutil)
cmake_flags+=" -DBUILD_TARGET=xclbinutil"
shift
;;
-verbose)
verbose="VERBOSE=1"
shift
Expand Down
28 changes: 15 additions & 13 deletions src/CMake/findpackage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,20 @@ 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 (NOT BUILD_TARGET)
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}
)
if (${XRT_NATIVE_BUILD} STREQUAL "yes")
install(
EXPORT xrt-dev-targets
NAMESPACE ${PROJECT_NAME}::
DESTINATION ${XRT_INSTALL_DIR}/share/cmake/${PROJECT_NAME}
)
endif()
endif()
54 changes: 26 additions & 28 deletions src/CMake/nativeLnx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -170,32 +170,31 @@ message("-- Compiler: ${CMAKE_CXX_COMPILER} ${CMAKE_C_COMPILER}")
include (CMake/lint.cmake)

xrt_add_subdirectory(runtime_src)

#XMA settings START
set(XMA_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(XMA_INSTALL_DIR "${XRT_INSTALL_DIR}")
set(XMA_VERSION_STRING ${XRT_VERSION_MAJOR}.${XRT_VERSION_MINOR}.${XRT_VERSION_PATCH})
set(XMA_SOVERSION ${XRT_SOVERSION})
xrt_add_subdirectory(xma)
#XMA settings END

# --- Python bindings ---
xrt_add_subdirectory(python)

# --- Python tests ---
set(PY_TEST_SRC
../tests/python/22_verify/22_verify.py
../tests/python/utils_binding.py
../tests/python/23_bandwidth/23_bandwidth.py
../tests/python/23_bandwidth/host_mem_23_bandwidth.py
../tests/python/23_bandwidth/versal_23_bandwidth.py)
install (FILES ${PY_TEST_SRC}
PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
DESTINATION ${XRT_INSTALL_DIR}/test)

xrt_add_subdirectory("../tests/validate" "${CMAKE_CURRENT_BINARY_DIR}/validate_build")
message("-- XRT version: ${XRT_VERSION_STRING}")

if (NOT BUILD_TARGET)
#XMA settings START
set(XMA_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(XMA_INSTALL_DIR "${XRT_INSTALL_DIR}")
set(XMA_VERSION_STRING ${XRT_VERSION_MAJOR}.${XRT_VERSION_MINOR}.${XRT_VERSION_PATCH})
set(XMA_SOVERSION ${XRT_SOVERSION})
xrt_add_subdirectory(xma)
#XMA settings END

# --- Python bindings ---
xrt_add_subdirectory(python)

# --- Python tests ---
set(PY_TEST_SRC
../tests/python/22_verify/22_verify.py
../tests/python/utils_binding.py
../tests/python/23_bandwidth/23_bandwidth.py
../tests/python/23_bandwidth/host_mem_23_bandwidth.py
../tests/python/23_bandwidth/versal_23_bandwidth.py)
install (FILES ${PY_TEST_SRC}
PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
DESTINATION ${XRT_INSTALL_DIR}/test)

xrt_add_subdirectory("../tests/validate" "${CMAKE_CURRENT_BINARY_DIR}/validate_build")
message("-- XRT version: ${XRT_VERSION_STRING}")
# -- CPack
include (CMake/cpackLin.cmake)

Expand All @@ -217,9 +216,8 @@ include (CMake/pkgconfig.cmake)

# --- Coverity Support ---
include (CMake/coverity.cmake)

endif()
# --- Find Package Support ---
include (CMake/findpackage.cmake)

set (CTAGS "${XRT_SOURCE_DIR}/runtime_src/tools/scripts/tags.sh")
include (CMake/tags.cmake)
7 changes: 6 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
message("-- Host system processor is ${CMAKE_HOST_SYSTEM_PROCESSOR}")
message("-- Target system processor is ${CMAKE_SYSTEM_PROCESSOR}")

if(DEFINED BUILD_TARGET AND NOT ${BUILD_TARGET} STREQUAL "xclbinutil")
message(FATAL_ERROR "Build target should be set to xclbinutil")
endif()

set(XRT_NATIVE_BUILD "yes")
if (NOT ${CMAKE_SYSTEM_PROCESSOR} STREQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR})
set(XRT_NATIVE_BUILD "no")
endif()

if ( ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" )
set(XRT_WARN_OPTS
-Wall
Expand Down Expand Up @@ -126,7 +129,9 @@ if (${XRT_NATIVE_BUILD} STREQUAL "yes")
else()
include(CMake/nativeLnx.cmake)
endif()
if (NOT BUILD_TARGET)
xrt_include(CMake/nativeTests.cmake)
endif()
else()
include(CMake/embedded_system.cmake)
endif()
15 changes: 10 additions & 5 deletions src/runtime_src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,15 @@ endif(XRT_ENABLE_WERROR)
if (${XRT_NATIVE_BUILD} STREQUAL "yes")
add_compile_options( ${XRT_WARN_OPTS} )
endif()
xrt_add_subdirectory(xdp)
if (NOT BUILD_TARGET)
xrt_add_subdirectory(xdp)
xrt_add_subdirectory(xocl)
xrt_add_subdirectory(xrt)
xrt_add_subdirectory(ert)
endif()

xrt_add_subdirectory(tools/xclbinutil)
xrt_add_subdirectory(xocl)
xrt_add_subdirectory(xrt)
xrt_add_subdirectory(ert)

if (${XRT_NATIVE_BUILD} STREQUAL "yes")
# Only for host native build.
# For embedded, headers and libraries are installed in /usr
Expand All @@ -47,7 +50,9 @@ endif()
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-Bsymbolic")
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs")

xrt_add_subdirectory(core)
if (NOT BUILD_TARGET)
xrt_add_subdirectory(core)
endif()

else()
# = WINDOWS ===================================================================
Expand Down

0 comments on commit 8187624

Please sign in to comment.