From a964846e2dd0d7f3eb5166fd8936bfb33d65ba94 Mon Sep 17 00:00:00 2001 From: PBerger Date: Fri, 7 Mar 2014 23:54:18 +0100 Subject: [PATCH] Added cusplibrary as a git submodule. Former-commit-id: 152764c8f376f351fa1eab7fa44e0c1586c8d4a9 --- .gitmodules | 3 ++ resources/3rdparty/cusplibrary | 1 + resources/cmake/FindThrust.cmake | 53 +++++++++++++++++++++++++++ resources/cudaForStorm/CMakeLists.txt | 9 +++++ 4 files changed, 66 insertions(+) create mode 100644 .gitmodules create mode 160000 resources/3rdparty/cusplibrary create mode 100644 resources/cmake/FindThrust.cmake diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..92b35f18f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "resources/3rdparty/cusplibrary"] + path = resources/3rdparty/cusplibrary + url = https://github.com/cusplibrary/cusplibrary.git diff --git a/resources/3rdparty/cusplibrary b/resources/3rdparty/cusplibrary new file mode 160000 index 000000000..d8d7d9e97 --- /dev/null +++ b/resources/3rdparty/cusplibrary @@ -0,0 +1 @@ +Subproject commit d8d7d9e97add8db08ef0ad5c0a7e9929fd83ce3c diff --git a/resources/cmake/FindThrust.cmake b/resources/cmake/FindThrust.cmake new file mode 100644 index 000000000..9ad65b7e8 --- /dev/null +++ b/resources/cmake/FindThrust.cmake @@ -0,0 +1,53 @@ +# +# FindThrust +# +# This module finds the Thrust header files and extrats their version. It +# sets the following variables. +# +# THRUST_INCLUDE_DIR - Include directory for thrust header files. (All header +# files will actually be in the thrust subdirectory.) +# THRUST_VERSION - Version of thrust in the form "major.minor.patch". +# + +find_path( THRUST_INCLUDE_DIR + HINTS + /usr/include/cuda + /usr/local/include + /usr/local/cuda/include + ${CUDA_INCLUDE_DIRS} + NAMES thrust/version.h + DOC "Thrust headers" + ) +if( THRUST_INCLUDE_DIR ) + list( REMOVE_DUPLICATES THRUST_INCLUDE_DIR ) +endif( THRUST_INCLUDE_DIR ) + +# Find thrust version +file( STRINGS ${THRUST_INCLUDE_DIR}/thrust/version.h + version + REGEX "#define THRUST_VERSION[ \t]+([0-9x]+)" + ) +string( REGEX REPLACE + "#define THRUST_VERSION[ \t]+" + "" + version + "${version}" + ) + +string( REGEX MATCH "^[0-9]" major ${version} ) +string( REGEX REPLACE "^${major}00" "" version "${version}" ) +string( REGEX MATCH "^[0-9]" minor ${version} ) +string( REGEX REPLACE "^${minor}0" "" version "${version}" ) +set( THRUST_VERSION "${major}.${minor}.${version}") +set( THRUST_MAJOR_VERSION "${major}") +set( THRUST_MINOR_VERSION "${minor}") + +# Check for required components +include( FindPackageHandleStandardArgs ) +find_package_handle_standard_args( Thrust + REQUIRED_VARS THRUST_INCLUDE_DIR + VERSION_VAR THRUST_VERSION + ) + +set(THRUST_INCLUDE_DIRS ${THRUST_INCLUDE_DIR}) +mark_as_advanced(THRUST_INCLUDE_DIR) \ No newline at end of file diff --git a/resources/cudaForStorm/CMakeLists.txt b/resources/cudaForStorm/CMakeLists.txt index f3e679e92..acedd56d1 100644 --- a/resources/cudaForStorm/CMakeLists.txt +++ b/resources/cudaForStorm/CMakeLists.txt @@ -38,6 +38,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/../cmake/") find_package(CUDA REQUIRED) find_package(Doxygen REQUIRED) find_package(Threads REQUIRED) +find_package(Thrust REQUIRED) # If the DEBUG option was turned on, we will target a debug version and a release version otherwise if (CUDAFORSTORM_DEBUG) @@ -209,6 +210,14 @@ include_directories(${CUDA_INCLUDE_DIRS}) include_directories(${THREADS_INCLUDE_DIRS}) target_link_libraries(cudaForStorm ${CMAKE_THREAD_LIBS_INIT}) +############################################################# +## +## Thrust +## +############################################################# +include_directories(${THRUST_INCLUDE_DIR}) +message(STATUS "StoRM (CudaPlugin) - Found Thrust Version ${THRUST_VERSION}") + if (MSVC) # Add the DebugHelper DLL set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} Dbghelp.lib")