Commit 5d72b53a authored by Andrew Bauer's avatar Andrew Bauer
Browse files

WIP: making a single OSMESA_LIBRARIES for target

parent 540eedf8
Pipeline #86106 failed with stage
# Try to find Mesa off-screen library and include dir.
# Once done this will define
#
# OSMESA_FOUND - true if OSMesa has been found
# OSMESA_INCLUDE_DIR - where the GL/osmesa.h can be found
# OSMESA_LIBRARY - Link this to use OSMesa
# OSMESA_EXTRA_LIBRARIES - If OSMesa was built statically this allows
# linking with the glapi and LLVM libraries
# which may be needed
# OSMESA_FOUND - true if OSMesa has been found
# OSMESA_INCLUDE_DIR - where the GL/osmesa.h can be found
# OSMESA_LIBRARIES - Link this to use OSMesa. If OSMesa was built
# statically there may be a dependency on
# the glapi and LLVM libraries.
set(OSMESA_LIBRARIES)
if(NOT OSMESA_INCLUDE_DIR)
# If we have a root defined look there first
......@@ -44,8 +45,8 @@ if(NOT OSMESA_LIBRARY)
endif()
endif()
set(OSMESA_EXTRA_LIBRARIES z)
if(OSMESA_LIBRARY)
list(APPEND OSMESA_LIBRARIES ${OSMESA_LIBRARY} z)
# check to see if OSMesa library ends in .a to see if we need to possibly also
# link with glapi and LLVM-4.0.0 libraries.
get_filename_component(OSMESA_LIBRARY_EXT ${OSMESA_LIBRARY} EXT)
......@@ -55,14 +56,13 @@ if(OSMESA_LIBRARY)
find_library(GLAPI_LIBRARY NAMES glapi PATHS ${OSMESA_LIBRARY_DIR} NO_DEFAULT_PATH)
mark_as_advanced(LLVM_LIBRARY GLAPI_LIBRARY)
if(LLVM_LIBRARY AND GLAPI_LIBRARY)
list(APPEND OSMESA_EXTRA_LIBRARIES ${LLVM_LIBRARY} ${GLAPI_LIBRARY})
list(APPEND OSMESA_LIBRARIES ${LLVM_LIBRARY} ${GLAPI_LIBRARY})
endif()
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OSMesa DEFAULT_MSG OSMESA_LIBRARY
OSMESA_EXTRA_LIBRARIES OSMESA_INCLUDE_DIR)
find_package_handle_standard_args(OSMesa DEFAULT_MSG OSMESA_LIBRARIES OSMESA_INCLUDE_DIR)
mark_as_advanced(OSMESA_INCLUDE_DIR OSMESA_LIBRARY)
......@@ -146,7 +146,7 @@ endif()
# Function to link a VTK target to the necessary OpenGL libraries.
function(vtk_opengl_link target)
if(VTK_OPENGL_HAS_OSMESA)
vtk_module_link_libraries(${target} LINK_PRIVATE ${OSMESA_LIBRARY} ${OSMESA_EXTRA_LIBRARIES})
vtk_module_link_libraries(${target} LINK_PRIVATE ${OSMESA_LIBRARIES})
endif()
if(VTK_OPENGL_HAS_EGL)
vtk_module_link_libraries(${target} LINK_PRIVATE EGL::EGL)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment