mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-19 18:45:43 +00:00
Adding previous cmake fix.
This commit is contained in:
parent
9f32bbe0a7
commit
e3ccd7f86c
@ -18,6 +18,28 @@
|
||||
## this software.
|
||||
##============================================================================
|
||||
|
||||
if(NOT VTKm_ENABLE_RENDERING)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# determine what context(s) for rendering we want to build
|
||||
vtkm_option(VTKm_ENABLE_GL_CONTEXT "Enable GL context for vtkm rendering" OFF)
|
||||
if(UNIX AND NOT APPLE)
|
||||
vtkm_option(VTKm_ENABLE_OSMESA_CONTEXT "Enable OSMesa context for vtkm rendering" OFF)
|
||||
vtkm_option(VTKm_ENABLE_EGL_CONTEXT "Enable EGL context for vtkm rendering" OFF)
|
||||
mark_as_advanced(VTKm_ENABLE_OSMESA_CONTEXT)
|
||||
mark_as_advanced(VTKm_ENABLE_EGL_CONTEXT)
|
||||
endif()
|
||||
if(VTKm_ENABLE_GL_CONTEXT AND VTKm_ENABLE_OSMESA_CONTEXT)
|
||||
message(FATAL_ERROR "VTK-m GL and OSMesa contexts are mutually exclusive")
|
||||
endif()
|
||||
if(VTKm_ENABLE_GL_CONTEXT AND VTKm_ENABLE_EGL_CONTEXT)
|
||||
message(FATAL_ERROR "VTK-m GL and EGL contexts are mutually exclusive")
|
||||
endif()
|
||||
if(VTKm_ENABLE_EGL_CONTEXT AND VTKm_ENABLE_OSMESA_CONTEXT)
|
||||
message(FATAL_ERROR "VTK-m EGL and OSMesa contexts are mutually exclusive")
|
||||
endif()
|
||||
|
||||
set(headers
|
||||
Actor.h
|
||||
AxisAnnotation.h
|
||||
@ -89,6 +111,8 @@ set(sources
|
||||
raytracing/Logger.cxx
|
||||
)
|
||||
|
||||
# Note that EGL and OSMesa Canvas depend on the GL version being built. Only
|
||||
# the None backend supports not building the opengl version
|
||||
set(opengl_headers
|
||||
CanvasGL.h
|
||||
MapperGL.h
|
||||
@ -139,64 +163,43 @@ set(device_sources
|
||||
)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
vtkm_configure_component_OpenGL()
|
||||
if(VTKm_OpenGL_FOUND)
|
||||
list(APPEND headers ${opengl_headers})
|
||||
list(APPEND sources ${opengl_sources})
|
||||
|
||||
vtkm_configure_component_OSMesa()
|
||||
if(VTKm_OSMesa_FOUND)
|
||||
list(APPEND headers ${osmesa_headers})
|
||||
list(APPEND sources ${osmesa_sources})
|
||||
endif()
|
||||
|
||||
# vtkm_configure_component_EGL()
|
||||
# if(VTKm_EGL_FOUND)
|
||||
# list(APPEND headers ${egl_headers})
|
||||
# list(APPEND sources ${egl_sources})
|
||||
# endif()
|
||||
endif()
|
||||
|
||||
if(VTKm_ENABLE_OSMESA AND NOT VTKm_OSMesa_FOUND)
|
||||
message(SEND_ERROR "OSMesa was requested by not properly configured.
|
||||
Either make sure the OSMesa headers and library are properly found or set
|
||||
VTKm_ENABLE_OSMESA to OFF.")
|
||||
endif()
|
||||
|
||||
vtkm_declare_headers(${headers})
|
||||
|
||||
vtkm_library(
|
||||
NAME vtkm_rendering
|
||||
SOURCES ${sources}
|
||||
HEADERS ${headers}
|
||||
WRAP_FOR_CUDA ${device_sources}
|
||||
)
|
||||
|
||||
# EGL Libs are added here to ensure proper linking when statically compiling.
|
||||
# This is safe to do even when not using EGL as the values will then be empty.
|
||||
target_link_libraries(vtkm_rendering
|
||||
PUBLIC vtkm_cont
|
||||
PRIVATE ${VTKm_OPENGL_LIBRARIES}
|
||||
${VTKm_BACKEND_LIBRARIES}
|
||||
${EGL_LIBRARIES}
|
||||
)
|
||||
if(VTKm_ENABLE_GL_CONTEXT)
|
||||
vtkm_declare_headers(${opengl_headers})
|
||||
target_sources(vtkm_rendering PRIVATE ${opengl_sources})
|
||||
elseif(VTKm_ENABLE_OSMESA_CONTEXT)
|
||||
vtkm_declare_headers(${opengl_headers} ${osmesa_headers})
|
||||
target_sources(vtkm_rendering PRIVATE ${opengl_sources} ${osmesa_sources})
|
||||
elseif(VTKm_ENABLE_EGL_CONTEXT)
|
||||
vtkm_declare_headers(${opengl_headers} ${egl_headers})
|
||||
target_sources(vtkm_rendering PRIVATE ${opengl_sources} ${egl_sources})
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
target_link_libraries(vtkm_rendering PUBLIC vtkm_cont)
|
||||
|
||||
# EGL Dirs are added here to ensure proper linking when statically compiling.
|
||||
# This is safe to do even when not using EGL as the values will then be empty.
|
||||
target_include_directories(vtkm_rendering
|
||||
PRIVATE ${VTKm_OPENGL_INCLUDE_DIRS}
|
||||
${VTKm_BACKEND_INCLUDE_DIRS}
|
||||
${EGL_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_link_libraries(vtkm_rendering PRIVATE rt )
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
include(VTKmRenderingContexts)
|
||||
target_link_libraries(vtkm_rendering PUBLIC vtkm_rendering_gl_context)
|
||||
|
||||
# Subclasses need rendering library
|
||||
vtkm_configure_component_Rendering()
|
||||
|
||||
add_subdirectory(internal)
|
||||
add_subdirectory(raytracing)
|
||||
if(NOT VTKm_INSTALL_ONLY_LIBRARIES)
|
||||
install(TARGETS vtkm_rendering_gl_context
|
||||
EXPORT ${VTKm_EXPORT_NAME}
|
||||
)
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
add_subdirectory(internal)
|
||||
add_subdirectory(raytracing)
|
||||
add_subdirectory(testing)
|
||||
|
Loading…
Reference in New Issue
Block a user