From 4b25c2b7dffef911367af314fd5d120e3377ac96 Mon Sep 17 00:00:00 2001 From: thomthehound Date: Fri, 20 Feb 2026 00:20:51 -0500 Subject: [PATCH 1/7] Windows: build script update Signed-off-by: thomthehound --- build/build26.bat | 254 ++++++++++++++++++ .../tools/scripts/xrtdeps-vcpkg.bat | 120 +++++++++ .../tools/xclbinutil/CMakeLists.txt | 5 +- 3 files changed, 376 insertions(+), 3 deletions(-) create mode 100644 build/build26.bat create mode 100644 src/runtime_src/tools/scripts/xrtdeps-vcpkg.bat diff --git a/build/build26.bat b/build/build26.bat new file mode 100644 index 00000000000..2bdc0f82961 --- /dev/null +++ b/build/build26.bat @@ -0,0 +1,254 @@ +@ECHO OFF + +REM SPDX-License-Identifier: Apache-2.0 +REM Copyright (C) 2026 Advanced Micro Devices, Inc. All rights reserved. + +setlocal +set "DO_CLEAN=0" +set "SCRIPTDIR=%~dp0" +set "SCRIPTDIR=%SCRIPTDIR:~0,-1%" +set "BUILDDIR=%SCRIPTDIR%" + +set "DEBUG=1" +set "RELEASE=1" +set "EXT_DIR=%BUILDDIR%\ext.vcpkg\vcpkg_installed\x64-windows" +set "EXT_DIR_USER=0" +set "CI_EXT_DIR=C:\Xilinx\XRT\ext.new" +set "CMAKEFLAGS=" +set "NOCMAKE=0" +set "STAGE_EXT=0" +set "CREATE_SDK=0" +set "CREATE_PACKAGE=0" +set "INSTALL_ROOT=" + +IF DEFINED MSVC_PARALLEL_JOBS ( SET "LOCAL_MSVC_PARALLEL_JOBS=%MSVC_PARALLEL_JOBS%" ) ELSE ( SET "LOCAL_MSVC_PARALLEL_JOBS=4" ) + +REM -------------------------------------------------------------------------- +:parseArgs +if "%~1"=="" goto argsParsed + +if /I "%~1"=="-help" goto help +if /I "%~1"=="-ext" goto parseExt +if /I "%~1"=="-install" goto parseInstall + +if /I "%~1"=="-clean" ( set "DO_CLEAN=1" & shift & goto parseArgs ) +if /I "%~1"=="-dbg" ( set "RELEASE=0" & shift & goto parseArgs ) +if /I "%~1"=="-opt" ( set "DEBUG=0" & shift & goto parseArgs ) +if /I "%~1"=="-stage_ext" ( set "STAGE_EXT=1" & shift & goto parseArgs ) +if /I "%~1"=="-sdk" ( set "CREATE_SDK=1" & set "CMAKEFLAGS=%CMAKEFLAGS% -DXRT_NPU=1" & shift & goto parseArgs ) +if /I "%~1"=="-pkg" ( set "CREATE_PACKAGE=1" & shift & goto parseArgs ) +if /I "%~1"=="-npu" ( set "CMAKEFLAGS=%CMAKEFLAGS% -DXRT_NPU=1" & shift & goto parseArgs ) +if /I "%~1"=="-noabi" ( set "CMAKEFLAGS=%CMAKEFLAGS% -DDISABLE_ABI_CHECK=1" & shift & goto parseArgs ) +if /I "%~1"=="-hip" ( set "CMAKEFLAGS=%CMAKEFLAGS% -DXRT_ENABLE_HIP=ON" & shift & goto parseArgs ) +if /I "%~1"=="-nocmake" ( set "NOCMAKE=1" & shift & goto parseArgs ) + +echo Unknown option: %1 +goto help + +REM -------------------------------------------------------------------------- +:parseExt +shift +if "%~1"=="" ( + echo ERROR: -ext requires a path argument + exit /B 2 +) +set "EXT_DIR=%~1" +set "EXT_DIR_USER=1" +shift +goto parseArgs + +REM -------------------------------------------------------------------------- +:parseInstall +shift +if "%~1"=="" ( + set "INSTALL_ROOT=C:\Xilinx\XRT" + goto parseArgs +) +if "%~1:~0,1%"=="-" ( + set "INSTALL_ROOT=C:\Xilinx\XRT" + goto parseArgs +) +set "INSTALL_ROOT=%~1" +shift +goto parseArgs + +REM -------------------------------------------------------------------------- +:argsParsed +if "%DO_CLEAN%"=="1" goto clean +call :pickGenerator + +REM Prefer repo-local vcpkg deps when present; otherwise fall back to CI ext.new. +if "%EXT_DIR_USER%"=="0" ( + if not exist "%EXT_DIR%\" ( + if exist "%CI_EXT_DIR%\" set "EXT_DIR=%CI_EXT_DIR%" + ) +) + +if not exist "%EXT_DIR%\" ( + echo ERROR: dependency prefix not found: "%EXT_DIR%" + echo Use -ext ^, or run src\runtime_src\tools\scripts\xrtdeps-vcpkg.bat + exit /B 2 +) + +if "%INSTALL_ROOT%"=="" goto :skipInstallCheck +if not "%DEBUG%"=="1" goto :skipInstallCheck +if not "%RELEASE%"=="1" goto :skipInstallCheck +echo ERROR: -install requires -dbg or -opt (cannot install both configs into one prefix) + +exit /B 2 + +REM -------------------------------------------------------------------------- +:skipInstallCheck + +if "%DEBUG%"=="1" call :doBuild Debug WDebug +if errorlevel 1 exit /B + +if "%RELEASE%"=="1" call :doBuild Release WRelease +if errorlevel 1 exit /B + +goto :EOF + +REM -------------------------------------------------------------------------- +:pickGenerator +if not "%GENERATOR%"=="" goto :EOF + +cmake --help 2>NUL | findstr /C:"Visual Studio 18 2026" >NUL +if errorlevel 1 goto UseVS17 + +set "GENERATOR=Visual Studio 18 2026" +goto :EOF + +:UseVS17 +set "GENERATOR=Visual Studio 17 2022" +goto :EOF + +REM -------------------------------------------------------------------------- +:doBuild +set "CFG=%~1" +set "DIR=%~2" +set "XRT_INSTALL_PREFIX=%BUILDDIR%\%DIR%\xilinx\xrt" +if not "%INSTALL_ROOT%"=="" set "XRT_INSTALL_PREFIX=%INSTALL_ROOT%" + +if "%NOCMAKE%"=="0" goto doConfig +goto doBuildOnly + +REM -------------------------------------------------------------------------- +:doConfig +echo Configuring %CFG%... +set "LOCAL_CMAKEFLAGS=%CMAKEFLAGS%" +if not "%EXT_DIR:vcpkg_installed=%"=="%EXT_DIR%" set "LOCAL_CMAKEFLAGS=%LOCAL_CMAKEFLAGS% -DCMAKE_PREFIX_PATH=%EXT_DIR%" +set "PROTOC_EXE=%EXT_DIR%\tools\protobuf\protoc.exe" +if exist "%PROTOC_EXE%" ( + set "LOCAL_CMAKEFLAGS=%LOCAL_CMAKEFLAGS% -DProtobuf_PROTOC_EXECUTABLE=%PROTOC_EXE%" +) else ( + if not "%EXT_DIR:vcpkg_installed=%"=="%EXT_DIR%" ( + echo ERROR: protoc.exe not found: "%PROTOC_EXE%" + exit /B 2 + ) +) +cmake -B "%BUILDDIR%\%DIR%" -G "%GENERATOR%" ^ + -DMSVC_PARALLEL_JOBS=%LOCAL_MSVC_PARALLEL_JOBS% ^ + -DCMAKE_VS_GLOBALS="VcpkgEnabled=false" ^ + -DKHRONOS="%EXT_DIR%" ^ + -DBOOST_ROOT="%EXT_DIR%" ^ + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ^ + %LOCAL_CMAKEFLAGS% ^ + "%BUILDDIR%\..\src" +if errorlevel 1 exit /B + +REM -------------------------------------------------------------------------- +:doBuildOnly +echo Building %CFG%... +cmake --build "%BUILDDIR%\%DIR%" --config %CFG% --verbose +if errorlevel 1 exit /B + +echo Installing %CFG%... +cmake --install "%BUILDDIR%\%DIR%" --config %CFG% --prefix "%XRT_INSTALL_PREFIX%" +if errorlevel 1 exit /B + +if "%STAGE_EXT%"=="1" ( + call :stageExt "%CFG%" "%XRT_INSTALL_PREFIX%" + if errorlevel 1 exit /B +) + +set "DO_ZIP=0" +if /I "%CFG%"=="Release" ( + if "%CREATE_SDK%"=="1" set "DO_ZIP=1" + if "%CREATE_PACKAGE%"=="1" set "DO_ZIP=1" + if "%DO_ZIP%"=="1" call :doCpackZip "%BUILDDIR%\%DIR%" "%CFG%" || exit /B + if "%CREATE_PACKAGE%"=="1" call :doCpackWix "%BUILDDIR%\%DIR%" "%CFG%" || exit /B +) + +exit /B 0 + +REM -------------------------------------------------------------------------- +:stageExt +set "CFG=%~1" +set "XRT_ROOT=%~2" + +set "VCPKG_BIN=%EXT_DIR%\bin" +if /I "%CFG%"=="Debug" if exist "%EXT_DIR%\debug\bin\" set "VCPKG_BIN=%EXT_DIR%\debug\bin" + +set "XRT_EXT_BIN=%XRT_ROOT%\ext\bin" +if not exist "%XRT_EXT_BIN%\" mkdir "%XRT_EXT_BIN%" >NUL 2>NUL + +copy /Y "%VCPKG_BIN%\boost_filesystem*.dll" "%XRT_EXT_BIN%\" || exit /B +copy /Y "%VCPKG_BIN%\boost_program_options*.dll" "%XRT_EXT_BIN%\" || exit /B +copy /Y "%VCPKG_BIN%\libprotobuf*.dll" "%XRT_EXT_BIN%\" || exit /B + +exit /B 0 + +REM -------------------------------------------------------------------------- +:doCpackZip +set "CPACK_BUILD_DIR=%~1" +set "CPACK_CFG=%~2" + +echo ====================== Creating SDK ZIP archive ============================ +echo cpack -G ZIP -B "%CPACK_BUILD_DIR%" -C %CPACK_CFG% --config "%CPACK_BUILD_DIR%\CPackConfig.cmake" +cpack -G ZIP -B "%CPACK_BUILD_DIR%" -C %CPACK_CFG% --config "%CPACK_BUILD_DIR%\CPackConfig.cmake" + +exit /B + +REM -------------------------------------------------------------------------- +:doCpackWix +set "CPACK_BUILD_DIR=%~1" +set "CPACK_CFG=%~2" + +echo ====================== Creating MSI Archive ============================== +echo cpack -G WIX -B "%CPACK_BUILD_DIR%" -C %CPACK_CFG% --config "%CPACK_BUILD_DIR%\CPackConfig.cmake" +cpack -G WIX -B "%CPACK_BUILD_DIR%" -C %CPACK_CFG% --config "%CPACK_BUILD_DIR%\CPackConfig.cmake" + +exit /B + +REM -------------------------------------------------------------------------- +:help +echo. +echo Usage: build26.bat [options] +echo. +echo [-help] - List this help +echo [-clean] - Remove build artifact directories +echo [-dbg] - Debug build only +echo [-opt] - Release build only +echo [-ext ^] - Dependency prefix (include/lib/bin) +echo [-install [^]] - Install prefix (default: C:\Xilinx\XRT) +echo [-stage_ext] - Copy a small set of runtime DLLs into ^\ext\bin +echo [-sdk] - Build NPU and create a ZIP archive via CPack (Release only) +echo [-pkg] - Create ZIP and MSI archives via CPack (Release only) +echo [-npu] - Build NPU component of XRT +echo [-noabi] - Disable ABI check +echo [-hip] - Enable HIP build +echo [-nocmake] - Skip re-configure; build/install only +echo. +echo Note: +echo Default EXT_DIR uses build\ext.vcpkg if present; otherwise uses C:\Xilinx\XRT\ext.new (CI). +echo To install vcpkg deps into build\ext.vcpkg, run: +echo src\runtime_src\tools\scripts\xrtdeps-vcpkg.bat +goto :EOF + +REM -------------------------------------------------------------------------- +:clean +if exist "%BUILDDIR%\WDebug" rmdir /S /Q "%BUILDDIR%\WDebug" +if exist "%BUILDDIR%\WRelease" rmdir /S /Q "%BUILDDIR%\WRelease" +echo Build directories cleaned. + +exit /B 0 diff --git a/src/runtime_src/tools/scripts/xrtdeps-vcpkg.bat b/src/runtime_src/tools/scripts/xrtdeps-vcpkg.bat new file mode 100644 index 00000000000..d255cd44d8a --- /dev/null +++ b/src/runtime_src/tools/scripts/xrtdeps-vcpkg.bat @@ -0,0 +1,120 @@ +@ECHO OFF + +REM SPDX-License-Identifier: Apache-2.0 +REM Copyright (C) 2026 Advanced Micro Devices, Inc. All rights reserved. + +setlocal +set "DO_CLEAN=0" +set "SCRIPTDIR=%~dp0" +set "SCRIPTDIR=%SCRIPTDIR:~0,-1%" +set "SRC_ROOT=%SCRIPTDIR%\..\..\..\.." +set "EXTRA_PORTS=" + +for %%I in ("%SRC_ROOT%") do set "SRC_ROOT=%%~fI" + +if "%XRT_EXT_ROOT%"=="" set "XRT_EXT_ROOT=%SRC_ROOT%\build\ext.vcpkg" +if "%VCPKG_TRIPLET%"=="" set "VCPKG_TRIPLET=x64-windows" + +REM -------------------------------------------------------------------------- +:parseArgs +if "%~1"=="" goto argsParsed + +if /I "%~1"=="-help" goto help +if /I "%~1"=="-extroot" goto parseExtRoot +if /I "%~1"=="-triplet" goto parseTriplet +if /I "%~1"=="-port" goto parsePort +if /I "%~1"=="-clean" ( set "DO_CLEAN=1" & shift & goto parseArgs ) + +echo Unknown option: %1 +goto help + +REM -------------------------------------------------------------------------- +:parseExtRoot +shift + +if "%~1"=="" ( + echo ERROR: -extroot requires a path argument + exit /B 2 +) + +set "XRT_EXT_ROOT=%~1" +shift +goto parseArgs + +REM -------------------------------------------------------------------------- +:parseTriplet +shift + +if "%~1"=="" ( + echo ERROR: -triplet requires an argument + exit /B 2 +) + +set "VCPKG_TRIPLET=%~1" +shift +goto parseArgs + +REM -------------------------------------------------------------------------- +:parsePort +shift + +if "%~1"=="" ( + echo ERROR: -port requires a port name + exit /B 2 +) + +set "EXTRA_PORTS=%EXTRA_PORTS% %~1" +shift +goto parseArgs + +REM -------------------------------------------------------------------------- +:argsParsed +if "%DO_CLEAN%"=="1" goto clean + +set "EXT_DIR=%XRT_EXT_ROOT%\vcpkg_installed\%VCPKG_TRIPLET%" + +mkdir "%XRT_EXT_ROOT%" >NUL 2>NUL + +pushd "%XRT_EXT_ROOT%" || exit /B +del /F /Q vcpkg.json vcpkg-configuration.json vcpkg-lock.json >NUL 2>NUL +vcpkg new --application || exit /B +vcpkg add port boost-filesystem boost-program-options boost-property-tree boost-format boost-headers boost-interprocess boost-uuid boost-asio boost-process opencl protobuf %EXTRA_PORTS% || exit /B +vcpkg install --triplet %VCPKG_TRIPLET% --clean-after-build || exit /B +popd + +REM Needed for pyxrt. +python -m pip install pybind11 || exit /B + +echo. +echo Dependency prefix ready: +echo EXT_DIR=%EXT_DIR% +echo. +echo Build example: +echo build\build26.bat -ext "%EXT_DIR%" -stage_ext -opt -npu -install + +exit /B 0 + +REM -------------------------------------------------------------------------- +:help +echo. +echo Usage: xrtdeps-vcpkg.bat [options] +echo. +echo [-help] - List this help +echo [-extroot ^] - Root directory for vcpkg deps (default: ^\build\ext.vcpkg) +echo [-clean] - Remove the extroot directory (default: ^\build\ext.vcpkg) +echo [-triplet ^] - vcpkg triplet (default: x64-windows) +echo [-port ^] - Extra vcpkg port to install (may be repeated) +echo. +echo Note: Uses first vcpkg on PATH. + +exit /B 2 + +REM -------------------------------------------------------------------------- +:clean +if not exist "%XRT_EXT_ROOT%\vcpkg.json" ( + echo ERROR: Refusing to delete "%XRT_EXT_ROOT%" because vcpkg.json was not found. + exit /B 2 +) +rmdir /S /Q "%XRT_EXT_ROOT%" || exit /B 2 + +exit /B 0 diff --git a/src/runtime_src/tools/xclbinutil/CMakeLists.txt b/src/runtime_src/tools/xclbinutil/CMakeLists.txt index c8b7825d8a0..6e2545fd29f 100644 --- a/src/runtime_src/tools/xclbinutil/CMakeLists.txt +++ b/src/runtime_src/tools/xclbinutil/CMakeLists.txt @@ -219,10 +219,9 @@ if(NOT WIN32 AND NOT XRT_SYSTEM_INSTALL) endif() -if (WIN32) +if (WIN32 AND NOT DEFINED GTEST_ROOT) set(GTEST_ROOT "C:/Xilinx/XRT/ext") endif() - find_package(GTest) if (GTEST_FOUND AND NOT XRT_SYSTEM_INSTALL) @@ -239,7 +238,7 @@ if (GTEST_FOUND AND NOT XRT_SYSTEM_INSTALL) add_executable(${UNIT_TEST_NAME} ${XCLBINTEST_SRCS}) if(WIN32) - target_link_libraries(${UNIT_TEST_NAME} PRIVATE Boost::program_options Boost::system ) + target_link_libraries(${UNIT_TEST_NAME} PRIVATE Boost::program_options Boost::filesystem Boost::system ) target_link_libraries(${UNIT_TEST_NAME} PRIVATE ${GTEST_BOTH_LIBRARIES}) else() target_link_libraries(${UNIT_TEST_NAME} PRIVATE ${Boost_LIBRARIES} ${GTEST_BOTH_LIBRARIES} pthread crypto) From bae3e56c5185263d0da3ff462c06d34d34c51bf2 Mon Sep 17 00:00:00 2001 From: thomthehound Date: Fri, 20 Feb 2026 04:04:25 -0500 Subject: [PATCH 2/7] fix stage arg Signed-off-by: thomthehound --- build/build26.bat | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build/build26.bat b/build/build26.bat index 2bdc0f82961..7006b4cc32e 100644 --- a/build/build26.bat +++ b/build/build26.bat @@ -16,7 +16,7 @@ set "EXT_DIR_USER=0" set "CI_EXT_DIR=C:\Xilinx\XRT\ext.new" set "CMAKEFLAGS=" set "NOCMAKE=0" -set "STAGE_EXT=0" +set "STAGE=0" set "CREATE_SDK=0" set "CREATE_PACKAGE=0" set "INSTALL_ROOT=" @@ -34,7 +34,7 @@ if /I "%~1"=="-install" goto parseInstall if /I "%~1"=="-clean" ( set "DO_CLEAN=1" & shift & goto parseArgs ) if /I "%~1"=="-dbg" ( set "RELEASE=0" & shift & goto parseArgs ) if /I "%~1"=="-opt" ( set "DEBUG=0" & shift & goto parseArgs ) -if /I "%~1"=="-stage_ext" ( set "STAGE_EXT=1" & shift & goto parseArgs ) +if /I "%~1"=="-stage" ( set "STAGE=1" & shift & goto parseArgs ) if /I "%~1"=="-sdk" ( set "CREATE_SDK=1" & set "CMAKEFLAGS=%CMAKEFLAGS% -DXRT_NPU=1" & shift & goto parseArgs ) if /I "%~1"=="-pkg" ( set "CREATE_PACKAGE=1" & shift & goto parseArgs ) if /I "%~1"=="-npu" ( set "CMAKEFLAGS=%CMAKEFLAGS% -DXRT_NPU=1" & shift & goto parseArgs ) @@ -166,7 +166,7 @@ echo Installing %CFG%... cmake --install "%BUILDDIR%\%DIR%" --config %CFG% --prefix "%XRT_INSTALL_PREFIX%" if errorlevel 1 exit /B -if "%STAGE_EXT%"=="1" ( +if "%STAGE%"=="1" ( call :stageExt "%CFG%" "%XRT_INSTALL_PREFIX%" if errorlevel 1 exit /B ) @@ -229,9 +229,9 @@ echo [-help] - List this help echo [-clean] - Remove build artifact directories echo [-dbg] - Debug build only echo [-opt] - Release build only -echo [-ext ^] - Dependency prefix (include/lib/bin) +echo [-ext ^] - Sets EXT_DIR (usually a vcpkg prefix) for dependencies echo [-install [^]] - Install prefix (default: C:\Xilinx\XRT) -echo [-stage_ext] - Copy a small set of runtime DLLs into ^\ext\bin +echo [-stage] - Copy a small set of runtime DLLs into ^\ext\bin echo [-sdk] - Build NPU and create a ZIP archive via CPack (Release only) echo [-pkg] - Create ZIP and MSI archives via CPack (Release only) echo [-npu] - Build NPU component of XRT From 09952465867a0859b9bd375589e63293492a0a54 Mon Sep 17 00:00:00 2001 From: thomthehound Date: Fri, 20 Feb 2026 16:35:38 -0500 Subject: [PATCH 3/7] formatting Signed-off-by: thomthehound --- build/build26.bat | 54 +++++++++---------- .../tools/scripts/xrtdeps-vcpkg.bat | 2 +- .../tools/xclbinutil/CMakeLists.txt | 3 +- 3 files changed, 28 insertions(+), 31 deletions(-) diff --git a/build/build26.bat b/build/build26.bat index 7006b4cc32e..93d172ea536 100644 --- a/build/build26.bat +++ b/build/build26.bat @@ -8,7 +8,6 @@ set "DO_CLEAN=0" set "SCRIPTDIR=%~dp0" set "SCRIPTDIR=%SCRIPTDIR:~0,-1%" set "BUILDDIR=%SCRIPTDIR%" - set "DEBUG=1" set "RELEASE=1" set "EXT_DIR=%BUILDDIR%\ext.vcpkg\vcpkg_installed\x64-windows" @@ -27,20 +26,19 @@ REM -------------------------------------------------------------------------- :parseArgs if "%~1"=="" goto argsParsed -if /I "%~1"=="-help" goto help -if /I "%~1"=="-ext" goto parseExt -if /I "%~1"=="-install" goto parseInstall - -if /I "%~1"=="-clean" ( set "DO_CLEAN=1" & shift & goto parseArgs ) -if /I "%~1"=="-dbg" ( set "RELEASE=0" & shift & goto parseArgs ) -if /I "%~1"=="-opt" ( set "DEBUG=0" & shift & goto parseArgs ) -if /I "%~1"=="-stage" ( set "STAGE=1" & shift & goto parseArgs ) -if /I "%~1"=="-sdk" ( set "CREATE_SDK=1" & set "CMAKEFLAGS=%CMAKEFLAGS% -DXRT_NPU=1" & shift & goto parseArgs ) -if /I "%~1"=="-pkg" ( set "CREATE_PACKAGE=1" & shift & goto parseArgs ) -if /I "%~1"=="-npu" ( set "CMAKEFLAGS=%CMAKEFLAGS% -DXRT_NPU=1" & shift & goto parseArgs ) -if /I "%~1"=="-noabi" ( set "CMAKEFLAGS=%CMAKEFLAGS% -DDISABLE_ABI_CHECK=1" & shift & goto parseArgs ) -if /I "%~1"=="-hip" ( set "CMAKEFLAGS=%CMAKEFLAGS% -DXRT_ENABLE_HIP=ON" & shift & goto parseArgs ) -if /I "%~1"=="-nocmake" ( set "NOCMAKE=1" & shift & goto parseArgs ) +if /I "%~1"=="-help" goto help +if /I "%~1"=="-ext" goto parseExt +if /I "%~1"=="-install" goto parseInstall +if /I "%~1"=="-clean" ( set "DO_CLEAN=1" & shift & goto parseArgs ) +if /I "%~1"=="-dbg" ( set "RELEASE=0" & shift & goto parseArgs ) +if /I "%~1"=="-opt" ( set "DEBUG=0" & shift & goto parseArgs ) +if /I "%~1"=="-stage" ( set "STAGE=1" & shift & goto parseArgs ) +if /I "%~1"=="-sdk" ( set "CREATE_SDK=1" & set "CMAKEFLAGS=%CMAKEFLAGS% -DXRT_NPU=1" & shift & goto parseArgs ) +if /I "%~1"=="-pkg" ( set "CREATE_PACKAGE=1" & shift & goto parseArgs ) +if /I "%~1"=="-npu" ( set "CMAKEFLAGS=%CMAKEFLAGS% -DXRT_NPU=1" & shift & goto parseArgs ) +if /I "%~1"=="-noabi" ( set "CMAKEFLAGS=%CMAKEFLAGS% -DDISABLE_ABI_CHECK=1" & shift & goto parseArgs ) +if /I "%~1"=="-hip" ( set "CMAKEFLAGS=%CMAKEFLAGS% -DXRT_ENABLE_HIP=ON" & shift & goto parseArgs ) +if /I "%~1"=="-nocmake" ( set "NOCMAKE=1" & shift & goto parseArgs ) echo Unknown option: %1 goto help @@ -48,10 +46,12 @@ goto help REM -------------------------------------------------------------------------- :parseExt shift + if "%~1"=="" ( - echo ERROR: -ext requires a path argument + echo ERROR: -ext requires a path as argument exit /B 2 ) + set "EXT_DIR=%~1" set "EXT_DIR_USER=1" shift @@ -60,15 +60,12 @@ goto parseArgs REM -------------------------------------------------------------------------- :parseInstall shift -if "%~1"=="" ( - set "INSTALL_ROOT=C:\Xilinx\XRT" - goto parseArgs -) -if "%~1:~0,1%"=="-" ( - set "INSTALL_ROOT=C:\Xilinx\XRT" - goto parseArgs -) -set "INSTALL_ROOT=%~1" + +set "INSTALL_ARG=%~1" +if "%INSTALL_ARG%"=="" ( set "INSTALL_ROOT=C:\Xilinx\XRT" & goto parseArgs ) +if "%INSTALL_ARG:~0,1%"=="-" ( set "INSTALL_ROOT=C:\Xilinx\XRT" & goto parseArgs ) + +set "INSTALL_ROOT=%INSTALL_ARG%" shift goto parseArgs @@ -94,12 +91,9 @@ if "%INSTALL_ROOT%"=="" goto :skipInstallCheck if not "%DEBUG%"=="1" goto :skipInstallCheck if not "%RELEASE%"=="1" goto :skipInstallCheck echo ERROR: -install requires -dbg or -opt (cannot install both configs into one prefix) - exit /B 2 -REM -------------------------------------------------------------------------- :skipInstallCheck - if "%DEBUG%"=="1" call :doBuild Debug WDebug if errorlevel 1 exit /B @@ -136,6 +130,7 @@ REM -------------------------------------------------------------------------- :doConfig echo Configuring %CFG%... set "LOCAL_CMAKEFLAGS=%CMAKEFLAGS%" + if not "%EXT_DIR:vcpkg_installed=%"=="%EXT_DIR%" set "LOCAL_CMAKEFLAGS=%LOCAL_CMAKEFLAGS% -DCMAKE_PREFIX_PATH=%EXT_DIR%" set "PROTOC_EXE=%EXT_DIR%\tools\protobuf\protoc.exe" if exist "%PROTOC_EXE%" ( @@ -146,6 +141,7 @@ if exist "%PROTOC_EXE%" ( exit /B 2 ) ) + cmake -B "%BUILDDIR%\%DIR%" -G "%GENERATOR%" ^ -DMSVC_PARALLEL_JOBS=%LOCAL_MSVC_PARALLEL_JOBS% ^ -DCMAKE_VS_GLOBALS="VcpkgEnabled=false" ^ @@ -229,7 +225,7 @@ echo [-help] - List this help echo [-clean] - Remove build artifact directories echo [-dbg] - Debug build only echo [-opt] - Release build only -echo [-ext ^] - Sets EXT_DIR (usually a vcpkg prefix) for dependencies +echo [-ext ^] - Sets EXT_DIR for dependencies (usually a vcpkg prefix) echo [-install [^]] - Install prefix (default: C:\Xilinx\XRT) echo [-stage] - Copy a small set of runtime DLLs into ^\ext\bin echo [-sdk] - Build NPU and create a ZIP archive via CPack (Release only) diff --git a/src/runtime_src/tools/scripts/xrtdeps-vcpkg.bat b/src/runtime_src/tools/scripts/xrtdeps-vcpkg.bat index d255cd44d8a..2f6aa6958fa 100644 --- a/src/runtime_src/tools/scripts/xrtdeps-vcpkg.bat +++ b/src/runtime_src/tools/scripts/xrtdeps-vcpkg.bat @@ -90,7 +90,7 @@ echo Dependency prefix ready: echo EXT_DIR=%EXT_DIR% echo. echo Build example: -echo build\build26.bat -ext "%EXT_DIR%" -stage_ext -opt -npu -install +echo build\build26.bat -ext "%EXT_DIR%" -opt -npu -install -stage exit /B 0 diff --git a/src/runtime_src/tools/xclbinutil/CMakeLists.txt b/src/runtime_src/tools/xclbinutil/CMakeLists.txt index 6e2545fd29f..f38da4fc5d0 100644 --- a/src/runtime_src/tools/xclbinutil/CMakeLists.txt +++ b/src/runtime_src/tools/xclbinutil/CMakeLists.txt @@ -222,6 +222,7 @@ endif() if (WIN32 AND NOT DEFINED GTEST_ROOT) set(GTEST_ROOT "C:/Xilinx/XRT/ext") endif() + find_package(GTest) if (GTEST_FOUND AND NOT XRT_SYSTEM_INSTALL) @@ -238,7 +239,7 @@ if (GTEST_FOUND AND NOT XRT_SYSTEM_INSTALL) add_executable(${UNIT_TEST_NAME} ${XCLBINTEST_SRCS}) if(WIN32) - target_link_libraries(${UNIT_TEST_NAME} PRIVATE Boost::program_options Boost::filesystem Boost::system ) + target_link_libraries(${UNIT_TEST_NAME} PRIVATE ${Boost_LIBRARIES}) target_link_libraries(${UNIT_TEST_NAME} PRIVATE ${GTEST_BOTH_LIBRARIES}) else() target_link_libraries(${UNIT_TEST_NAME} PRIVATE ${Boost_LIBRARIES} ${GTEST_BOTH_LIBRARIES} pthread crypto) From aef615d6abf2d49900a44a8f5a1fe72b5aa8f2e4 Mon Sep 17 00:00:00 2001 From: thomthehound Date: Mon, 23 Feb 2026 14:27:57 -0500 Subject: [PATCH 4/7] arm64 support Signed-off-by: thomthehound --- build/build26.bat | 89 ++++++++++++------- src/python/pybind11/CMakeLists.txt | 6 ++ .../tools/scripts/xrtdeps-vcpkg.bat | 29 +++++- 3 files changed, 90 insertions(+), 34 deletions(-) diff --git a/build/build26.bat b/build/build26.bat index 93d172ea536..a9ba47c2e16 100644 --- a/build/build26.bat +++ b/build/build26.bat @@ -10,7 +10,11 @@ set "SCRIPTDIR=%SCRIPTDIR:~0,-1%" set "BUILDDIR=%SCRIPTDIR%" set "DEBUG=1" set "RELEASE=1" -set "EXT_DIR=%BUILDDIR%\ext.vcpkg\vcpkg_installed\x64-windows" +set "RELWITHDEBINFO=0" +set "TARGET_TRIPLET=x64-windows" +set "CMAKE_ARCH=" +set "DIR_SUFFIX=" +set "EXT_DIR=%BUILDDIR%\ext.vcpkg\vcpkg_installed\%TARGET_TRIPLET%" set "EXT_DIR_USER=0" set "CI_EXT_DIR=C:\Xilinx\XRT\ext.new" set "CMAKEFLAGS=" @@ -29,9 +33,11 @@ if "%~1"=="" goto argsParsed if /I "%~1"=="-help" goto help if /I "%~1"=="-ext" goto parseExt if /I "%~1"=="-install" goto parseInstall +if /I "%~1"=="-arm64" goto parseArm64 if /I "%~1"=="-clean" ( set "DO_CLEAN=1" & shift & goto parseArgs ) if /I "%~1"=="-dbg" ( set "RELEASE=0" & shift & goto parseArgs ) if /I "%~1"=="-opt" ( set "DEBUG=0" & shift & goto parseArgs ) +if /I "%~1"=="-rwd" ( set "DEBUG=0" & set "RELEASE=0" & set "RELWITHDEBINFO=1" & shift & goto parseArgs ) if /I "%~1"=="-stage" ( set "STAGE=1" & shift & goto parseArgs ) if /I "%~1"=="-sdk" ( set "CREATE_SDK=1" & set "CMAKEFLAGS=%CMAKEFLAGS% -DXRT_NPU=1" & shift & goto parseArgs ) if /I "%~1"=="-pkg" ( set "CREATE_PACKAGE=1" & shift & goto parseArgs ) @@ -43,6 +49,14 @@ if /I "%~1"=="-nocmake" ( set "NOCMAKE=1" & shift & goto parseArgs ) echo Unknown option: %1 goto help +REM -------------------------------------------------------------------------- +:parseArm64 +set "TARGET_TRIPLET=arm64-windows" +set "CMAKE_ARCH=ARM64" +if "%EXT_DIR_USER%"=="0" set "EXT_DIR=%BUILDDIR%\ext.vcpkg\vcpkg_installed\arm64-windows" +shift +goto parseArgs + REM -------------------------------------------------------------------------- :parseExt shift @@ -74,30 +88,39 @@ REM -------------------------------------------------------------------------- if "%DO_CLEAN%"=="1" goto clean call :pickGenerator -REM Prefer repo-local vcpkg deps when present; otherwise fall back to CI ext.new. -if "%EXT_DIR_USER%"=="0" ( - if not exist "%EXT_DIR%\" ( - if exist "%CI_EXT_DIR%\" set "EXT_DIR=%CI_EXT_DIR%" - ) -) +REM Prefer repo-local vcpkg deps when present; otherwise fall back to ext.new. +if not "%EXT_DIR_USER%"=="0" goto skipExtFallback +if /I not "%TARGET_TRIPLET%"=="x64-windows" goto skipExtFallback +if exist "%EXT_DIR%\" goto skipExtFallback +if exist "%CI_EXT_DIR%\" set "EXT_DIR=%CI_EXT_DIR%" +:skipExtFallback if not exist "%EXT_DIR%\" ( echo ERROR: dependency prefix not found: "%EXT_DIR%" echo Use -ext ^, or run src\runtime_src\tools\scripts\xrtdeps-vcpkg.bat exit /B 2 ) -if "%INSTALL_ROOT%"=="" goto :skipInstallCheck -if not "%DEBUG%"=="1" goto :skipInstallCheck -if not "%RELEASE%"=="1" goto :skipInstallCheck -echo ERROR: -install requires -dbg or -opt (cannot install both configs into one prefix) +if "%INSTALL_ROOT%"=="" goto skipInstallCheck + +set "INSTALL_CFGS=0" +if "%DEBUG%"=="1" set /A INSTALL_CFGS+=1 +if "%RELEASE%"=="1" set /A INSTALL_CFGS+=1 +if "%RELWITHDEBINFO%"=="1" set /A INSTALL_CFGS+=1 +if "%INSTALL_CFGS%"=="1" goto skipInstallCheck +echo ERROR: -install requires exactly one of -dbg, -opt, -rwd (cannot install multiple configs into one prefix) exit /B 2 :skipInstallCheck -if "%DEBUG%"=="1" call :doBuild Debug WDebug +if /I "%CMAKE_ARCH%"=="ARM64" set "DIR_SUFFIX=A64" + +if "%DEBUG%"=="1" call :doBuild Debug WDebug%DIR_SUFFIX% if errorlevel 1 exit /B -if "%RELEASE%"=="1" call :doBuild Release WRelease +if "%RELEASE%"=="1" call :doBuild Release WRelease%DIR_SUFFIX% +if errorlevel 1 exit /B + +if "%RELWITHDEBINFO%"=="1" call :doBuild RelWithDebInfo WRelDeb%DIR_SUFFIX% if errorlevel 1 exit /B goto :EOF @@ -133,16 +156,12 @@ set "LOCAL_CMAKEFLAGS=%CMAKEFLAGS%" if not "%EXT_DIR:vcpkg_installed=%"=="%EXT_DIR%" set "LOCAL_CMAKEFLAGS=%LOCAL_CMAKEFLAGS% -DCMAKE_PREFIX_PATH=%EXT_DIR%" set "PROTOC_EXE=%EXT_DIR%\tools\protobuf\protoc.exe" -if exist "%PROTOC_EXE%" ( - set "LOCAL_CMAKEFLAGS=%LOCAL_CMAKEFLAGS% -DProtobuf_PROTOC_EXECUTABLE=%PROTOC_EXE%" -) else ( - if not "%EXT_DIR:vcpkg_installed=%"=="%EXT_DIR%" ( - echo ERROR: protoc.exe not found: "%PROTOC_EXE%" - exit /B 2 - ) -) +if exist "%PROTOC_EXE%" set "LOCAL_CMAKEFLAGS=%LOCAL_CMAKEFLAGS% -DProtobuf_PROTOC_EXECUTABLE=%PROTOC_EXE%" + +set "CMAKE_PLATFORM_ARG=" +if not "%CMAKE_ARCH%"=="" set "CMAKE_PLATFORM_ARG=-A %CMAKE_ARCH%" -cmake -B "%BUILDDIR%\%DIR%" -G "%GENERATOR%" ^ +cmake -B "%BUILDDIR%\%DIR%" -G "%GENERATOR%" %CMAKE_PLATFORM_ARG% ^ -DMSVC_PARALLEL_JOBS=%LOCAL_MSVC_PARALLEL_JOBS% ^ -DCMAKE_VS_GLOBALS="VcpkgEnabled=false" ^ -DKHRONOS="%EXT_DIR%" ^ @@ -162,18 +181,14 @@ echo Installing %CFG%... cmake --install "%BUILDDIR%\%DIR%" --config %CFG% --prefix "%XRT_INSTALL_PREFIX%" if errorlevel 1 exit /B -if "%STAGE%"=="1" ( - call :stageExt "%CFG%" "%XRT_INSTALL_PREFIX%" - if errorlevel 1 exit /B -) +if "%STAGE%"=="1" call :stageExt "%CFG%" "%XRT_INSTALL_PREFIX%" || exit /B set "DO_ZIP=0" -if /I "%CFG%"=="Release" ( - if "%CREATE_SDK%"=="1" set "DO_ZIP=1" - if "%CREATE_PACKAGE%"=="1" set "DO_ZIP=1" - if "%DO_ZIP%"=="1" call :doCpackZip "%BUILDDIR%\%DIR%" "%CFG%" || exit /B - if "%CREATE_PACKAGE%"=="1" call :doCpackWix "%BUILDDIR%\%DIR%" "%CFG%" || exit /B -) +if "%CREATE_SDK%"=="1" set "DO_ZIP=1" +if "%CREATE_PACKAGE%"=="1" set "DO_ZIP=1" + +if /I "%CFG%"=="Release" if "%DO_ZIP%"=="1" call :doCpackZip "%BUILDDIR%\%DIR%" "%CFG%" || exit /B +if /I "%CFG%"=="Release" if "%CREATE_PACKAGE%"=="1" call :doCpackWix "%BUILDDIR%\%DIR%" "%CFG%" || exit /B exit /B 0 @@ -190,7 +205,9 @@ if not exist "%XRT_EXT_BIN%\" mkdir "%XRT_EXT_BIN%" >NUL 2>NUL copy /Y "%VCPKG_BIN%\boost_filesystem*.dll" "%XRT_EXT_BIN%\" || exit /B copy /Y "%VCPKG_BIN%\boost_program_options*.dll" "%XRT_EXT_BIN%\" || exit /B +if not exist "%VCPKG_BIN%\libprotobuf*.dll" goto skipProtobufCopy copy /Y "%VCPKG_BIN%\libprotobuf*.dll" "%XRT_EXT_BIN%\" || exit /B +:skipProtobufCopy exit /B 0 @@ -225,8 +242,10 @@ echo [-help] - List this help echo [-clean] - Remove build artifact directories echo [-dbg] - Debug build only echo [-opt] - Release build only +echo [-rwd] - RelWithDebInfo build only echo [-ext ^] - Sets EXT_DIR for dependencies (usually a vcpkg prefix) echo [-install [^]] - Install prefix (default: C:\Xilinx\XRT) +echo [-arm64] - Configure/build ARM64 (uses vcpkg triplet arm64-windows) echo [-stage] - Copy a small set of runtime DLLs into ^\ext\bin echo [-sdk] - Build NPU and create a ZIP archive via CPack (Release only) echo [-pkg] - Create ZIP and MSI archives via CPack (Release only) @@ -236,7 +255,7 @@ echo [-hip] - Enable HIP build echo [-nocmake] - Skip re-configure; build/install only echo. echo Note: -echo Default EXT_DIR uses build\ext.vcpkg if present; otherwise uses C:\Xilinx\XRT\ext.new (CI). +echo Default EXT_DIR uses build\ext.vcpkg if present; otherwise uses C:\Xilinx\XRT\ext.new echo To install vcpkg deps into build\ext.vcpkg, run: echo src\runtime_src\tools\scripts\xrtdeps-vcpkg.bat goto :EOF @@ -245,6 +264,10 @@ REM -------------------------------------------------------------------------- :clean if exist "%BUILDDIR%\WDebug" rmdir /S /Q "%BUILDDIR%\WDebug" if exist "%BUILDDIR%\WRelease" rmdir /S /Q "%BUILDDIR%\WRelease" +if exist "%BUILDDIR%\WRelDeb" rmdir /S /Q "%BUILDDIR%\WRelDeb" +if exist "%BUILDDIR%\WDebugA64" rmdir /S /Q "%BUILDDIR%\WDebugA64" +if exist "%BUILDDIR%\WReleaseA64" rmdir /S /Q "%BUILDDIR%\WReleaseA64" +if exist "%BUILDDIR%\WRelDebA64" rmdir /S /Q "%BUILDDIR%\WRelDebA64" echo Build directories cleaned. exit /B 0 diff --git a/src/python/pybind11/CMakeLists.txt b/src/python/pybind11/CMakeLists.txt index 2ea3dea1aa6..d52ac58e2cb 100644 --- a/src/python/pybind11/CMakeLists.txt +++ b/src/python/pybind11/CMakeLists.txt @@ -78,6 +78,11 @@ find_package(Python3 COMPONENTS Development Interpreter) if (Python3_FOUND) message("-- Python libs version: ${Python3_VERSION}") message("-- PYTHON_INCLUDE_PATH ${Python3_INCLUDE_DIRS}") + set(PYTHON_INCLUDE_PATH ${Python3_INCLUDE_DIRS}) + execute_process(COMMAND ${Python3_EXECUTABLE} -c "import sys, pathlib; print((pathlib.Path(sys.base_prefix)/'libs').as_posix())" + OUTPUT_VARIABLE PYTHON_LIBDIR + OUTPUT_STRIP_TRAILING_WHITESPACE + ) set(PYTHONLIBS_VERSION_MAJOR ${Python3_VERSION_MAJOR}) set(PYTHONLIBS_VERSION_MINOR ${Python3_VERSION_MINOR}) endif(Python3_FOUND) @@ -105,6 +110,7 @@ if (pybind11_FOUND) INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) pybind11_add_module(pyxrt src/pyxrt.cpp) target_link_libraries(pyxrt PRIVATE xrt_coreutil uuid) + target_link_directories(pyxrt PRIVATE "${PYTHON_LIBDIR}") set_target_properties(pyxrt PROPERTIES SUFFIX ".pyd") install(TARGETS pyxrt diff --git a/src/runtime_src/tools/scripts/xrtdeps-vcpkg.bat b/src/runtime_src/tools/scripts/xrtdeps-vcpkg.bat index 2f6aa6958fa..e6e48708af7 100644 --- a/src/runtime_src/tools/scripts/xrtdeps-vcpkg.bat +++ b/src/runtime_src/tools/scripts/xrtdeps-vcpkg.bat @@ -9,6 +9,10 @@ set "SCRIPTDIR=%~dp0" set "SCRIPTDIR=%SCRIPTDIR:~0,-1%" set "SRC_ROOT=%SCRIPTDIR%\..\..\..\.." set "EXTRA_PORTS=" +REM Pin vcpkg registry baseline for determinism. +REM Dependency versioning can be done here. +REM Current vcpkg release: 2026.01.16 +SET "VCPKG_BASELINE_SHA=66c0373dc7fca549e5803087b9487edfe3aca0a1" for %%I in ("%SRC_ROOT%") do set "SRC_ROOT=%%~fI" @@ -23,6 +27,7 @@ if /I "%~1"=="-help" goto help if /I "%~1"=="-extroot" goto parseExtRoot if /I "%~1"=="-triplet" goto parseTriplet if /I "%~1"=="-port" goto parsePort +if /I "%~1"=="-baseline" goto parseBaseline if /I "%~1"=="-clean" ( set "DO_CLEAN=1" & shift & goto parseArgs ) echo Unknown option: %1 @@ -67,6 +72,19 @@ set "EXTRA_PORTS=%EXTRA_PORTS% %~1" shift goto parseArgs +REM -------------------------------------------------------------------------- +:parseBaseline +shift + +set "VCPKG_BASELINE_SHA=" +set "BASELINE_ARG=%~1" +if "%BASELINE_ARG%"=="" goto parseArgs +if "%BASELINE_ARG:~0,1%"=="-" goto parseArgs + +set "VCPKG_BASELINE_SHA=%BASELINE_ARG%" +shift +goto parseArgs + REM -------------------------------------------------------------------------- :argsParsed if "%DO_CLEAN%"=="1" goto clean @@ -78,7 +96,15 @@ mkdir "%XRT_EXT_ROOT%" >NUL 2>NUL pushd "%XRT_EXT_ROOT%" || exit /B del /F /Q vcpkg.json vcpkg-configuration.json vcpkg-lock.json >NUL 2>NUL vcpkg new --application || exit /B -vcpkg add port boost-filesystem boost-program-options boost-property-tree boost-format boost-headers boost-interprocess boost-uuid boost-asio boost-process opencl protobuf %EXTRA_PORTS% || exit /B + +if "%VCPKG_BASELINE_SHA%"=="" goto baselineDone + +python -c "import json, pathlib; p=pathlib.Path('vcpkg-configuration.json'); d=json.loads(p.read_text(encoding='utf-8')); dr=d.get('default-registry') or {}; dr['baseline']=r'%VCPKG_BASELINE_SHA%'; d['default-registry']=dr; p.write_text(json.dumps(d, indent=2) + chr(10), encoding='utf-8')" || exit /B + +:baselineDone + +copy /Y "%SRC_ROOT%\src\vcpkg.json" vcpkg.json >NUL || exit /B +if not "%EXTRA_PORTS%"=="" ( vcpkg add port %EXTRA_PORTS% || exit /B ) vcpkg install --triplet %VCPKG_TRIPLET% --clean-after-build || exit /B popd @@ -103,6 +129,7 @@ echo [-help] - List this help echo [-extroot ^] - Root directory for vcpkg deps (default: ^\build\ext.vcpkg) echo [-clean] - Remove the extroot directory (default: ^\build\ext.vcpkg) echo [-triplet ^] - vcpkg triplet (default: x64-windows) +echo [-baseline [^]] - Use vcpkg default baseline (omit ^) or pin to user-specified ^ echo [-port ^] - Extra vcpkg port to install (may be repeated) echo. echo Note: Uses first vcpkg on PATH. From e17078e38a57aca8e01ca919061b1751775bf7f5 Mon Sep 17 00:00:00 2001 From: thomthehound Date: Fri, 27 Feb 2026 14:30:02 -0500 Subject: [PATCH 5/7] reviewer request update Signed-off-by: thomthehound --- build/build26.bat | 79 ++++++++++++++----- .../tools/scripts/xrtdeps-vcpkg.bat | 47 ++++++++--- 2 files changed, 97 insertions(+), 29 deletions(-) diff --git a/build/build26.bat b/build/build26.bat index a9ba47c2e16..1f74151c7a7 100644 --- a/build/build26.bat +++ b/build/build26.bat @@ -11,15 +11,17 @@ set "BUILDDIR=%SCRIPTDIR%" set "DEBUG=1" set "RELEASE=1" set "RELWITHDEBINFO=0" -set "TARGET_TRIPLET=x64-windows" +set "TARGET_TRIPLET=x64-windows-static" set "CMAKE_ARCH=" set "DIR_SUFFIX=" -set "EXT_DIR=%BUILDDIR%\ext.vcpkg\vcpkg_installed\%TARGET_TRIPLET%" +set "EXT_DIR=" +set "EXT_CMAKE_PREFIX=" set "EXT_DIR_USER=0" -set "CI_EXT_DIR=C:\Xilinx\XRT\ext.new" +set "CI_EXT_ROOT=C:\Xilinx\XRT\ext.new" set "CMAKEFLAGS=" set "NOCMAKE=0" set "STAGE=0" +set "DYNAMIC_DEPS=0" set "CREATE_SDK=0" set "CREATE_PACKAGE=0" set "INSTALL_ROOT=" @@ -34,11 +36,11 @@ if /I "%~1"=="-help" goto help if /I "%~1"=="-ext" goto parseExt if /I "%~1"=="-install" goto parseInstall if /I "%~1"=="-arm64" goto parseArm64 +if /I "%~1"=="-dynamic" goto parseDynamic if /I "%~1"=="-clean" ( set "DO_CLEAN=1" & shift & goto parseArgs ) if /I "%~1"=="-dbg" ( set "RELEASE=0" & shift & goto parseArgs ) if /I "%~1"=="-opt" ( set "DEBUG=0" & shift & goto parseArgs ) if /I "%~1"=="-rwd" ( set "DEBUG=0" & set "RELEASE=0" & set "RELWITHDEBINFO=1" & shift & goto parseArgs ) -if /I "%~1"=="-stage" ( set "STAGE=1" & shift & goto parseArgs ) if /I "%~1"=="-sdk" ( set "CREATE_SDK=1" & set "CMAKEFLAGS=%CMAKEFLAGS% -DXRT_NPU=1" & shift & goto parseArgs ) if /I "%~1"=="-pkg" ( set "CREATE_PACKAGE=1" & shift & goto parseArgs ) if /I "%~1"=="-npu" ( set "CMAKEFLAGS=%CMAKEFLAGS% -DXRT_NPU=1" & shift & goto parseArgs ) @@ -51,9 +53,18 @@ goto help REM -------------------------------------------------------------------------- :parseArm64 -set "TARGET_TRIPLET=arm64-windows" set "CMAKE_ARCH=ARM64" -if "%EXT_DIR_USER%"=="0" set "EXT_DIR=%BUILDDIR%\ext.vcpkg\vcpkg_installed\arm64-windows" +if "%DYNAMIC_DEPS%"=="1" set "TARGET_TRIPLET=arm64-windows" +if not "%DYNAMIC_DEPS%"=="1" set "TARGET_TRIPLET=arm64-windows-static" +shift +goto parseArgs + +REM -------------------------------------------------------------------------- +:parseDynamic +set "DYNAMIC_DEPS=1" +set "STAGE=1" +if /I "%CMAKE_ARCH%"=="ARM64" set "TARGET_TRIPLET=arm64-windows" +if /I not "%CMAKE_ARCH%"=="ARM64" set "TARGET_TRIPLET=x64-windows" shift goto parseArgs @@ -68,6 +79,7 @@ if "%~1"=="" ( set "EXT_DIR=%~1" set "EXT_DIR_USER=1" +set "EXT_CMAKE_PREFIX=%EXT_DIR%" shift goto parseArgs @@ -87,20 +99,18 @@ REM -------------------------------------------------------------------------- :argsParsed if "%DO_CLEAN%"=="1" goto clean call :pickGenerator +if "%EXT_DIR_USER%"=="0" call :resolveDefaultExtDir -REM Prefer repo-local vcpkg deps when present; otherwise fall back to ext.new. -if not "%EXT_DIR_USER%"=="0" goto skipExtFallback -if /I not "%TARGET_TRIPLET%"=="x64-windows" goto skipExtFallback -if exist "%EXT_DIR%\" goto skipExtFallback -if exist "%CI_EXT_DIR%\" set "EXT_DIR=%CI_EXT_DIR%" - -:skipExtFallback if not exist "%EXT_DIR%\" ( echo ERROR: dependency prefix not found: "%EXT_DIR%" - echo Use -ext ^, or run src\runtime_src\tools\scripts\xrtdeps-vcpkg.bat + echo Use -ext ^, or run: + echo src\runtime_src\tools\scripts\xrtdeps-vcpkg.bat -triplet %TARGET_TRIPLET% exit /B 2 ) +echo Using dependency prefix: "%EXT_DIR%" +call :echoDetectedBaseline "%EXT_DIR%" + if "%INSTALL_ROOT%"=="" goto skipInstallCheck set "INSTALL_CFGS=0" @@ -125,6 +135,30 @@ if errorlevel 1 exit /B goto :EOF +REM -------------------------------------------------------------------------- +:resolveDefaultExtDir +set "REPO_EXT_DIR=%BUILDDIR%\ext.vcpkg\vcpkg_installed\%TARGET_TRIPLET%" +set "CI_VCPKG_EXT_DIR=%CI_EXT_ROOT%\vcpkg_installed\%TARGET_TRIPLET%" +set "CI_TRIPLET_EXT_DIR=%CI_EXT_ROOT%\%TARGET_TRIPLET%" +set "EXT_DIR=%REPO_EXT_DIR%" +set "EXT_CMAKE_PREFIX=%REPO_EXT_DIR%" +if exist "%REPO_EXT_DIR%\" goto :EOF +if exist "%CI_VCPKG_EXT_DIR%\" set "EXT_DIR=%CI_VCPKG_EXT_DIR%" & set "EXT_CMAKE_PREFIX=%CI_VCPKG_EXT_DIR%" & goto :EOF +if exist "%CI_TRIPLET_EXT_DIR%\" set "EXT_DIR=%CI_TRIPLET_EXT_DIR%" & set "EXT_CMAKE_PREFIX=%CI_TRIPLET_EXT_DIR%" & goto :EOF +if exist "%CI_EXT_ROOT%\" set "EXT_DIR=%CI_EXT_ROOT%" & set "EXT_CMAKE_PREFIX=%CI_EXT_ROOT%" +goto :EOF + +REM -------------------------------------------------------------------------- +:echoDetectedBaseline +set "BASELINE_MARKER=%~1\.vcpkg-baseline" +if not exist "%BASELINE_MARKER%" exit /B 0 +set "DETECTED_BASELINE=" +set /P DETECTED_BASELINE=<"%BASELINE_MARKER%" +if "%DETECTED_BASELINE%"=="" exit /B 0 +if /I "%DETECTED_BASELINE%"=="UNPINNED" echo Using detected vcpkg baseline: UNPINNED +if /I not "%DETECTED_BASELINE%"=="UNPINNED" echo Using detected vcpkg baseline: %DETECTED_BASELINE:~0,7% +exit /B 0 + REM -------------------------------------------------------------------------- :pickGenerator if not "%GENERATOR%"=="" goto :EOF @@ -154,7 +188,7 @@ REM -------------------------------------------------------------------------- echo Configuring %CFG%... set "LOCAL_CMAKEFLAGS=%CMAKEFLAGS%" -if not "%EXT_DIR:vcpkg_installed=%"=="%EXT_DIR%" set "LOCAL_CMAKEFLAGS=%LOCAL_CMAKEFLAGS% -DCMAKE_PREFIX_PATH=%EXT_DIR%" +if not "%EXT_CMAKE_PREFIX%"=="" set "LOCAL_CMAKEFLAGS=%LOCAL_CMAKEFLAGS% -DCMAKE_PREFIX_PATH=%EXT_CMAKE_PREFIX%" set "PROTOC_EXE=%EXT_DIR%\tools\protobuf\protoc.exe" if exist "%PROTOC_EXE%" set "LOCAL_CMAKEFLAGS=%LOCAL_CMAKEFLAGS% -DProtobuf_PROTOC_EXECUTABLE=%PROTOC_EXE%" @@ -245,8 +279,8 @@ echo [-opt] - Release build only echo [-rwd] - RelWithDebInfo build only echo [-ext ^] - Sets EXT_DIR for dependencies (usually a vcpkg prefix) echo [-install [^]] - Install prefix (default: C:\Xilinx\XRT) -echo [-arm64] - Configure/build ARM64 (uses vcpkg triplet arm64-windows) -echo [-stage] - Copy a small set of runtime DLLs into ^\ext\bin +echo [-arm64] - Configure/build ARM64 (uses vcpkg triplet arm64-windows-static by default) +echo [-dynamic] - Use dynamic vcpkg triplets and copy runtime DLLs into ^\ext\bin echo [-sdk] - Build NPU and create a ZIP archive via CPack (Release only) echo [-pkg] - Create ZIP and MSI archives via CPack (Release only) echo [-npu] - Build NPU component of XRT @@ -255,9 +289,14 @@ echo [-hip] - Enable HIP build echo [-nocmake] - Skip re-configure; build/install only echo. echo Note: -echo Default EXT_DIR uses build\ext.vcpkg if present; otherwise uses C:\Xilinx\XRT\ext.new -echo To install vcpkg deps into build\ext.vcpkg, run: -echo src\runtime_src\tools\scripts\xrtdeps-vcpkg.bat +echo Default EXT_DIR prefers: build\ext.vcpkg\vcpkg_installed\^ +echo Then tries: C:\Xilinx\XRT\ext.new\vcpkg_installed\^ +echo Then tries: C:\Xilinx\XRT\ext.new\^, +echo Then tries: C:\Xilinx\XRT\ext.new +echo +echo To install dependencies into build\ext.vcpkg, run: +echo src\runtime_src\tools\scripts\xrtdeps-vcpkg.bat [-triplet ^] +echo (Default: x64-windows-static.) goto :EOF REM -------------------------------------------------------------------------- diff --git a/src/runtime_src/tools/scripts/xrtdeps-vcpkg.bat b/src/runtime_src/tools/scripts/xrtdeps-vcpkg.bat index e6e48708af7..a1d081b1fae 100644 --- a/src/runtime_src/tools/scripts/xrtdeps-vcpkg.bat +++ b/src/runtime_src/tools/scripts/xrtdeps-vcpkg.bat @@ -9,6 +9,7 @@ set "SCRIPTDIR=%~dp0" set "SCRIPTDIR=%SCRIPTDIR:~0,-1%" set "SRC_ROOT=%SCRIPTDIR%\..\..\..\.." set "EXTRA_PORTS=" +set "CREATE_PACKAGE=0" REM Pin vcpkg registry baseline for determinism. REM Dependency versioning can be done here. REM Current vcpkg release: 2026.01.16 @@ -17,18 +18,19 @@ SET "VCPKG_BASELINE_SHA=66c0373dc7fca549e5803087b9487edfe3aca0a1" for %%I in ("%SRC_ROOT%") do set "SRC_ROOT=%%~fI" if "%XRT_EXT_ROOT%"=="" set "XRT_EXT_ROOT=%SRC_ROOT%\build\ext.vcpkg" -if "%VCPKG_TRIPLET%"=="" set "VCPKG_TRIPLET=x64-windows" +if "%VCPKG_TRIPLET%"=="" set "VCPKG_TRIPLET=x64-windows-static" REM -------------------------------------------------------------------------- :parseArgs if "%~1"=="" goto argsParsed -if /I "%~1"=="-help" goto help -if /I "%~1"=="-extroot" goto parseExtRoot -if /I "%~1"=="-triplet" goto parseTriplet -if /I "%~1"=="-port" goto parsePort +if /I "%~1"=="-help" goto help +if /I "%~1"=="-extroot" goto parseExtRoot +if /I "%~1"=="-triplet" goto parseTriplet +if /I "%~1"=="-port" goto parsePort if /I "%~1"=="-baseline" goto parseBaseline -if /I "%~1"=="-clean" ( set "DO_CLEAN=1" & shift & goto parseArgs ) +if /I "%~1"=="-pkg" ( set "CREATE_PACKAGE=1" & shift & goto parseArgs ) +if /I "%~1"=="-clean" ( set "DO_CLEAN=1" & shift & goto parseArgs ) echo Unknown option: %1 goto help @@ -90,6 +92,9 @@ REM -------------------------------------------------------------------------- if "%DO_CLEAN%"=="1" goto clean set "EXT_DIR=%XRT_EXT_ROOT%\vcpkg_installed\%VCPKG_TRIPLET%" +set "PKG_OUT_DIR=%SRC_ROOT%\build\pkg" +set "PKG_BASELINE_ID=unpinned" +if not "%VCPKG_BASELINE_SHA%"=="" set "PKG_BASELINE_ID=%VCPKG_BASELINE_SHA:~0,7%" mkdir "%XRT_EXT_ROOT%" >NUL 2>NUL @@ -106,17 +111,25 @@ python -c "import json, pathlib; p=pathlib.Path('vcpkg-configuration.json'); d=j copy /Y "%SRC_ROOT%\src\vcpkg.json" vcpkg.json >NUL || exit /B if not "%EXTRA_PORTS%"=="" ( vcpkg add port %EXTRA_PORTS% || exit /B ) vcpkg install --triplet %VCPKG_TRIPLET% --clean-after-build || exit /B +call :writeBaselineMarker || exit /B popd REM Needed for pyxrt. python -m pip install pybind11 || exit /B +if "%CREATE_PACKAGE%"=="1" call :packageDeps || exit /B + echo. echo Dependency prefix ready: echo EXT_DIR=%EXT_DIR% +if "%CREATE_PACKAGE%"=="1" echo PACKAGE=%PKG_OUT_DIR%\ext.vcpkg.%PKG_BASELINE_ID%.%VCPKG_TRIPLET%.zip echo. +set "BUILD_ARCH_ARG=" +if /I "%VCPKG_TRIPLET:~0,6%"=="arm64-" set "BUILD_ARCH_ARG= -arm64" +set "BUILD_DYNAMIC_ARG=" +if "%VCPKG_TRIPLET:-static=%"=="%VCPKG_TRIPLET%" set "BUILD_DYNAMIC_ARG= -dynamic" echo Build example: -echo build\build26.bat -ext "%EXT_DIR%" -opt -npu -install -stage +echo build\build26.bat -ext "%EXT_DIR%"%BUILD_ARCH_ARG%%BUILD_DYNAMIC_ARG% -opt -npu -install exit /B 0 @@ -128,14 +141,30 @@ echo. echo [-help] - List this help echo [-extroot ^] - Root directory for vcpkg deps (default: ^\build\ext.vcpkg) echo [-clean] - Remove the extroot directory (default: ^\build\ext.vcpkg) -echo [-triplet ^] - vcpkg triplet (default: x64-windows) -echo [-baseline [^]] - Use vcpkg default baseline (omit ^) or pin to user-specified ^ +echo [-triplet ^] - vcpkg triplet (default: x64-windows-static) +echo [-baseline [^]] - Use vcpkg default baseline (omit ^) or pin to user-specified ^ echo [-port ^] - Extra vcpkg port to install (may be repeated) +echo [-pkg] - Create build\pkg\ext.vcpkg.^.^.zip for publishing echo. echo Note: Uses first vcpkg on PATH. exit /B 2 +REM -------------------------------------------------------------------------- +:writeBaselineMarker +set "BASELINE_MARKER=%EXT_DIR%\.vcpkg-baseline" +set "BASELINE_MARKER_VALUE=%VCPKG_BASELINE_SHA%" +if "%BASELINE_MARKER_VALUE%"=="" set "BASELINE_MARKER_VALUE=UNPINNED" +> "%BASELINE_MARKER%" Date: Fri, 6 Mar 2026 18:21:22 -0500 Subject: [PATCH 6/7] Forward-slash ext.new path in build/build26.bat Co-authored-by: Soren Soe <2106410+stsoe@users.noreply.github.com> --- build/build26.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/build26.bat b/build/build26.bat index 1f74151c7a7..0fb8237c1d6 100644 --- a/build/build26.bat +++ b/build/build26.bat @@ -17,7 +17,7 @@ set "DIR_SUFFIX=" set "EXT_DIR=" set "EXT_CMAKE_PREFIX=" set "EXT_DIR_USER=0" -set "CI_EXT_ROOT=C:\Xilinx\XRT\ext.new" +set "CI_EXT_ROOT=C:/Xilinx/XRT/ext.new" set "CMAKEFLAGS=" set "NOCMAKE=0" set "STAGE=0" From 79ba3dae306e0eb81f6c07ce4bddf90c1a9dc773 Mon Sep 17 00:00:00 2001 From: thomthehound Date: Thu, 12 Mar 2026 18:48:52 -0400 Subject: [PATCH 7/7] review update No2 Signed-off-by: thomthehound --- build/build26.bat | 33 +++++------ .../tools/scripts/xrtdeps-vcpkg.bat | 56 ++++++++++++++----- 2 files changed, 55 insertions(+), 34 deletions(-) diff --git a/build/build26.bat b/build/build26.bat index 0fb8237c1d6..12f7a13a5fd 100644 --- a/build/build26.bat +++ b/build/build26.bat @@ -103,8 +103,7 @@ if "%EXT_DIR_USER%"=="0" call :resolveDefaultExtDir if not exist "%EXT_DIR%\" ( echo ERROR: dependency prefix not found: "%EXT_DIR%" - echo Use -ext ^, or run: - echo src\runtime_src\tools\scripts\xrtdeps-vcpkg.bat -triplet %TARGET_TRIPLET% + echo Use -ext ^, or populate the default dependency area. exit /B 2 ) @@ -137,13 +136,11 @@ goto :EOF REM -------------------------------------------------------------------------- :resolveDefaultExtDir -set "REPO_EXT_DIR=%BUILDDIR%\ext.vcpkg\vcpkg_installed\%TARGET_TRIPLET%" set "CI_VCPKG_EXT_DIR=%CI_EXT_ROOT%\vcpkg_installed\%TARGET_TRIPLET%" set "CI_TRIPLET_EXT_DIR=%CI_EXT_ROOT%\%TARGET_TRIPLET%" -set "EXT_DIR=%REPO_EXT_DIR%" -set "EXT_CMAKE_PREFIX=%REPO_EXT_DIR%" -if exist "%REPO_EXT_DIR%\" goto :EOF -if exist "%CI_VCPKG_EXT_DIR%\" set "EXT_DIR=%CI_VCPKG_EXT_DIR%" & set "EXT_CMAKE_PREFIX=%CI_VCPKG_EXT_DIR%" & goto :EOF +set "EXT_DIR=%CI_VCPKG_EXT_DIR%" +set "EXT_CMAKE_PREFIX=%CI_VCPKG_EXT_DIR%" +if exist "%CI_VCPKG_EXT_DIR%\" goto :EOF if exist "%CI_TRIPLET_EXT_DIR%\" set "EXT_DIR=%CI_TRIPLET_EXT_DIR%" & set "EXT_CMAKE_PREFIX=%CI_TRIPLET_EXT_DIR%" & goto :EOF if exist "%CI_EXT_ROOT%\" set "EXT_DIR=%CI_EXT_ROOT%" & set "EXT_CMAKE_PREFIX=%CI_EXT_ROOT%" goto :EOF @@ -239,6 +236,7 @@ if not exist "%XRT_EXT_BIN%\" mkdir "%XRT_EXT_BIN%" >NUL 2>NUL copy /Y "%VCPKG_BIN%\boost_filesystem*.dll" "%XRT_EXT_BIN%\" || exit /B copy /Y "%VCPKG_BIN%\boost_program_options*.dll" "%XRT_EXT_BIN%\" || exit /B +copy /Y "%VCPKG_BIN%\OpenCL.dll" "%XRT_EXT_BIN%\" || exit /B if not exist "%VCPKG_BIN%\libprotobuf*.dll" goto skipProtobufCopy copy /Y "%VCPKG_BIN%\libprotobuf*.dll" "%XRT_EXT_BIN%\" || exit /B :skipProtobufCopy @@ -289,24 +287,19 @@ echo [-hip] - Enable HIP build echo [-nocmake] - Skip re-configure; build/install only echo. echo Note: -echo Default EXT_DIR prefers: build\ext.vcpkg\vcpkg_installed\^ -echo Then tries: C:\Xilinx\XRT\ext.new\vcpkg_installed\^ -echo Then tries: C:\Xilinx\XRT\ext.new\^, +echo Default EXT_DIR tries: C:\Xilinx\XRT\ext.new\vcpkg_installed\^ +echo Then tries: C:\Xilinx\XRT\ext.new\^ echo Then tries: C:\Xilinx\XRT\ext.new -echo -echo To install dependencies into build\ext.vcpkg, run: -echo src\runtime_src\tools\scripts\xrtdeps-vcpkg.bat [-triplet ^] -echo (Default: x64-windows-static.) goto :EOF REM -------------------------------------------------------------------------- :clean -if exist "%BUILDDIR%\WDebug" rmdir /S /Q "%BUILDDIR%\WDebug" -if exist "%BUILDDIR%\WRelease" rmdir /S /Q "%BUILDDIR%\WRelease" -if exist "%BUILDDIR%\WRelDeb" rmdir /S /Q "%BUILDDIR%\WRelDeb" -if exist "%BUILDDIR%\WDebugA64" rmdir /S /Q "%BUILDDIR%\WDebugA64" +if exist "%BUILDDIR%\WDebug" rmdir /S /Q "%BUILDDIR%\WDebug" +if exist "%BUILDDIR%\WRelease" rmdir /S /Q "%BUILDDIR%\WRelease" +if exist "%BUILDDIR%\WRelDeb" rmdir /S /Q "%BUILDDIR%\WRelDeb" +if exist "%BUILDDIR%\WDebugA64" rmdir /S /Q "%BUILDDIR%\WDebugA64" if exist "%BUILDDIR%\WReleaseA64" rmdir /S /Q "%BUILDDIR%\WReleaseA64" -if exist "%BUILDDIR%\WRelDebA64" rmdir /S /Q "%BUILDDIR%\WRelDebA64" +if exist "%BUILDDIR%\WRelDebA64" rmdir /S /Q "%BUILDDIR%\WRelDebA64" echo Build directories cleaned. -exit /B 0 +exit /B 0 \ No newline at end of file diff --git a/src/runtime_src/tools/scripts/xrtdeps-vcpkg.bat b/src/runtime_src/tools/scripts/xrtdeps-vcpkg.bat index a1d081b1fae..881ac3cafe6 100644 --- a/src/runtime_src/tools/scripts/xrtdeps-vcpkg.bat +++ b/src/runtime_src/tools/scripts/xrtdeps-vcpkg.bat @@ -13,7 +13,7 @@ set "CREATE_PACKAGE=0" REM Pin vcpkg registry baseline for determinism. REM Dependency versioning can be done here. REM Current vcpkg release: 2026.01.16 -SET "VCPKG_BASELINE_SHA=66c0373dc7fca549e5803087b9487edfe3aca0a1" +set "VCPKG_BASELINE_SHA=66c0373dc7fca549e5803087b9487edfe3aca0a1" for %%I in ("%SRC_ROOT%") do set "SRC_ROOT=%%~fI" @@ -70,6 +70,12 @@ if "%~1"=="" ( exit /B 2 ) +if /I "%~1"=="opencl" ( + echo NOTE: opencl is handled separately and does not need -port opencl + shift + goto parseArgs +) + set "EXTRA_PORTS=%EXTRA_PORTS% %~1" shift goto parseArgs @@ -91,28 +97,31 @@ REM -------------------------------------------------------------------------- :argsParsed if "%DO_CLEAN%"=="1" goto clean +set "OPENCL_TRIPLET=%VCPKG_TRIPLET:-static=%" set "EXT_DIR=%XRT_EXT_ROOT%\vcpkg_installed\%VCPKG_TRIPLET%" +set "OPENCL_EXT_ROOT=%XRT_EXT_ROOT%\.opencl.dynamic" +set "OPENCL_EXT_DIR=%OPENCL_EXT_ROOT%\vcpkg_installed\%OPENCL_TRIPLET%" set "PKG_OUT_DIR=%SRC_ROOT%\build\pkg" set "PKG_BASELINE_ID=unpinned" if not "%VCPKG_BASELINE_SHA%"=="" set "PKG_BASELINE_ID=%VCPKG_BASELINE_SHA:~0,7%" -mkdir "%XRT_EXT_ROOT%" >NUL 2>NUL +call :prepareManifestRoot "%XRT_EXT_ROOT%" || exit /B +copy /Y "%SRC_ROOT%\src\vcpkg.json" "%XRT_EXT_ROOT%\vcpkg.json" >NUL || exit /B +python -c "import json, os, pathlib; p=pathlib.Path(os.environ['XRT_EXT_ROOT'])/'vcpkg.json'; d=json.loads(p.read_text(encoding='utf-8')); d['dependencies']=[dep for dep in d.get('dependencies', []) if dep != 'opencl']; p.write_text(json.dumps(d, indent=2) + chr(10), encoding='utf-8')" || exit /B pushd "%XRT_EXT_ROOT%" || exit /B -del /F /Q vcpkg.json vcpkg-configuration.json vcpkg-lock.json >NUL 2>NUL -vcpkg new --application || exit /B - -if "%VCPKG_BASELINE_SHA%"=="" goto baselineDone - -python -c "import json, pathlib; p=pathlib.Path('vcpkg-configuration.json'); d=json.loads(p.read_text(encoding='utf-8')); dr=d.get('default-registry') or {}; dr['baseline']=r'%VCPKG_BASELINE_SHA%'; d['default-registry']=dr; p.write_text(json.dumps(d, indent=2) + chr(10), encoding='utf-8')" || exit /B +if not "%EXTRA_PORTS%"=="" vcpkg add port %EXTRA_PORTS% || exit /B +vcpkg install --triplet %VCPKG_TRIPLET% --clean-after-build || exit /B +popd -:baselineDone +call :prepareManifestRoot "%OPENCL_EXT_ROOT%" || exit /B +pushd "%OPENCL_EXT_ROOT%" || exit /B +vcpkg add port opencl || exit /B +vcpkg install --triplet %OPENCL_TRIPLET% --clean-after-build || exit /B +popd -copy /Y "%SRC_ROOT%\src\vcpkg.json" vcpkg.json >NUL || exit /B -if not "%EXTRA_PORTS%"=="" ( vcpkg add port %EXTRA_PORTS% || exit /B ) -vcpkg install --triplet %VCPKG_TRIPLET% --clean-after-build || exit /B +call :copyOpenCLIntoPrefix || exit /B call :writeBaselineMarker || exit /B -popd REM Needed for pyxrt. python -m pip install pybind11 || exit /B @@ -147,9 +156,28 @@ echo [-port ^] - Extra vcpkg port to install (may be repeated) echo [-pkg] - Create build\pkg\ext.vcpkg.^.^.zip for publishing echo. echo Note: Uses first vcpkg on PATH. +echo OpenCL is always installed separately as a dynamic dependency and copied into the main prefix. exit /B 2 +REM -------------------------------------------------------------------------- +:prepareManifestRoot +set "MANIFEST_ROOT=%~1" +mkdir "%MANIFEST_ROOT%" >NUL 2>NUL +pushd "%MANIFEST_ROOT%" || exit /B +del /F /Q vcpkg.json vcpkg-configuration.json vcpkg-lock.json >NUL 2>NUL +vcpkg new --application || exit /B +if "%VCPKG_BASELINE_SHA%"=="" goto prepareManifestRootDone +python -c "import json, pathlib; p=pathlib.Path('vcpkg-configuration.json'); d=json.loads(p.read_text(encoding='utf-8')); dr=d.get('default-registry') or {}; dr['baseline']=r'%VCPKG_BASELINE_SHA%'; d['default-registry']=dr; p.write_text(json.dumps(d, indent=2) + chr(10), encoding='utf-8')" || exit /B +:prepareManifestRootDone +popd +exit /B 0 + +REM -------------------------------------------------------------------------- +:copyOpenCLIntoPrefix +python -c "import os, pathlib, shutil; src=pathlib.Path(os.environ['OPENCL_EXT_DIR']); dst=pathlib.Path(os.environ['EXT_DIR']); (dst/'bin').mkdir(parents=True, exist_ok=True); (dst/'lib').mkdir(parents=True, exist_ok=True); (dst/'include').mkdir(parents=True, exist_ok=True); shutil.copy2(src/'bin'/'OpenCL.dll', dst/'bin'/'OpenCL.dll'); shutil.copy2(src/'lib'/'OpenCL.lib', dst/'lib'/'OpenCL.lib'); shutil.copytree(src/'include'/'CL', dst/'include'/'CL', dirs_exist_ok=True)" || exit /B +exit /B 0 + REM -------------------------------------------------------------------------- :writeBaselineMarker set "BASELINE_MARKER=%EXT_DIR%\.vcpkg-baseline" @@ -173,4 +201,4 @@ if not exist "%XRT_EXT_ROOT%\vcpkg.json" ( ) rmdir /S /Q "%XRT_EXT_ROOT%" || exit /B 2 -exit /B 0 +exit /B 0 \ No newline at end of file