diff --git a/CMakeLists.txt b/CMakeLists.txt index 5bb8a4b..8822353 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,24 +8,22 @@ set(gpu-stream_VERSION_MINOR 0) list(APPEND CMAKE_CXX_FLAGS --std=c++11) +configure_file(src/common.h.in src/common.h) + find_package(CUDA QUIET) if (${CUDA_FOUND}) -set(IMPLEMENTATION CUDA) -configure_file(src/common.h.in src/common_cuda.h) -cuda_add_executable(cuda.exe src/main.cpp src/CUDAStream.cu) -target_compile_definitions(cuda.exe PUBLIC CUDA) + cuda_add_executable(cuda.exe src/main.cpp src/CUDAStream.cu) + target_compile_definitions(cuda.exe PUBLIC CUDA) else (${CUDA_FOUND}) -message("Skipping CUDA...") + message("Skipping CUDA...") endif (${CUDA_FOUND}) find_package(OpenCL QUIET) if (${OpenCL_FOUND}) -set(gpu-stream_IMPLEMENTATION OpenCL) -configure_file(src/common.h.in src/common_ocl.h) -add_executable(ocl.exe src/main.cpp src/OCLStream.cpp) -target_compile_definitions(ocl.exe PUBLIC OCL) -target_link_libraries(ocl.exe ${OpenCL_LIBRARY}) + add_executable(ocl.exe src/main.cpp src/OCLStream.cpp) + target_compile_definitions(ocl.exe PUBLIC OCL) + target_link_libraries(ocl.exe ${OpenCL_LIBRARY}) else (${OpenCL_FOUND}) -message("Skipping OpenCL...") + message("Skipping OpenCL...") endif (${OpenCL_FOUND}) diff --git a/src/CUDAStream.h b/src/CUDAStream.h index e6505c6..34e0303 100644 --- a/src/CUDAStream.h +++ b/src/CUDAStream.h @@ -4,6 +4,8 @@ #include "Stream.h" +#define IMPLEMENTATION_STRING "CUDA" + template class CUDAStream : public Stream { diff --git a/src/OCLStream.h b/src/OCLStream.h index 28a9be1..f9c133e 100644 --- a/src/OCLStream.h +++ b/src/OCLStream.h @@ -10,6 +10,8 @@ #include "Stream.h" +#define IMPLEMENTATION_STRING "OpenCL" + template class OCLStream : public Stream { diff --git a/src/common.h.in b/src/common.h.in index 44dc040..fbf953c 100644 --- a/src/common.h.in +++ b/src/common.h.in @@ -1,4 +1,3 @@ #define VERSION_STRING "@gpu-stream_VERSION_MAJOR@.@gpu-stream_VERSION_MINOR@" -#define IMPLEMENTATION_STRING "@gpu-stream_IMPLEMENTATION@"