diff options
author | Brad King <brad.king@kitware.com> | 2019-12-12 16:57:06 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-12-12 16:57:18 (GMT) |
commit | 4fb9c880425ade41735951347d4e7d004a4e1e47 (patch) | |
tree | 7792f6261e1c88c812b679633eab50fde7f27a90 /Tests/Cuda/MixedStandardLevels2 | |
parent | bd855ffb5576c7ab2b3281e96a1aebaf825f9e97 (diff) | |
parent | 2467a2b3184595a87e93db510408fc14ddbaf3b9 (diff) | |
download | CMake-4fb9c880425ade41735951347d4e7d004a4e1e47.zip CMake-4fb9c880425ade41735951347d4e7d004a4e1e47.tar.gz CMake-4fb9c880425ade41735951347d4e7d004a4e1e47.tar.bz2 |
Merge topic 'add_cuda_meta_compiler_features'
2467a2b318 CUDA: Add cuda meta-features (e.g. ``cuda_std_11``) support
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3992
Diffstat (limited to 'Tests/Cuda/MixedStandardLevels2')
-rw-r--r-- | Tests/Cuda/MixedStandardLevels2/CMakeLists.txt | 14 | ||||
-rw-r--r-- | Tests/Cuda/MixedStandardLevels2/lib.cpp | 7 | ||||
-rw-r--r-- | Tests/Cuda/MixedStandardLevels2/main.cu | 11 |
3 files changed, 32 insertions, 0 deletions
diff --git a/Tests/Cuda/MixedStandardLevels2/CMakeLists.txt b/Tests/Cuda/MixedStandardLevels2/CMakeLists.txt new file mode 100644 index 0000000..12dd328 --- /dev/null +++ b/Tests/Cuda/MixedStandardLevels2/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.7) +project(MixedStandardLevels2 CXX CUDA) + +string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") + +set(CMAKE_CXX_STANDARD 17) #this can decay + +add_executable(MixedStandardLevels2 main.cu lib.cpp) +target_compile_features(MixedStandardLevels2 PUBLIC cuda_std_11) + +if(APPLE) + # Help the static cuda runtime find the driver (libcuda.dyllib) at runtime. + set_property(TARGET MixedStandardLevels2 PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) +endif() diff --git a/Tests/Cuda/MixedStandardLevels2/lib.cpp b/Tests/Cuda/MixedStandardLevels2/lib.cpp new file mode 100644 index 0000000..cabbacb --- /dev/null +++ b/Tests/Cuda/MixedStandardLevels2/lib.cpp @@ -0,0 +1,7 @@ + +int func(int A, int B) +{ + // Verify that we have at least c++14 + auto mult_func = [](auto a, auto b) { return a * b; }; + return mult_func(A, B); +} diff --git a/Tests/Cuda/MixedStandardLevels2/main.cu b/Tests/Cuda/MixedStandardLevels2/main.cu new file mode 100644 index 0000000..a97a41e --- /dev/null +++ b/Tests/Cuda/MixedStandardLevels2/main.cu @@ -0,0 +1,11 @@ + +#if __cplusplus < 201103L && !defined(_MSC_VER) +# error "invalid standard value" +#endif +#include <type_traits> + +int main(int argc, char** argv) +{ + using returnv = std::integral_constant<int, 0>; + return returnv::value; +} |