How can I create aliases for cpp and h files so that GCC can compile files of different naming suffixes?
How can I make the GCC ignore certain compiler attributes without having to wrap them in #ifdef
and #endif
statements?
Elaboration:
I am writing a library with CUDA in which I want to be able to create the same objects both on the CPU and GPU.
If the user does not have NVCC (this is a header only library) I want the user to be able to compile with the GCC.
Is there anyway that I can make the GCC compile .cu
and .cuh
files while ignoring the __host__
__device__
and __global__
compiler attributes without having to simply wrap all
of:
__host__
__device__
and __global__
in #ifdef #endif
statements?
IE: #ifdef NVCC //have nvcc interpret .cu
file as such
__host__ __device__
struct foo {
foo() {/*impl*/ }
};
ELSE: //have GCC/Clang/etc interpret .cu
file as such (and as an .h
file):
struct foo {
foo() {/*impl*/ }
};