1 | /* |
2 | Copyright Benjamin Worpitz 2018 |
3 | Distributed under the Boost Software License, Version 1.0. |
4 | (See accompanying file LICENSE_1_0.txt or copy at |
5 | http://www.boost.org/LICENSE_1_0.txt) |
6 | */ |
7 | |
8 | #ifndef BOOST_PREDEF_LANGUAGE_CUDA_H |
9 | #define BOOST_PREDEF_LANGUAGE_CUDA_H |
10 | |
11 | #include <boost/predef/version_number.h> |
12 | #include <boost/predef/make.h> |
13 | |
14 | /* tag::reference[] |
15 | = `BOOST_LANG_CUDA` |
16 | |
17 | https://en.wikipedia.org/wiki/CUDA[CUDA C/{CPP}] language. |
18 | If available, the version is detected as VV.RR.P. |
19 | |
20 | [options="header"] |
21 | |=== |
22 | | {predef_symbol} | {predef_version} |
23 | |
24 | | `+__CUDACC__+` | {predef_detection} |
25 | | `+__CUDA__+` | {predef_detection} |
26 | |
27 | | `CUDA_VERSION` | VV.RR.P |
28 | |=== |
29 | */ // end::reference[] |
30 | |
31 | #define BOOST_LANG_CUDA BOOST_VERSION_NUMBER_NOT_AVAILABLE |
32 | |
33 | #if defined(__CUDACC__) || defined(__CUDA__) |
34 | # undef BOOST_LANG_CUDA |
35 | # include <cuda.h> |
36 | # if defined(CUDA_VERSION) |
37 | # define BOOST_LANG_CUDA BOOST_PREDEF_MAKE_10_VVRRP(CUDA_VERSION) |
38 | # else |
39 | # define BOOST_LANG_CUDA BOOST_VERSION_NUMBER_AVAILABLE |
40 | # endif |
41 | #endif |
42 | |
43 | #if BOOST_LANG_CUDA |
44 | # define BOOST_LANG_CUDA_AVAILABLE |
45 | #endif |
46 | |
47 | #define BOOST_LANG_CUDA_NAME "CUDA C/C++" |
48 | |
49 | |
50 | #endif |
51 | |
52 | #include <boost/predef/detail/test.h> |
53 | BOOST_PREDEF_DECLARE_TEST(BOOST_LANG_CUDA,BOOST_LANG_CUDA_NAME) |
54 | |