Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COMP: Revisit initialization of Autoscoper_RENDERING_BACKEND #65

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,22 @@ mark_as_superbuild(Slicer_DIR)
find_package(Git REQUIRED)
mark_as_superbuild(GIT_EXECUTABLE)

#-----------------------------------------------------------------------------
# Options

set(_reason "")
if(DEFINED ENV{Autoscoper_RENDERING_BACKEND})
set(_reason " (initialized from env. variable)")
set(_default_backend $ENV{Autoscoper_RENDERING_BACKEND})
elseif(NOT DEFINED Autoscoper_RENDERING_BACKEND)
set(_reason " (initialized from default value)")
set(_default_backend "OpenCL")
endif()

set(Autoscoper_RENDERING_BACKEND "${_default_backend}" CACHE STRING "Backend to use for DRR and radiograph rendering")
set_property(CACHE Autoscoper_RENDERING_BACKEND PROPERTY STRINGS "CUDA" "OpenCL")
message(STATUS "Setting Autoscoper_RENDERING_BACKEND to ${Autoscoper_RENDERING_BACKEND}${_reason}")

#-----------------------------------------------------------------------------
# SuperBuild setup
option(${EXTENSION_NAME}_SUPERBUILD "Build ${EXTENSION_NAME} and the projects it depends on." ON)
Expand Down
17 changes: 9 additions & 8 deletions SuperBuild/External_Autoscoper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,17 @@ if(NOT DEFINED ${proj}_DIR AND NOT ${SUPERBUILD_TOPLEVEL_PROJECT}_USE_SYSTEM_${p
)
endif()

# set(Autoscoper_OPENCL_USE_ICD_LOADER TRUE)
# if(APPLE)
# set(Autoscoper_OPENCL_USE_ICD_LOADER FALSE)
# endif()
if(NOT "${Autoscoper_RENDERING_BACKEND}" MATCHES "^(CUDA|OpenCL)$")
message(FATAL_ERROR "Autoscoper_RENDERING_BACKEND must be set to CUDA or OpenCL")
endif()

set(Autoscoper_OPENCL_USE_ICD_LOADER FALSE)
if(APPLE)
set(Autoscoper_RENDERING_BACKEND "OpenCL")
if(Autoscoper_RENDERING_BACKEND STREQUAL "OpenCL")
set(Autoscoper_OPENCL_USE_ICD_LOADER TRUE)
if(APPLE)
set(Autoscoper_OPENCL_USE_ICD_LOADER FALSE)
endif()
else()
set(Autoscoper_RENDERING_BACKEND "CUDA")
set(Autoscoper_OPENCL_USE_ICD_LOADER FALSE)
endif()

if(UNIX AND NOT APPLE)
Expand Down
Loading