Commit Graph

15 Commits

Author SHA1 Message Date
Brad King
bffdc2e2e1 Merge topic 'msvc_cuda_8_explicitly_specify_cuda_language'
46abfedb CUDA: MSVC will now state files are cuda files when needed

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1658
2018-01-18 09:41:01 -05:00
Robert Maynard
46abfedb83 CUDA: MSVC will now state files are cuda files when needed
The MSVC CUDA build customizations before CUDA 9 would not explicitly
add the -x cu option when building. This caused .cpp and .c files
invoked with CudaCompile to be compiled as host code and not
cuda. Now when we detect CUDA < 9 we will explicitly add this
option to correct this bug.
2018-01-12 15:17:03 -05:00
Brad King
506fda1cf0 Genex: Enable COMPILE_LANGUAGE for INCLUDE_DIRECTORIES with VS and Xcode
The set of compile flags used for a target's C and C++ sources is based
on the linker language.  By default this is always the C++ flags if any
C++ sources appear in the target, and otherwise the C flags.  Therefore
we can define the `COMPILE_LANGUAGE` generator expression in
`INCLUDE_DIRECTORIES` to match the selected language.

This is not exactly the same as for other generators, but is the best VS
and Xcode can do.  It is also sufficient for many use cases since the
set of include directories for C and C++ is frequently similar but may
be distinct from those for other languages like CUDA.

Fixes: #17435
2018-01-12 14:27:37 -05:00
Brad King
c2f79c9867 Genex: Enable COMPILE_LANGUAGE for COMPILE_DEFINITIONS with VS and Xcode
The set of compile flags used for a target's C and C++ sources is based
on the linker language.  By default this is always the C++ flags if any
C++ sources appear in the target, and otherwise the C flags.  Therefore
we can define the `COMPILE_LANGUAGE` generator expression in
`COMPILE_DEFINITIONS` to match the selected language.

This is not exactly the same as for other generators, but is the best VS
and Xcode can do.  It is also sufficient for many use cases since the
set of definitions for C and C++ is frequently similar but may be
distinct from those for other languages like CUDA.

Issue: #17435
2018-01-12 14:27:37 -05:00
Brad King
2ae880fa8f Genex: Enable COMPILE_LANGUAGE for COMPILE_OPTIONS with Visual Studio
Since commit v3.9.0-rc4~3^2~1 (VS: Fix target_compile_options for CUDA,
2017-06-21), the evaluation of `COMPILE_LANGUAGE` receives the proper
language.  The set of compile flags used for a target's C and C++
sources is based on the linker language.  By default this is always the
C++ flags if any C++ sources appear in the target, and otherwise the C
flags.  Therefore we can define the `COMPILE_LANGUAGE` generator
expression in `COMPILE_OPTIONS` to match the selected language.

This is not exactly the same as for other generators, but is the best VS
can do.  It is also sufficient for many use cases since the set of
allowed flags for C and C++ is almost the same in Visual Studio.
Furthermore, since the VS generator moves many of the flags to
declarative `.vcxproj` elements, it will automatically avoid passing
C++ flags for C sources.

Issue: #17435
2017-11-20 13:51:25 -05:00
Brad King
aa640cc20f Tests: Fix CudaOnly.WithDefs test on CUDA 9
CUDA 9 dropped support for `compute_20`, so use a different alternative.
2017-09-29 09:55:11 -04:00
Brad King
396b618c52 Merge topic 'vs-cuda-fix-flags'
3b754215 VS: Improve workaround for CUDA -Xcompiler placement bug
f2059585 VS: Fix target_compile_options for CUDA

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !996
2017-06-22 10:04:37 -04:00
Brad King
f2059585e6 VS: Fix target_compile_options for CUDA
Fix the VS generator to honor `COMPILE_OPTIONS` for CUDA.  The exclusion
added by commit v3.9.0-rc1~431^2~7 (VS: Do not pass CUDA compile options
to C compiler, 2017-03-07) was correct but we need additional logic to
pass the CUDA compile options to the CUDA compiler.  Also we should
still pass the CXX or C options to MSVC (ClCompile) when those languages
are enabled even if the link language is CUDA.
2017-06-21 14:23:46 -04:00
Brad King
fff782f6a6 Tests: Simplify CUDA rpath on macOS
Use the `BUILD_RPATH` property and reference the CMake-computed location
of the runtime libraries.
2017-06-21 10:41:49 -04:00
Brad King
65481a60a0 CUDA: Work around VS limitation in CudaOnly.WithDefs test
CUDA 8.0 MSBuild rules do not pass `-x cu` to nvcc and so cannot support
a custom file extension.  Fix our test for this to use a `.cu` extension
instead.
2017-03-10 10:19:58 -05:00
Brad King
d7c80f6036 CUDA: Fix test cases to not override CUDA flags
Append to `CMAKE_CUDA_FLAGS` instead of overwriting it.
2017-02-15 11:12:09 -05:00
Brad King
c4a6135039 Tests: Run clang-format on CUDA code 2017-02-14 10:20:50 -05:00
Brad King
5599d858c7 CUDA: Port test cases to Windows with MSVC host compiler 2017-01-12 10:39:04 -05:00
Robert Maynard
c59811a233 CUDA: Tests now state why they are failing when no CUDA card is found. 2016-12-15 15:57:01 -05:00
Robert Maynard
7b9131da64 CUDA: Add tests to verify CUDA compiler works properly. 2016-11-14 16:40:50 -05:00