Skip to content
Open
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
6 changes: 6 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ build:v2 --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1

build:windows --host_cxxopt=/std:c++17
build:windows --cxxopt=/std:c++17
# MSVC 14.51+ (VS 2026) raises C5285 ("specializing std::is_signed is forbidden")
# on TensorFlow/XLA's quantized-type specializations (xla/tsl/framework/type_traits.h).
# It is benign and upstream (XLA) compiles with /WX, so suppress it to allow building
# with newer toolsets / Visual Studio 2026.
build:windows --copt=/wd5285
build:windows --host_copt=/wd5285
# TODO Windows: may impact python nodes execution
build:windows --noenable_bzlmod

Expand Down
14 changes: 11 additions & 3 deletions windows_build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,17 @@ for /f "usebackq eol=# tokens=1,3" %%A in ("%cd%\versions.mk") do (
)

:: Bazel compilation settings
set VS_2022_BT="C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools"
:: Auto-detect Visual Studio (BuildTools/Community/Pro/Enterprise; VS2019/2022/2026+) via vswhere.
set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
if not exist "%VSWHERE%" goto :msvc_error
set "VS_DETECTED="
for /f "usebackq tokens=*" %%i in (`"%VSWHERE%" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do set "VS_DETECTED=%%i"
if not defined VS_DETECTED goto :msvc_error
set VS_2022_BT="%VS_DETECTED%"
IF /I EXIST %VS_2022_BT% goto :msvc_bt ELSE goto :msvc_error

:msvc_error
echo [ERROR] Required MSVC compiler not installed
echo [ERROR] Required MSVC compiler not installed (need Visual Studio 2019/2022/2026 with the C++ x64 toolset)
goto :exit_build_error
:msvc_bt
echo [INFO] Using MSVC %VS_2022_BT%
Expand All @@ -90,7 +96,9 @@ set BAZEL_VS=%VS_2022_BT%
:: Bazel compilation settings end
:msvc_end
set "BAZEL_VC=%BAZEL_VS:"=%\VC"
set "BAZEL_VC_FULL_VERSION=14.44.35207"
:: Auto-detect the latest installed MSVC toolset version (was hardcoded 14.44.35207)
set "BAZEL_VC_FULL_VERSION="
for /f "delims=" %%v in ('dir /b /ad /o-n "%BAZEL_VC%\Tools\MSVC" 2^>nul') do if not defined BAZEL_VC_FULL_VERSION set "BAZEL_VC_FULL_VERSION=%%v"

:: Set proper PATH environment variable: Remove other python paths and add c:\opt with bazel to PATH
set "PATH=%setPath%"
Expand Down
29 changes: 22 additions & 7 deletions windows_install_build_dependencies.bat
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,35 @@ set "BAZEL_SHORT_PATH=C:\%output_user_root%"
set "opt_install_dir=C:\opt"

:: Python 312 needs to be first in the windows path, as well as MSYS tools
set "setPath=C:\opt;C:\opt\Python312\;C:\opt\Python312\Scripts\;C:\opt\msys64\usr\bin\;c:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\;%PATH%;"
set "setPath=C:\opt;C:\opt\Python312\;C:\opt\Python312\Scripts\;C:\opt\msys64\usr\bin\;%PATH%;"
set "PYTHONHOME=C:\opt\Python312"
:: Set proper PATH environment variable: Remove other python paths and add c:\opt with bazel, wget to PATH
set "PATH=%setPath%"

:: Bazel compilation settings
set VS_2022_BT="C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools"
:: Auto-detect Visual Studio (BuildTools/Community/Pro/Enterprise; VS2019/2022/2026+)
:: via vswhere, instead of hardcoding a single edition/path.
set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
if not exist "%VSWHERE%" goto :msvc_error
set "VS_DETECTED="
for /f "usebackq tokens=*" %%i in (`"%VSWHERE%" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do set "VS_DETECTED=%%i"
if not defined VS_DETECTED goto :msvc_error
set VS_2022_BT="%VS_DETECTED%"
:: Major version (17, 18, ...) -> CMake generator string "Visual Studio <major> <year>"
for /f "usebackq tokens=1 delims=." %%m in (`"%VSWHERE%" -latest -products * -property installationVersion`) do set "VS_MAJOR=%%m"
set "VS_YEAR="
if "%VS_MAJOR%"=="16" set "VS_YEAR=2019"
if "%VS_MAJOR%"=="17" set "VS_YEAR=2022"
if "%VS_MAJOR%"=="18" set "VS_YEAR=2026"
if not defined VS_YEAR ( echo [ERROR] Unsupported Visual Studio major version %VS_MAJOR% - add it to the VS_YEAR map & goto :msvc_error )
set "CMAKE_GEN=Visual Studio %VS_MAJOR% %VS_YEAR%"
IF /I EXIST %VS_2022_BT% goto :msvc_bt ELSE goto :msvc_error

:msvc_error
echo [ERROR] Required MSVC compiler not installed
echo [ERROR] Required MSVC compiler not installed (need Visual Studio 2019/2022/2026 with the C++ x64 toolset)
goto :exit_build_error
:msvc_bt
echo [INFO] Using MSVC %VS_2022_BT%
echo [INFO] Using MSVC %VS_2022_BT% (generator: %CMAKE_GEN%)
set BAZEL_VS=%VS_2022_BT%

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Expand Down Expand Up @@ -225,7 +240,7 @@ IF /I EXIST %BAZEL_SHORT_PATH%\%genai_dir% (
IF /I EXIST %BAZEL_SHORT_PATH%\openvino (
rmdir /S /Q %BAZEL_SHORT_PATH%\openvino
)
mklink /d %BAZEL_SHORT_PATH%\openvino %BAZEL_SHORT_PATH%\%genai_dir%
mklink /j %BAZEL_SHORT_PATH%\openvino %BAZEL_SHORT_PATH%\%genai_dir%
if !errorlevel! neq 0 exit /b !errorlevel!

echo [INFO] GenAI installed: %BAZEL_SHORT_PATH%\%genai_dir%
Expand Down Expand Up @@ -264,7 +279,7 @@ IF /I NOT EXIST build (
)
cd build
set "TBB_DIR="
cmake -G "Visual Studio 17 2022" -DENABLE_SAMPLES=OFF -DENABLE_INTEL_NPU_PROTOPIPE=OFF ..
cmake -G "%CMAKE_GEN%" -DENABLE_SAMPLES=OFF -DENABLE_INTEL_NPU_PROTOPIPE=OFF ..
if !errorlevel! neq 0 exit /b !errorlevel!
cmake --build . --config Release --verbose -j
if !errorlevel! neq 0 exit /b !errorlevel!
Expand Down Expand Up @@ -621,7 +636,7 @@ if "%ENABLE_INTEGRITYCHECK%"=="1" (
)

:: Expected compilers in CI - -G "Visual Studio 16 2019", local -G "Visual Studio 17 2022" as default
cmake -T v142 .. -D CMAKE_INSTALL_PREFIX=%opencv_install% -D OPENCV_EXTRA_MODULES_PATH=%opencv_contrib_dir%\modules %opencv_flags% %SDL_OPS%
cmake .. -D CMAKE_INSTALL_PREFIX=%opencv_install% -D OPENCV_EXTRA_MODULES_PATH=%opencv_contrib_dir%\modules -D PYTHON3_EXECUTABLE=C:\opt\Python312\python.exe -D BUILD_opencv_python3=OFF -D BUILD_opencv_python2=OFF -D BUILD_opencv_python_bindings_generator=OFF %opencv_flags% %SDL_OPS%
if !errorlevel! neq 0 exit /b !errorlevel!
cmake --build . --config Release -j %NUMBER_OF_PROCESSORS%
if !errorlevel! neq 0 exit /b !errorlevel!
Expand Down
14 changes: 11 additions & 3 deletions windows_setupvars.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,27 @@ set "setPythonPath=%cd%\bazel-out\x64_windows-opt\bin\src\python\binding"
set "BAZEL_SH=C:\opt\msys64\usr\bin\bash.exe"

:: Bazel compilation settings
set VS_2022_BT="C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools"
:: Auto-detect Visual Studio (BuildTools/Community/Pro/Enterprise; VS2019/2022/2026+) via vswhere.
set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
if not exist "%VSWHERE%" goto :msvc_error
set "VS_DETECTED="
for /f "usebackq tokens=*" %%i in (`"%VSWHERE%" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do set "VS_DETECTED=%%i"
if not defined VS_DETECTED goto :msvc_error
set VS_2022_BT="%VS_DETECTED%"
IF /I EXIST %VS_2022_BT% goto :msvc_bt ELSE goto :msvc_error

:msvc_error
echo [ERROR] Required MSVC compiler not installed
echo [ERROR] Required MSVC compiler not installed (need Visual Studio 2019/2022/2026 with the C++ x64 toolset)
goto :exit_build_error
:msvc_bt
echo [INFO] Using MSVC %VS_2022_BT%
set BAZEL_VS=%VS_2022_BT%

:: Bazel compilation settings end
set "BAZEL_VC=%BAZEL_VS:"=%\VC"
set "BAZEL_VC_FULL_VERSION=14.44.35207"
:: Auto-detect the latest installed MSVC toolset version (was hardcoded 14.44.35207)
set "BAZEL_VC_FULL_VERSION="
for /f "delims=" %%v in ('dir /b /ad /o-n "%BAZEL_VC%\Tools\MSVC" 2^>nul') do if not defined BAZEL_VC_FULL_VERSION set "BAZEL_VC_FULL_VERSION=%%v"

:: Set proper PATH environment variable: Remove other python paths and add c:\opt with bazel to PATH
set "PATH=%setPath%"
Expand Down
16 changes: 12 additions & 4 deletions windows_test.bat
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,31 @@ for /f "usebackq eol=# tokens=1,3" %%A in ("%cd%\versions.mk") do (

:: Setting PATH environment variable based on default windows node settings: Added ovms_windows specific python settings and c:/opt and removed unused Nvidia and OCL specific tools.
:: When changing the values here you can print the node default PATH value and base your changes on it.
set "setPath=C:\opt;C:\opt\Python312\;C:\opt\Python312\Scripts\;C:\opt\msys64\usr\bin\;C:\opt\curl-!curl_version!-win64-mingw\bin;c:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\;%PATH%;"
set "setPath=C:\opt;C:\opt\Python312\;C:\opt\Python312\Scripts\;C:\opt\msys64\usr\bin\;C:\opt\curl-!curl_version!-win64-mingw\bin;%PATH%;"
set "setPythonPath=%cd%\bazel-out\x64_windows-opt\bin\src\python\binding"
set "BAZEL_SH=C:\opt\msys64\usr\bin\bash.exe"

:: Bazel compilation settings
set VS_2022_BT="C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools"
:: Auto-detect Visual Studio (BuildTools/Community/Pro/Enterprise; VS2019/2022/2026+) via vswhere.
set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
if not exist "%VSWHERE%" goto :msvc_error
set "VS_DETECTED="
for /f "usebackq tokens=*" %%i in (`"%VSWHERE%" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do set "VS_DETECTED=%%i"
if not defined VS_DETECTED goto :msvc_error
set VS_2022_BT="%VS_DETECTED%"
IF /I EXIST %VS_2022_BT% goto :msvc_bt ELSE goto :msvc_error
:msvc_error
echo [ERROR] Required MSVC compiler not installed
echo [ERROR] Required MSVC compiler not installed (need Visual Studio 2019/2022/2026 with the C++ x64 toolset)
goto :exit_build_error
:msvc_bt
echo [INFO] Using MSVC %VS_2022_BT%
set BAZEL_VS=%VS_2022_BT%

:: Bazel compilation settings end
set "BAZEL_VC=%BAZEL_VS:"=%\VC"
set "BAZEL_VC_FULL_VERSION=14.44.35207"
:: Auto-detect the latest installed MSVC toolset version (was hardcoded 14.44.35207)
set "BAZEL_VC_FULL_VERSION="
for /f "delims=" %%v in ('dir /b /ad /o-n "%BAZEL_VC%\Tools\MSVC" 2^>nul') do if not defined BAZEL_VC_FULL_VERSION set "BAZEL_VC_FULL_VERSION=%%v"

:: Set proper PATH environment variable: Remove other python paths and add c:\opt with bazel to PATH
set "PATH=%setPath%"
Expand Down