Skip to content

Use C++20 for Windows MSVC builds (PyTorch header requirement) - #40

Open
rwfsmith wants to merge 1 commit into
JeffreyXiang:mainfrom
rwfsmith:windows-msvc-cpp20
Open

Use C++20 for Windows MSVC builds (PyTorch header requirement)#40
rwfsmith wants to merge 1 commit into
JeffreyXiang:mainfrom
rwfsmith:windows-msvc-cpp20

Conversation

@rwfsmith

Copy link
Copy Markdown

Summary

Bumps the existing Windows MSVC/nvcc flags in setup.py from C++17 to C++20 so the extension compiles against current PyTorch headers.

Why

setup.py already has a Windows branch that sets /std:c++17 for MSVC and -std=c++17 (plus -Xcompiler=/std:c++17) for nvcc. Recent PyTorch releases require C++20 in their headers, so that block no longer compiles — building against PyTorch 2.13 with MSVC fails until the standard is raised.

Change

Three flags in the existing IS_WINDOWS block:

  • /std:c++17/std:c++20
  • -std=c++17-std=c++20
  • -Xcompiler=/std:c++17-Xcompiler=/std:c++20

Windows-only — the Linux flags are untouched, so there's no effect on existing builds.

Verification

Builds and runs on Windows 11 / Python 3.13 / CUDA 13.0 / MSVC (VS2022) / PyTorch 2.13, driving TRELLIS.2's remeshing and GLB export path.

Note

If you'd prefer to keep C++17 for older PyTorch, this could be made conditional on the detected torch.__version__ instead. Happy to rework it that way — I went with the straight bump since the Windows block is already separate from Linux and PyTorch itself has moved on.

Independent of #39, which fixes an unrelated out-of-bounds read in the dual contouring kernel. Either can merge first.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant