Merge branch 'opengl-mesa-config-order' into 'master'

Configure OSMesa before OpenGL

The configuration for OpenGL can change depending on whether OSMesa is
used, so make sure OSMesa is always configured first so that the
"correct" OpenGL is used.

See merge request !540
This commit is contained in:
Kenneth Moreland 2016-09-07 15:51:36 -04:00
commit e5967cfca8

@ -45,6 +45,23 @@ set(VTKm_AVAILABLE_COMPONENTS
CUDA
)
#-----------------------------------------------------------------------------
# Support function for giving status messages on component configurations
#-----------------------------------------------------------------------------
set(VTKm_CONFIGURE_COMPONENT_MESSAGES "" CACHE INTERNAL "" FORCE)
function(vtkm_configure_component_message message_text)
if(NOT VTKm_CONFIGURE_QUIET)
list(FIND VTKm_CONFIGURE_COMPONENT_MESSAGES "${message_text}" in_list)
if(in_list EQUAL -1)
message(STATUS "${message_text}")
set(VTKm_CONFIGURE_COMPONENT_MESSAGES
${VTKm_CONFIGURE_COMPONENT_MESSAGES}
${message_text}
CACHE INTERNAL "" FORCE)
endif()
endif()
endfunction(vtkm_configure_component_message)
#-----------------------------------------------------------------------------
# Support function for making vtkm_configure_component<name> functions.
#-----------------------------------------------------------------------------
@ -61,9 +78,8 @@ macro(vtkm_finish_configure_component component)
foreach(var ${VTKm_FCC_DEPENDENT_VARIABLES})
if(NOT ${var})
set(VTKm_${component}_FOUND)
if(NOT VTKm_CONFIGURE_QUIET)
message(STATUS "Failed to configure VTK-m component ${component}: !${var}")
endif()
vtkm_configure_component_message(
"Failed to configure VTK-m component ${component}: !${var}")
break()
endif()
endforeach(var)
@ -105,7 +121,13 @@ macro(vtkm_configure_component_Serial)
endmacro(vtkm_configure_component_Serial)
macro(vtkm_configure_component_OpenGL)
vtkm_configure_component_Base()
# OpenGL configuration "depends" on OSMesa because if OSMesa is used, then it
# (sometimes) requires its own version of OpenGL. The find_package for OpenGL
# is smart enough to configure this correctly if OSMesa is found first. Thus,
# we ensure that OSMesa is configured before OpenGL (assuming you are using
# the VTK-m configuration). However, the OpenGL configuration can still
# succeed even if the OSMesa configuration fails.
vtkm_configure_component_OSMesa()
find_package(OpenGL ${VTKm_FIND_PACKAGE_QUIETLY})
@ -117,7 +139,7 @@ macro(vtkm_configure_component_OpenGL)
endmacro(vtkm_configure_component_OpenGL)
macro(vtkm_configure_component_OSMesa)
vtkm_configure_component_OpenGL()
vtkm_configure_component_Base()
if (UNIX AND NOT APPLE)
find_package(MESA ${VTKm_FIND_PACKAGE_QUIETLY})
@ -127,8 +149,8 @@ macro(vtkm_configure_component_OSMesa)
ADD_INCLUDES ${OSMESA_INCLUDE_DIR}
ADD_LIBRARIES ${OSMESA_LIBRARY}
)
elseif(NOT VTKm_CONFIGURE_QUIET)
message(STATUS "OSMesa not supported on this platform.")
else()
vtkm_configure_component_message("OSMesa not supported on this platform.")
endif()
endmacro(vtkm_configure_component_OSMesa)
@ -284,10 +306,9 @@ macro(vtkm_configure_component_CUDA)
set(VTKM_CUDA_NATIVE_EXE_PROCESS_RAN TRUE)
else()
set(VTKm_CUDA_Architecture "fermi")
if(NOT VTKm_CONFIGURE_QUIET)
message(STATUS "Unable to run \"${CUDA_NVCC_EXECUTABLE}\" to autodetect GPU architecture."
"Falling back to fermi, please manually specify if you want something else.")
endif()
vtkm_configure_component_message(
"Unable to run \"${CUDA_NVCC_EXECUTABLE}\" to autodetect GPU architecture.
Falling back to fermi, please manually specify if you want something else.")
endif()
endif()
endif()