Index: streamexecutor/CMakeLists.txt =================================================================== --- streamexecutor/CMakeLists.txt +++ streamexecutor/CMakeLists.txt @@ -2,10 +2,18 @@ option(STREAM_EXECUTOR_UNIT_TESTS "enable unit tests" ON) option(STREAM_EXECUTOR_ENABLE_DOXYGEN "enable StreamExecutor doxygen" ON) -option(STREAM_EXECUTOR_ENABLE_CONFIG_TOOL "enable building streamexecutor-config tool" ON) -option(STREAM_EXECUTOR_ENABLE_CUDA_PLATFORM "enable building the CUDA StreamExecutor platform" OFF) - -configure_file("include/streamexecutor/PlatformOptions.h.in" "include/streamexecutor/PlatformOptions.h") +option( + STREAM_EXECUTOR_ENABLE_CONFIG_TOOL + "enable building streamexecutor-config tool" + ON) +option(STREAM_EXECUTOR_ENABLE_CUDA_PLATFORM + "enable building the CUDA StreamExecutor platform \ +(use CUDA_ROOT to specify the CUDA path such as /usr/local/cuda)" + OFF) + +configure_file( + "include/streamexecutor/PlatformOptions.h.in" + "include/streamexecutor/PlatformOptions.h") # First find includes relative to the streamexecutor top-level source path. include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/include) Index: streamexecutor/lib/CMakeLists.txt =================================================================== --- streamexecutor/lib/CMakeLists.txt +++ streamexecutor/lib/CMakeLists.txt @@ -9,7 +9,7 @@ ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/platforms/cuda/cmake/modules/") - find_package(Libcuda REQUIRED) + find_package(LIBCUDA REQUIRED) include_directories(${LIBCUDA_INCLUDE_DIRS}) set( Index: streamexecutor/lib/platforms/cuda/cmake/modules/FindLIBCUDA.cmake =================================================================== --- streamexecutor/lib/platforms/cuda/cmake/modules/FindLIBCUDA.cmake +++ streamexecutor/lib/platforms/cuda/cmake/modules/FindLIBCUDA.cmake @@ -3,10 +3,35 @@ # LIBCUDA_FOUND - System has libcuda # LIBCUDA_INCLUDE_DIRS - The libcuda include directories # LIBCUDA_LIBRARIES - The libraries needed to use libcuda +# +# Use the CUDA_ROOT environment variable or the CUDA_ROOT CMake variable to +# specify the first directory to search for cuda.h. + +# First search based on the CUDA_ROOT cmake variable. +find_path( + LIBCUDA_INCLUDE_DIR + cuda.h + PATHS + ${CUDA_ROOT}/include + NO_DEFAULT_PATH) + +# Then search based on the CUDA_ROOT environment variable. +find_path( + LIBCUDA_INCLUDE_DIR + cuda.h + PATHS + ENV CUDA_ROOT + PATH_SUFFIXES include + NO_DEFAULT_PATH) + +# Finally, search based on a well-known location. +find_path( + LIBCUDA_INCLUDE_DIR + cuda.h + PATHS + /usr/local/cuda/include + NO_DEFAULT_PATH) -# TODO(jhen): Allow users to specify a search path. -find_path(LIBCUDA_INCLUDE_DIR cuda.h /usr/local/cuda/include) -# TODO(jhen): Use the library that goes with the headers. find_library(LIBCUDA_LIBRARY cuda) include(FindPackageHandleStandardArgs)