Add USE_SYSTEM_ZSTD option to use pre-installed zstd (#7531) #10986
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # FIXME: | |
| # - librealsense upgrade needed to build with MSVC 17 | |
| # - MSVC 17 and CUDA 12.4+ error while building CreateCUDAHashBackend.cu (Debug only) | |
| # - PyTorch Ops in debug mode - DLL initialization error while loading open3d_torch_ops.dll | |
| # - CUDA - Draw.exe does not run due to CUDA DLL path issues | |
| name: Windows | |
| permissions: {} | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| developer_build: | |
| description: "Set to OFF for Release wheels" | |
| required: false | |
| default: "ON" | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: [opened, reopened, synchronize] # Rebuild on new pushes to PR | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| PIP_VER: "24.3.1" | |
| CUDA_VERSION: "12.6.3" | |
| SRC_DIR: "D:\\a\\open3d\\open3d" | |
| BUILD_DIR: "C:\\Open3D\\build" | |
| INSTALL_DIR: "C:\\Program Files\\Open3D" | |
| NPROC: 6 | |
| DEVELOPER_BUILD: ${{ github.event.inputs.developer_build || 'ON' }} | |
| jobs: | |
| build-lib: | |
| name: Build lib | |
| permissions: | |
| contents: write # upload | |
| id-token: write | |
| attestations: write | |
| artifact-metadata: write | |
| runs-on: windows-2022 | |
| strategy: | |
| fail-fast: false | |
| # Eight matrix legs (S=BUILD_SHARED_LIBS, R=STATIC_RUNTIME) plus build-wheel/test-wheel. | |
| # Covers cpu/cuda/xpu once where needed; devel zips, viewer, SYCL, and /MD static smoke. | |
| matrix: | |
| include: | |
| # OFF/ON: static lib + /MT -> for viewer | |
| - BUILD_SHARED_LIBS: OFF | |
| STATIC_RUNTIME: ON | |
| device: cpu | |
| CONFIG: Release | |
| # Shared Windows CUDA Release | |
| - BUILD_SHARED_LIBS: ON | |
| STATIC_RUNTIME: OFF | |
| device: cuda | |
| CONFIG: Release | |
| # Shared Windows CPU Release | |
| - BUILD_SHARED_LIBS: ON | |
| STATIC_RUNTIME: OFF | |
| device: cpu | |
| CONFIG: Release | |
| # Shared Windows SYCL/XPU Release | |
| - BUILD_SHARED_LIBS: ON | |
| STATIC_RUNTIME: OFF | |
| device: xpu | |
| CONFIG: Release | |
| # Shared Windows CPU Debug -> Debug only with CPU + shared lib | |
| - BUILD_SHARED_LIBS: ON | |
| STATIC_RUNTIME: OFF | |
| device: cpu | |
| CONFIG: Debug | |
| env: | |
| BUILD_CUDA_MODULE: ${{ matrix.device == 'cuda' && 'ON' || 'OFF' }} | |
| BUILD_SYCL_MODULE: ${{ matrix.device == 'xpu' && 'ON' || 'OFF' }} | |
| BUILD_PYTORCH_OPS: ${{ ( matrix.device == 'cuda' || matrix.device == 'xpu' || matrix.CONFIG == 'Debug' ) && 'OFF' || 'ON' }} # FIXME | |
| steps: | |
| - name: Disk space used | |
| run: Get-PSDrive | |
| - name: Checkout source code | |
| uses: actions/checkout@v4 | |
| - name: Install CUDA | |
| if: ${{ matrix.device == 'cuda' }} | |
| shell: pwsh | |
| run: ./util/install_cuda_windows.ps1 | |
| - name: Install Intel oneAPI | |
| if: ${{ matrix.device == 'xpu' }} | |
| shell: pwsh | |
| working-directory: ${{ env.SRC_DIR }} | |
| run: ./util/install_oneapi_windows.ps1 | |
| - name: Install glslang via vcpkg | |
| run: | | |
| # Classic mode: repo vcpkg.json enables manifest mode, which rejects | |
| # ad-hoc package installs used only for glslangValidator on CI. | |
| vcpkg install --classic glslang[tools]:x64-windows | |
| # Write install path to GITHUB_PATH to persist for future steps | |
| $glslangBinPath = Join-Path $env:VCPKG_INSTALLATION_ROOT "installed\x64-windows\tools\glslang" | |
| $glslangBinPath | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| - name: Set up Python version | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Checkout Open3D-ML | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: isl-org/Open3D-ML | |
| ref: main | |
| path: open3d_ml | |
| - name: Install PyTorch requirements | |
| if: ${{ env.BUILD_PYTORCH_OPS == 'ON' }} | |
| run: | | |
| if ( '${{ matrix.device }}' -eq 'cuda' ) { | |
| # python -m pip install -r open3d_ml/requirements-torch-cuda.txt | |
| python -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cu126 | |
| } elseif ( '${{ matrix.device }}' -eq 'xpu' ) { | |
| # No PyTorch requirement for SYCL (xpu) since PyTorch ops are disabled | |
| } else { | |
| python -m pip install -r open3d_ml/requirements-torch.txt | |
| } | |
| - name: Config | |
| # Move build directory to C: https://github.com/actions/virtual-environments/issues/1341 | |
| run: | | |
| $ErrorActionPreference = 'Stop' | |
| New-Item -Path '${{ env.BUILD_DIR }}' -ItemType Directory | |
| cd '${{ env.BUILD_DIR }}' | |
| if ($Env:DEVELOPER_BUILD -ne "OFF") { | |
| $Env:DEVELOPER_BUILD = "ON" | |
| } | |
| cmake --version | |
| $CMAKE_ARGS = @() | |
| if ('${{ matrix.device }}' -eq 'xpu') { | |
| # Runs setvars.bat via cmd and imports all resulting env vars into | |
| # the current PowerShell process AND into $GITHUB_ENV. The latter | |
| # is required because each workflow step ("Config", "Build", | |
| # "Package", ...) runs in a brand new process: env vars set only | |
| # via [System.Environment]::SetEnvironmentVariable (default scope | |
| # Process) do NOT survive past this step. Without $GITHUB_ENV, | |
| # later steps (e.g. Build) lose LIB/INCLUDE/PATH set by | |
| # setvars.bat, so icx fails to find its own runtime libs (e.g. | |
| # libircmt.lib) when ExternalProject sub-builds (zlib, | |
| # directxheaders, ...) run their own fresh compiler ABI detection | |
| # during the Build step. | |
| Write-Host "Initializing oneAPI environment via setvars.bat..." | |
| $setOutput = cmd /c '"C:\Program Files (x86)\Intel\oneAPI\setvars.bat" && set 2>&1' | |
| if ($LASTEXITCODE -ne 0) { throw "setvars.bat failed (exit $LASTEXITCODE)" } | |
| $setOutput | ForEach-Object { | |
| if ($_ -match '^([^=]+)=(.*)$') { | |
| $varName = $Matches[1] | |
| $varValue = $Matches[2] | |
| [System.Environment]::SetEnvironmentVariable($varName, $varValue) | |
| "$varName=$varValue" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
| } | |
| } | |
| $CMAKE_GENERATOR = "Ninja" | |
| # On Windows, icx.exe (MSVC-compatible) handles C++ and SYCL (-fsycl). | |
| # icpx.exe identifies as GNU-like in oneAPI 2025.3+ which conflicts with | |
| # CMake generating MSVC-style flags when C compiler (icx) is MSVC-like. | |
| $CMAKE_ARGS += "-DCMAKE_C_COMPILER=icx", "-DCMAKE_CXX_COMPILER=icx", ` | |
| "-DCMAKE_BUILD_TYPE=${{ matrix.CONFIG }}" | |
| if ($env:OPEN3D_ONEAPI_DEBUG -eq '1') { | |
| Write-Host "OPEN3D_ONEAPI_DEBUG=1: enabling CMAKE_FIND_DEBUG_MODE and cmake --debug-find" | |
| $CMAKE_ARGS += '-DCMAKE_FIND_DEBUG_MODE=ON' | |
| } | |
| } else { | |
| $CMAKE_GENERATOR = "Visual Studio 17 2022" | |
| $CMAKE_ARGS += "-A", "x64" | |
| } | |
| $cmakeExtraArgs = @() | |
| if ($env:OPEN3D_ONEAPI_DEBUG -eq '1' -and '${{ matrix.device }}' -eq 'xpu') { | |
| $cmakeExtraArgs += '--debug-find' | |
| } | |
| # Keep 3rdparty downloads inside BUILD_DIR so the build artifact zip | |
| # reused by build-wheel includes headers (e.g. vk_mem_alloc.hpp) that | |
| # ExternalProject stamps would otherwise skip re-downloading on a | |
| # fresh checkout. build-lib builds the C++ library only | |
| # (BUILD_PYTHON_MODULE=OFF); build-wheel reuses it to build the wheel. | |
| cmake -G $CMAKE_GENERATOR @CMAKE_ARGS @cmakeExtraArgs ` | |
| -DDEVELOPER_BUILD=$Env:DEVELOPER_BUILD ` | |
| -DBUILD_EXAMPLES=OFF ` | |
| -DBUILD_PYTHON_MODULE=OFF ` | |
| -DCMAKE_INSTALL_PREFIX="$env:INSTALL_DIR" ` | |
| -DOPEN3D_THIRD_PARTY_DOWNLOAD_DIR="$env:BUILD_DIR/3rdparty_downloads" ` | |
| -DBUILD_SHARED_LIBS=${{ matrix.BUILD_SHARED_LIBS }} ` | |
| -DSTATIC_WINDOWS_RUNTIME=${{ matrix.STATIC_RUNTIME }} ` | |
| -DBUILD_COMMON_ISPC_ISAS=ON ` | |
| -DBUILD_GUI=ON ` | |
| -DBUILD_AZURE_KINECT=ON ` | |
| -DBUILD_LIBREALSENSE=ON ` | |
| -DBUILD_WEBRTC=ON ` | |
| -DBUILD_UNIT_TESTS=ON ` | |
| -DBUILD_CUDA_MODULE=${{ env.BUILD_CUDA_MODULE }} ` | |
| -DBUILD_SYCL_MODULE=${{ env.BUILD_SYCL_MODULE }} ` | |
| -DBUILD_PYTORCH_OPS=${{ env.BUILD_PYTORCH_OPS }} ` | |
| ${{ env.SRC_DIR }} | |
| - name: Build | |
| working-directory: ${{ env.BUILD_DIR }} | |
| run: | | |
| $ErrorActionPreference = 'Stop' | |
| $buildArgs = @("--build", ".", "--parallel", "${{ env.NPROC }}") | |
| if ('${{ matrix.device }}' -ne 'xpu') { | |
| $buildArgs += "--config", "${{ matrix.CONFIG }}" | |
| } | |
| cmake @buildArgs --target build-examples-iteratively | |
| # Use lowercase "install" (works case-insensitively for MSBuild/VS | |
| # generator too) since Ninja's generated meta-target is lowercase | |
| # only; uppercase "INSTALL" is unknown to Ninja. | |
| cmake @buildArgs --target install | |
| - name: Package | |
| working-directory: ${{ env.BUILD_DIR }} | |
| if: ${{ matrix.BUILD_SHARED_LIBS == 'ON' }} | |
| run: | | |
| $ErrorActionPreference = 'Stop' | |
| $buildArgs = @("--build", ".", "--parallel", "${{ env.NPROC }}") | |
| if ('${{ matrix.device }}' -ne 'xpu') { | |
| $buildArgs += "--config", "${{ matrix.CONFIG }}" | |
| } | |
| cmake @buildArgs --target package | |
| if ("${{ matrix.CONFIG }}" -eq "Debug") { | |
| Get-ChildItem package/open3d-devel-*.zip | Rename-Item -NewName ` | |
| {$_.name -Replace '.zip','-dbg.zip'} | |
| } | |
| $DEVEL_PKG_NAME=(Get-ChildItem package/open3d-devel-*.zip).Name | |
| echo "DEVEL_PKG_NAME=$DEVEL_PKG_NAME" | Out-File -FilePath ` | |
| $Env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Generate package attestation | |
| if: ${{ github.ref == 'refs/heads/main' && matrix.BUILD_SHARED_LIBS == 'ON' }} | |
| uses: actions/attest@v4 | |
| with: | |
| subject-path: ${{ env.BUILD_DIR }}/package/${{ env.DEVEL_PKG_NAME }} | |
| - name: Upload Package | |
| if: ${{ matrix.BUILD_SHARED_LIBS == 'ON' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: open3d-devel-windows-${{ matrix.device }}-${{ matrix.CONFIG }} | |
| path: ${{ env.BUILD_DIR }}/package/${{ env.DEVEL_PKG_NAME }} | |
| if-no-files-found: error | |
| - name: Update devel release with package | |
| if: ${{ github.ref == 'refs/heads/main' && matrix.BUILD_SHARED_LIBS == 'ON' }} | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| shell: bash | |
| working-directory: ${{ env.BUILD_DIR }} | |
| run: | | |
| $GITHUB_WORKSPACE/.github/workflows/update_release.sh package/${{ env.DEVEL_PKG_NAME }} | |
| - name: Viewer App | |
| working-directory: ${{ env.BUILD_DIR }} | |
| if: ${{ matrix.BUILD_SHARED_LIBS == 'OFF' && matrix.STATIC_RUNTIME == 'ON' && matrix.device == 'cpu' && matrix.CONFIG == 'Release' }} | |
| run: | | |
| $ErrorActionPreference = 'Stop' | |
| cmake --build . --parallel ${{ env.NPROC }} --config ${{ matrix.CONFIG }} ` | |
| --target Open3DViewer | |
| cmake --build . --parallel ${{ env.NPROC }} --config ${{ matrix.CONFIG }} ` | |
| --target INSTALL | |
| $cmakeCachePath = Join-Path $env:BUILD_DIR "CMakeCache.txt" | |
| $Env:OPEN3D_VERSION_FULL = (Select-String -Path $cmakeCachePath -Pattern "OPEN3D_VERSION_FULL").Line.Split('=')[1] | |
| $open3dAppPath = Join-Path $env:INSTALL_DIR "bin\Open3D" | |
| Compress-Archive -Path $open3dAppPath -DestinationPath ` | |
| "$Env:GITHUB_WORKSPACE/open3d-$Env:OPEN3D_VERSION_FULL-app-windows-amd64.zip" | |
| echo "VIEWER_ZIP_NAME=open3d-$Env:OPEN3D_VERSION_FULL-app-windows-amd64.zip" | Out-File -FilePath ` | |
| $Env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Generate viewer attestation | |
| if: ${{ github.ref == 'refs/heads/main' && matrix.BUILD_SHARED_LIBS == 'OFF' && matrix.STATIC_RUNTIME == 'ON' && matrix.device == 'cpu' && matrix.CONFIG == 'Release' }} | |
| uses: actions/attest@v4 | |
| with: | |
| subject-path: ${{ github.workspace }}/${{ env.VIEWER_ZIP_NAME }} | |
| - name: Upload Viewer | |
| if: ${{ matrix.BUILD_SHARED_LIBS == 'OFF' && matrix.STATIC_RUNTIME == 'ON' && matrix.device == 'cpu' && matrix.CONFIG == 'Release' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: open3d-app-windows-amd64 | |
| path: ${{ github.workspace }}/${{ env.VIEWER_ZIP_NAME }} | |
| if-no-files-found: error | |
| - name: Update devel release with viewer | |
| if: ${{ github.ref == 'refs/heads/main' && matrix.BUILD_SHARED_LIBS == 'OFF' && matrix.STATIC_RUNTIME == 'ON' && matrix.device == 'cpu' && matrix.CONFIG == 'Release' }} | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| bash .github/workflows/update_release.sh "${{ env.VIEWER_ZIP_NAME }}" | |
| - name: Run C++ unit tests | |
| if: ${{ matrix.device != 'cuda' }} | |
| working-directory: ${{ env.BUILD_DIR }} | |
| run: | | |
| echo "Add --gtest_random_seed=SEED to the test command to repeat this test sequence." | |
| $testExe = if ('${{ matrix.device }}' -eq 'xpu') { ".\bin\tests.exe" } else { ".\bin\${{ matrix.CONFIG }}\tests.exe" } | |
| & $testExe --gtest_shuffle --gtest_filter=-*ReduceSum64bit2DCase0*:*ReduceSum64bit2DCase3* | |
| - name: Linking to Open3D | |
| working-directory: ${{ env.SRC_DIR }}/examples/cmake/open3d-cmake-find-package | |
| run: | | |
| $ErrorActionPreference = 'Stop' | |
| mkdir build | |
| cd build | |
| $CMAKE_ARGS = @() | |
| if ('${{ matrix.device }}' -eq 'xpu') { | |
| # Initialize oneAPI environment in the same step as cmake (env vars | |
| # don't persist across steps). Runs setvars.bat via cmd and imports | |
| # all resulting env vars into the current PowerShell process. | |
| Write-Host "Initializing oneAPI environment via setvars.bat..." | |
| $setOutput = cmd /c '"C:\Program Files (x86)\Intel\oneAPI\setvars.bat" && set 2>&1' | |
| if ($LASTEXITCODE -ne 0) { throw "setvars.bat failed (exit $LASTEXITCODE)" } | |
| $setOutput | ForEach-Object { | |
| if ($_ -match '^([^=]+)=(.*)$') { | |
| [System.Environment]::SetEnvironmentVariable($Matches[1], $Matches[2]) | |
| } | |
| } | |
| $CMAKE_GENERATOR = "Ninja" | |
| # On Windows, icx.exe (MSVC-compatible) handles C++ and SYCL (-fsycl). | |
| # See Config step for the reason icpx is not used. | |
| $CMAKE_ARGS += "-DCMAKE_C_COMPILER=icx", "-DCMAKE_CXX_COMPILER=icx", ` | |
| "-DCMAKE_BUILD_TYPE=${{ matrix.CONFIG }}" | |
| # SYCL Open3D is always built with the dynamic runtime (/MD): icx | |
| # -fsycl rejects the static runtime (/MT). The downstream example | |
| # must match, otherwise linking Open3D.lib (/MD) into Draw (/MT) | |
| # fails with LNK2038, so force STATIC_WINDOWS_RUNTIME=OFF here | |
| # regardless of matrix.STATIC_RUNTIME. | |
| $STATIC_RUNTIME = "OFF" | |
| } else { | |
| $CMAKE_GENERATOR = "Visual Studio 17 2022" | |
| $CMAKE_ARGS += "-A", "x64" | |
| $STATIC_RUNTIME = "${{ matrix.STATIC_RUNTIME }}" | |
| } | |
| cmake -G $CMAKE_GENERATOR @CMAKE_ARGS ` | |
| -DCMAKE_INSTALL_PREFIX="$env:INSTALL_DIR" ` | |
| -DSTATIC_WINDOWS_RUNTIME=$STATIC_RUNTIME ` | |
| .. | |
| $buildArgs = @("--build", ".") | |
| if ('${{ matrix.device }}' -ne 'xpu') { | |
| $buildArgs += "--config", "${{ matrix.CONFIG }}" | |
| } | |
| cmake @buildArgs | |
| if ( '${{ matrix.device }}' -ne 'cuda' ) { # FIXME | |
| $drawExe = if ('${{ matrix.device }}' -eq 'xpu') { ".\Draw.exe" } else { ".\${{ matrix.CONFIG }}\Draw.exe" } | |
| & $drawExe --skip-for-unit-test | |
| } | |
| Remove-Item -LiteralPath $env:INSTALL_DIR -Recurse -Force -ErrorAction SilentlyContinue | |
| - name: Disk space used | |
| run: Get-PSDrive | |
| build-wheel: | |
| name: Build wheel | |
| permissions: | |
| contents: write # upload | |
| id-token: write | |
| attestations: write | |
| artifact-metadata: write | |
| runs-on: windows-2022 | |
| needs: build-lib | |
| # Build wheels even if build-lib failed (e.g. some architecture or debug | |
| # builds failed, but others succeeded, or unit tests failed): we want to build | |
| # whichever wheels have available devel package artifacts. | |
| if: ${{ !cancelled() }} | |
| strategy: | |
| fail-fast: false | |
| # https://github.community/t/how-to-conditionally-include-exclude-items-in-matrix-eg-based-on-branch/16853/6 | |
| matrix: | |
| python_version: ['3.10', '3.11', '3.12', '3.13', '3.14'] | |
| device: [cpu, xpu, cuda] | |
| is_main: | |
| - ${{ github.ref == 'refs/heads/main' }} | |
| exclude: | |
| - is_main: false | |
| python_version: '3.10' | |
| - is_main: false | |
| python_version: '3.11' | |
| - is_main: false | |
| python_version: '3.12' | |
| - is_main: false | |
| python_version: '3.13' | |
| env: | |
| BUILD_CUDA_MODULE: ${{ matrix.device == 'cuda' && 'ON' || 'OFF' }} | |
| BUILD_SYCL_MODULE: ${{ matrix.device == 'xpu' && 'ON' || 'OFF' }} | |
| BUILD_PYTORCH_OPS: ${{ (matrix.device == 'cuda' || matrix.device == 'xpu') && 'OFF' || 'ON' }} | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@v4 | |
| - name: Install CUDA | |
| if: ${{ matrix.device == 'cuda' }} | |
| shell: pwsh | |
| run: ./util/install_cuda_windows.ps1 | |
| - name: Install Intel oneAPI | |
| if: ${{ matrix.device == 'xpu' }} | |
| shell: pwsh | |
| working-directory: ${{ env.SRC_DIR }} | |
| env: | |
| OPEN3D_ONEAPI_DEBUG: ${{ env.OPEN3D_ONEAPI_DEBUG }} | |
| run: ./util/install_oneapi_windows.ps1 | |
| - name: Checkout Open3D-ML | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: isl-org/Open3D-ML | |
| ref: main | |
| path: open3d_ml | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python_version }} | |
| # Build pybind (+ ML ops) against the devel package produced by build-lib's | |
| # "Package" step (find_package(Open3D), OPEN3D_USE_INSTALLED_LIBRARY=ON), | |
| # instead of recompiling/reconfiguring the whole C++ core per Python version. | |
| # Ignore failure if the specific device's devel package is missing, so other devices | |
| # in the matrix are not blocked. | |
| - name: Download devel package | |
| uses: actions/download-artifact@v4 | |
| continue-on-error: true | |
| with: | |
| name: open3d-devel-windows-${{ matrix.device }}-Release | |
| path: ${{ env.SRC_DIR }}/open3d_devel | |
| - name: Extract devel package | |
| id: extract_devel | |
| run: | | |
| $ErrorActionPreference = 'Stop' | |
| $zip = Get-ChildItem "${{ env.SRC_DIR }}/open3d_devel/open3d-devel-*.zip" -ErrorAction SilentlyContinue | Select-Object -First 1 | |
| if (-not $zip) { | |
| Write-Warning "Devel package zip not found for ${{ matrix.device }}! Skipping build." | |
| echo "SKIPPED=true" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
| exit 0 | |
| } | |
| Expand-Archive -Path $zip.FullName -DestinationPath "${{ env.SRC_DIR }}/open3d_devel_extracted" -Force | |
| $config = Get-ChildItem "${{ env.SRC_DIR }}/open3d_devel_extracted" -Recurse -Filter Open3DConfig.cmake | Select-Object -First 1 | |
| if (-not $config) { | |
| throw "Open3DConfig.cmake not found in extracted devel package" | |
| } | |
| $root = $config.Directory.Parent | |
| echo "OPEN3D_INSTALL_ROOT=$($root.FullName)" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
| echo "SKIPPED=false" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Install Python dependencies | |
| if: ${{ env.SKIPPED != 'true' }} | |
| working-directory: ${{ env.SRC_DIR }} | |
| run: | | |
| $ErrorActionPreference = 'Stop' | |
| python -m pip install -U pip==${{ env.PIP_VER }} | |
| # maturin>1.7.8 breaks dependency y-py (Python 3.12) and pywinpty (Python 3.8) wheel building | |
| # https://github.com/MichaIng/DietPi/issues/7329#issuecomment-2565130837 | |
| python -m pip install maturin==1.7.8 | |
| python -m pip install -U -r python/requirements.txt ` | |
| -r python/requirements_build.txt ` | |
| -r python/requirements_jupyter_build.txt | |
| if ('${{ env.BUILD_PYTORCH_OPS }}' -eq 'ON') { | |
| python -m pip install -U -r open3d_ml/requirements-torch.txt | |
| } | |
| - name: Config | |
| if: ${{ env.SKIPPED != 'true' }} | |
| # Move build directory to C: https://github.com/actions/virtual-environments/issues/1341 | |
| run: | | |
| $ErrorActionPreference = 'Stop' | |
| New-Item -Path '${{ env.BUILD_DIR }}' -ItemType Directory -Force | |
| cd '${{ env.BUILD_DIR }}' | |
| if ($Env:DEVELOPER_BUILD -ne "OFF") { | |
| $Env:DEVELOPER_BUILD = "ON" | |
| } | |
| cmake --version | |
| $CMAKE_ARGS = @() | |
| if ('${{ matrix.device }}' -eq 'xpu') { | |
| # Runs setvars.bat via cmd and imports all resulting env vars into | |
| # the current PowerShell process AND into $GITHUB_ENV. The latter | |
| # is required because each workflow step ("Config", "Build Python | |
| # package", ...) runs in a brand new process: env vars set only | |
| # via [System.Environment]::SetEnvironmentVariable (default scope | |
| # Process) do NOT survive past this step. Without $GITHUB_ENV, | |
| # later steps (e.g. Build) lose LIB/INCLUDE/PATH set by | |
| # setvars.bat, so icx fails to find its own runtime libs (e.g. | |
| # libircmt.lib). | |
| Write-Host "Initializing oneAPI environment via setvars.bat..." | |
| $setOutput = cmd /c '"C:\Program Files (x86)\Intel\oneAPI\setvars.bat" && set 2>&1' | |
| if ($LASTEXITCODE -ne 0) { throw "setvars.bat failed (exit $LASTEXITCODE)" } | |
| $setOutput | ForEach-Object { | |
| if ($_ -match '^([^=]+)=(.*)$') { | |
| $varName = $Matches[1] | |
| $varValue = $Matches[2] | |
| [System.Environment]::SetEnvironmentVariable($varName, $varValue) | |
| "$varName=$varValue" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
| } | |
| } | |
| $CMAKE_GENERATOR = "Ninja" | |
| # On Windows, icx.exe (MSVC-compatible) handles C++ and SYCL (-fsycl). | |
| # See build-lib's Config step for the reason icpx is not used. | |
| $CMAKE_ARGS += "-DCMAKE_C_COMPILER=icx", "-DCMAKE_CXX_COMPILER=icx", ` | |
| "-DCMAKE_BUILD_TYPE=Release" | |
| if ($env:OPEN3D_ONEAPI_DEBUG -eq '1') { | |
| Write-Host "OPEN3D_ONEAPI_DEBUG=1: enabling CMAKE_FIND_DEBUG_MODE and cmake --debug-find" | |
| $CMAKE_ARGS += '-DCMAKE_FIND_DEBUG_MODE=ON' | |
| } | |
| } else { | |
| $CMAKE_GENERATOR = "Visual Studio 17 2022" | |
| $CMAKE_ARGS += "-A", "x64" | |
| } | |
| $cmakeExtraArgs = @() | |
| if ($env:OPEN3D_ONEAPI_DEBUG -eq '1' -and '${{ matrix.device }}' -eq 'xpu') { | |
| $cmakeExtraArgs += '--debug-find' | |
| } | |
| # Build pybind (+ ML ops) only, against the devel package extracted | |
| # above (find_package(Open3D)); skips recompiling the C++ core. | |
| # STATIC_WINDOWS_RUNTIME=OFF must match the installed Open3D.dll's | |
| # runtime linkage (/MD), otherwise pybind fails to link against it. | |
| cmake -G $CMAKE_GENERATOR @CMAKE_ARGS @cmakeExtraArgs ` | |
| -DOPEN3D_USE_INSTALLED_LIBRARY=ON ` | |
| -DOpen3D_ROOT="$env:OPEN3D_INSTALL_ROOT" ` | |
| -DCMAKE_PREFIX_PATH="$env:OPEN3D_INSTALL_ROOT" ` | |
| -DCMAKE_INSTALL_PREFIX="$env:INSTALL_DIR" ` | |
| -DDEVELOPER_BUILD="$Env:DEVELOPER_BUILD" ` | |
| -DOPEN3D_THIRD_PARTY_DOWNLOAD_DIR="$env:BUILD_DIR/3rdparty_downloads" ` | |
| -DBUILD_SHARED_LIBS=ON ` | |
| -DSTATIC_WINDOWS_RUNTIME=OFF ` | |
| -DBUILD_GUI=ON ` | |
| -DBUILD_PYTHON_MODULE=ON ` | |
| -DBUILD_AZURE_KINECT=ON ` | |
| -DBUILD_LIBREALSENSE=ON ` | |
| -DBUILD_WEBRTC=ON ` | |
| -DBUILD_JUPYTER_EXTENSION=ON ` | |
| -DBUILD_CUDA_MODULE=${{ env.BUILD_CUDA_MODULE }} ` | |
| -DBUILD_SYCL_MODULE=${{ env.BUILD_SYCL_MODULE }} ` | |
| -DBUILD_PYTORCH_OPS=${{ env.BUILD_PYTORCH_OPS }} ` | |
| -DPython3_EXECUTABLE=$((Get-Command python).Source) ` | |
| ${{ env.SRC_DIR }} | |
| - name: Build Python package | |
| if: ${{ env.SKIPPED != 'true' }} | |
| working-directory: ${{ env.BUILD_DIR }} | |
| run: | | |
| $ErrorActionPreference = 'Stop' | |
| $buildArgs = @("--build", ".", "--parallel", "${{ env.NPROC }}", "--target", "pip-package") | |
| if ('${{ matrix.device }}' -ne 'xpu') { | |
| $buildArgs += "--config", "Release" | |
| } | |
| cmake @buildArgs | |
| $PIP_PKG_NAME=(Get-ChildItem lib/python_package/pip_package/open3d*.whl).Name | |
| echo "PIP_PKG_NAME=$PIP_PKG_NAME" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Generate wheel attestation | |
| if: ${{ github.ref == 'refs/heads/main' && env.SKIPPED != 'true' }} | |
| uses: actions/attest@v4 | |
| with: | |
| subject-path: ${{ env.BUILD_DIR }}/lib/python_package/pip_package/${{ env.PIP_PKG_NAME }} | |
| - name: Upload wheel | |
| if: ${{ env.SKIPPED != 'true' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: open3d-wheel-${{ matrix.device }}-${{ matrix.python_version }} | |
| path: ${{ env.BUILD_DIR }}/lib/python_package/pip_package/${{ env.PIP_PKG_NAME }} | |
| if-no-files-found: error | |
| - name: Update devel release with wheel | |
| if: ${{ env.SKIPPED != 'true' && github.ref == 'refs/heads/main' }} | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| shell: bash | |
| working-directory: ${{ env.BUILD_DIR }} | |
| run: | | |
| $GITHUB_WORKSPACE/.github/workflows/update_release.sh lib/python_package/pip_package/${{ env.PIP_PKG_NAME }} | |
| test-wheel: | |
| name: Test wheel | |
| permissions: | |
| contents: read | |
| runs-on: windows-2022 | |
| needs: [build-wheel] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python_version: ['3.10', '3.11', '3.12', '3.13', '3.14'] | |
| device: [cpu, xpu, cuda] | |
| is_main: | |
| - ${{ github.ref == 'refs/heads/main' }} | |
| exclude: | |
| - is_main: false | |
| python_version: '3.10' | |
| - is_main: false | |
| python_version: '3.11' | |
| - is_main: false | |
| python_version: '3.12' | |
| - is_main: false | |
| python_version: '3.13' | |
| env: | |
| BUILD_PYTORCH_OPS: ${{ matrix.device == 'cpu' && 'ON' || 'OFF' }} | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@v4 | |
| - name: Checkout Open3D-ML | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: isl-org/Open3D-ML | |
| ref: main | |
| path: open3d_ml | |
| - name: Download wheels | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: open3d-wheel-${{ matrix.device }}-${{ matrix.python_version }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python_version }} | |
| - name: Test Python package | |
| run: | | |
| $ErrorActionPreference = 'Stop' | |
| python -V | |
| python -m venv open3d_test_venv | |
| open3d_test_venv\Scripts\Activate.ps1 | |
| python -m pip install -U pip==${{ env.PIP_VER }} | |
| python -m pip install -U -r python/requirements_build.txt ` | |
| -r python/requirements_test.txt | |
| if ('${{ env.BUILD_PYTORCH_OPS }}' -eq 'ON') { | |
| python -m pip install -U -r open3d_ml/requirements-torch.txt | |
| } | |
| $PIP_PKG_NAME = (Get-ChildItem *.whl -ErrorAction SilentlyContinue | Select-Object -First 1).FullName | |
| if (-not $PIP_PKG_NAME) { | |
| $PIP_PKG_NAME = (Get-ChildItem -Recurse *.whl -ErrorAction SilentlyContinue | Select-Object -First 1).FullName | |
| } | |
| if (-not $PIP_PKG_NAME) { | |
| Write-Error "Could not find a valid Open3D wheel!" | |
| exit 1 | |
| } | |
| echo "Installing Open3D wheel $PIP_PKG_NAME in virtual environment..." | |
| python -m pip install $PIP_PKG_NAME | |
| python -c "import open3d; print('Imported:', open3d)" | |
| python -c "import open3d; print('CUDA enabled: ', open3d.core.cuda.is_available())" | |
| python -c "import open3d; print('SYCL enabled: ', open3d.core.sycl.is_available() if hasattr(open3d.core, 'sycl') else False)" | |
| deactivate | |
| - name: Run Python unit tests | |
| # No CUDA GPUs, so skip CUDA python tests | |
| if: ${{ matrix.device != 'cuda' }} | |
| run: | | |
| $ErrorActionPreference = 'Stop' | |
| open3d_test_venv\Scripts\Activate.ps1 | |
| echo "Running Open3D python tests..." | |
| echo "Add --randomly-seed=SEED to the test command to reproduce test order." | |
| $pytest_args = @("python/test/") | |
| if ('${{ env.BUILD_PYTORCH_OPS }}' -eq 'OFF') { | |
| echo "Testing ML Ops disabled" | |
| $pytest_args += "--ignore=python/test/ml_ops/" | |
| } | |
| python -m pytest @pytest_args | |
| deactivate |