From 7a4ca9dc901a41f3d9346e31f466c8635015f6a6 Mon Sep 17 00:00:00 2001 From: Benjamin Worpitz Date: Sun, 13 May 2018 17:22:00 +0200 Subject: [PATCH] add nvcc compiler detection (#72) --- include/boost/predef/compiler.h | 1 + include/boost/predef/compiler/nvcc.h | 60 ++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 include/boost/predef/compiler/nvcc.h diff --git a/include/boost/predef/compiler.h b/include/boost/predef/compiler.h index 61a4c52..de1b4ab 100644 --- a/include/boost/predef/compiler.h +++ b/include/boost/predef/compiler.h @@ -32,6 +32,7 @@ http://www.boost.org/LICENSE_1_0.txt) #include #include #include +#include #include #include #include diff --git a/include/boost/predef/compiler/nvcc.h b/include/boost/predef/compiler/nvcc.h new file mode 100644 index 0000000..3c35ef7 --- /dev/null +++ b/include/boost/predef/compiler/nvcc.h @@ -0,0 +1,60 @@ +/* +Copyright Benjamin Worpitz 2018 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_NVCC_H +#define BOOST_PREDEF_COMPILER_NVCC_H + +#include +#include + +/*` +[heading `BOOST_COMP_NVCC`] + +[@https://en.wikipedia.org/wiki/NVIDIA_CUDA_Compiler NVCC] compiler. +Version number available as major, minor, and patch beginning with version 7.5. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__NVCC__`] [__predef_detection__]] + + [[`__CUDACC_VER_MAJOR__`, `__CUDACC_VER_MINOR__`, `__CUDACC_VER_BUILD__`] [V.R.P]] + ] + */ + +#define BOOST_COMP_NVCC BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__NVCC__) +# if !defined(__CUDACC_VER_MAJOR__) || !defined(__CUDACC_VER_MINOR__) || !defined(__CUDACC_VER_BUILD__) +# define BOOST_COMP_NVCC_DETECTION BOOST_VERSION_NUMBER_AVAILABLE +# else +# define BOOST_COMP_NVCC_DETECTION BOOST_VERSION_NUMBER(__CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, __CUDACC_VER_BUILD__) +# endif +#endif + +#ifdef BOOST_COMP_NVCC_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_NVCC_EMULATED BOOST_COMP_NVCC_DETECTION +# else +# undef BOOST_COMP_NVCC +# define BOOST_COMP_NVCC BOOST_COMP_NVCC_DETECTION +# endif +# define BOOST_COMP_NVCC_AVAILABLE +# include +#endif + +#define BOOST_COMP_NVCC_NAME "NVCC" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_NVCC,BOOST_COMP_NVCC_NAME) + +#ifdef BOOST_COMP_NVCC_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_NVCC_EMULATED,BOOST_COMP_NVCC_NAME) +#endif