diff --git a/build/build.sh b/build/build.sh index eacfc213064..fa073c620e7 100755 --- a/build/build.sh +++ b/build/build.sh @@ -65,6 +65,7 @@ usage() echo "[-ccache] Build using RDI's compile cache" echo "[-toolchain ] 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 ] Path to directory with pre-downloaded BSP files for building ERT (default: download BSP files during build time)" @@ -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 diff --git a/src/CMake/findpackage.cmake b/src/CMake/findpackage.cmake index 3cdfb4f816b..a9c1c928f6e 100644 --- a/src/CMake/findpackage.cmake +++ b/src/CMake/findpackage.cmake @@ -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() diff --git a/src/CMake/nativeLnx.cmake b/src/CMake/nativeLnx.cmake index 8b4ec271249..3790ce7256f 100644 --- a/src/CMake/nativeLnx.cmake +++ b/src/CMake/nativeLnx.cmake @@ -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) @@ -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) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 262d7058fb7..517d55142cc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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 @@ -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() diff --git a/src/runtime_src/CMakeLists.txt b/src/runtime_src/CMakeLists.txt index 47bf11a2d06..3e632a7e052 100644 --- a/src/runtime_src/CMakeLists.txt +++ b/src/runtime_src/CMakeLists.txt @@ -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 @@ -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 ===================================================================