Fix logic for adding -allow-unsupported-compiler to nvcc #7337
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 theif(BUILD_COMMON_CUDA_ARCHS)
code - and then we append toCMAKE_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 whenenable_language(CUDA)
is called) work reliably if a CMake version >=3.29.4 is used. It doesn't work whenadd_compile_definitions(_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH)
is used.Type
Motivation and Context
See above.
Checklist:
python util/check_style.py --apply
to apply Open3D code styleto my code.
updated accordingly.
results (e.g. screenshots or numbers) here.
Description
See above.