Skip to content

Conversation

patrikhuber
Copy link
Contributor

@patrikhuber patrikhuber commented Sep 17, 2025

The previous logic would always add -allow-unsupported-compiler and -D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH, even when it was not needed (e.g. when a recent CUDA version is used), and also printing a (confusing) warning which is not applicable in that case.

The revised logic only adds the flags if MSVC>=1940 and CUDA<=12.4. For that, we need to use find_package(CUDAToolkit REQUIRED), like it's also done a few more lines below in the if(BUILD_COMMON_CUDA_ARCHS) code - and then we append to CMAKE_CUDA_FLAGS only when needed.

The new code also uses CMAKE_CUDA_FLAGS for the _ALLOW_COMPILER_AND_STL_VERSION_MISMATCH define, which makes CMake's try_compile (which is used when enable_language(CUDA) is called) work reliably if a CMake version >=3.29.4 is used. It doesn't work when add_compile_definitions(_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH) is used.

Type

  • Bug fix (non-breaking change which fixes an issue): Fixes the issue described above.
  • New feature (non-breaking change which adds functionality). Resolves #
  • Breaking change (fix or feature that would cause existing functionality to not work as expected) Resolves #

Motivation and Context

See above.

Checklist:

  • I have run python util/check_style.py --apply to apply Open3D code style
    to my code.
  • This PR changes Open3D behavior or adds new functionality.
    • Both C++ (Doxygen) and Python (Sphinx / Google style) documentation is
      updated accordingly.
    • I have added or updated C++ and / or Python unit tests OR included test
      results
      (e.g. screenshots or numbers) here.
  • I will follow up and update the code if CI fails.
  • For fork PRs, I have selected Allow edits from maintainers.

Description

See above.

The previous logic would always add -allow-unsupported-compiler and -D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH, even when it was not needed.
The revised logic only adds the flags if MSVC>=1940 and CUDA<=12.4. The new code also uses CMAKE_CUDA_FLAGS for the define, which makes CMake's try_compile work reliably if a CMake version >=3.29.4 is used.
Copy link

update-docs bot commented Sep 17, 2025

Thanks for submitting this pull request! The maintainers of this repository would appreciate if you could update the CHANGELOG.md based on your changes.

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