You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.5 KiB

  1. #
  2. # FindThrust
  3. #
  4. # This module finds the Thrust header files and extrats their version. It
  5. # sets the following variables.
  6. #
  7. # THRUST_INCLUDE_DIR - Include directory for thrust header files. (All header
  8. # files will actually be in the thrust subdirectory.)
  9. # THRUST_VERSION - Version of thrust in the form "major.minor.patch".
  10. #
  11. find_path( THRUST_INCLUDE_DIR
  12. HINTS
  13. /usr/include/cuda
  14. /usr/local/include
  15. /usr/local/cuda/include
  16. ${CUDA_INCLUDE_DIRS}
  17. NAMES thrust/version.h
  18. DOC "Thrust headers"
  19. )
  20. if( THRUST_INCLUDE_DIR )
  21. list( REMOVE_DUPLICATES THRUST_INCLUDE_DIR )
  22. endif( THRUST_INCLUDE_DIR )
  23. # Find thrust version
  24. file( STRINGS ${THRUST_INCLUDE_DIR}/thrust/version.h
  25. version
  26. REGEX "#define THRUST_VERSION[ \t]+([0-9x]+)"
  27. )
  28. string( REGEX REPLACE
  29. "#define THRUST_VERSION[ \t]+"
  30. ""
  31. version
  32. "${version}"
  33. )
  34. string( REGEX MATCH "^[0-9]" major ${version} )
  35. string( REGEX REPLACE "^${major}00" "" version "${version}" )
  36. string( REGEX MATCH "^[0-9]" minor ${version} )
  37. string( REGEX REPLACE "^${minor}0" "" version "${version}" )
  38. set( THRUST_VERSION "${major}.${minor}.${version}")
  39. set( THRUST_MAJOR_VERSION "${major}")
  40. set( THRUST_MINOR_VERSION "${minor}")
  41. # Check for required components
  42. include( FindPackageHandleStandardArgs )
  43. find_package_handle_standard_args( Thrust
  44. REQUIRED_VARS THRUST_INCLUDE_DIR
  45. VERSION_VAR THRUST_VERSION
  46. )
  47. set(THRUST_INCLUDE_DIRS ${THRUST_INCLUDE_DIR})
  48. mark_as_advanced(THRUST_INCLUDE_DIR)