Skip to content

Commit

Permalink
Merge pull request #3808 from rwy0717/cuda
Browse files Browse the repository at this point in the history
Enable CUDA support in cmake when available
  • Loading branch information
youngar authored Sep 19, 2019
2 parents 46e6f29 + 8b36e36 commit ff37764
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
17 changes: 17 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,23 @@ set(OMR_INSTALL_ARCHIVE_DIR ${CMAKE_INSTALL_LIBDIR} CACHE PATH "Installation dir
set(OMR_INSTALL_INC_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH "Installation directory for headers")
set(OMR_INSTALL_DATA_DIR ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME} CACHE PATH "Installation directory for data files")

###
### CUDA Support
###

if (OMR_ENV_DATA64)
find_package(Threads)
if(Threads_FOUND)
# Threads mush be found before we can look for CUDA.
# FindCuda will error out if Threads is missing, even though CUDA itself is optional.
find_package(CUDA)
else()
set(CUDA_FOUND OFF CACHE BOOL "CUDA is disabled (threads not found)")
endif()
else()
set(CUDA_FOUND OFF CACHE BOOL "CUDA is disabled")
endif()

###
### Versions and stuff
###
Expand Down
3 changes: 1 addition & 2 deletions cmake/config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ set(OMR_NOTIFY_POLICY_CONTROL OFF CACHE BOOL "TODO: Document")

set(OMR_ENV_GCC OFF CACHE BOOL "TODO: Document")


set(OMR_OPT_CUDA OFF CACHE BOOL "TODO: Document")
set(OMR_OPT_CUDA ${CUDA_FOUND} CACHE BOOL "Enable CUDA support in OMR")

set(OMR_SANITIZE OFF CACHE STRING "Sanitizer selection. Only has an effect on GNU or Clang")
7 changes: 7 additions & 0 deletions port/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ target_include_directories(omrport_obj
$<TARGET_PROPERTY:omr_base,INTERFACE_INCLUDE_DIRECTORIES>
)

if (OMR_OPT_CUDA)
target_include_directories(omrport_obj
PRIVATE
${CUDA_INCLUDE_DIRS}
)
endif()

target_compile_definitions(omrport_obj
PUBLIC
$<TARGET_PROPERTY:omr_base,INTERFACE_COMPILE_DEFINITIONS>
Expand Down

0 comments on commit ff37764

Please sign in to comment.