From b63d696ac2f7cffa8c73b59812fffefacdb68d5a Mon Sep 17 00:00:00 2001 From: Michael Dolan Date: Sun, 12 Jul 2020 23:52:11 -0400 Subject: [PATCH] Clean up GPU/headless messaging Signed-off-by: Michael Dolan --- CMakeLists.txt | 60 ++++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7dca8c62bd..b2369569cb 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,24 +88,16 @@ option(OCIO_WARNING_AS_ERROR "Set build error level for CI testing" OFF) include(PackageUtils) if(OCIO_BUILD_GPU_TESTS OR OCIO_BUILD_APPS) - set(OCIO_GL_ENABLED ON) + set(OCIO_GL_ENABLED ON) + set(OCIO_USE_GLVND OFF) + set(OCIO_EGL_HEADLESS OFF) find_package(OpenGL COMPONENTS OpenGL) if(NOT OpenGL_OpenGL_FOUND AND NOT OPENGL_GLU_FOUND) package_root_message(OpenGL) - message(WARNING "OpenGL not found; GPU rendering disabled") set(OCIO_GL_ENABLED OFF) endif() - # OpenGL_egl_Library is defined iff GLVND is supported (CMake 10+). - if(OPENGL_egl_LIBRARY) - message(STATUS "GLVND supported") - set(OCIO_USE_GLVND ON) - else() - message(STATUS "GLVND not supported; legacy OpenGL libraries used") - set(OCIO_USE_GLVND OFF) - endif() - if(NOT APPLE) find_package(GLEW) if(NOT GLEW_FOUND) @@ -120,34 +112,40 @@ if(OCIO_BUILD_GPU_TESTS OR OCIO_BUILD_APPS) set(OCIO_GL_ENABLED OFF) endif() - set(OCIO_EGL_HEADLESS OFF) - if(${OCIO_USE_HEADLESS}) - if(CMAKE_SYSTEM_NAME STREQUAL Linux) - if(NOT ${OCIO_USE_GLVND}) - message(STATUS "Can't find EGL without GLVND support; can't render headlessly") - set(OCIO_USE_HEADLESS OFF) - set(OCIO_EGL_HEADLESS OFF) - else() - set(OCIO_EGL_HEADLESS ON) - find_package(OpenGL COMPONENTS EGL) - if(NOT OpenGL_EGL_FOUND) - message(WARNING "EGL component missing; can't render headlessly") + if(NOT OCIO_GL_ENABLED) + message(WARNING "GPU rendering disabled") + else() + # OpenGL_egl_Library is defined iff GLVND is supported (CMake 10+). + if(OPENGL_egl_LIBRARY) + message(STATUS "GLVND supported") + set(OCIO_USE_GLVND ON) + else() + message(STATUS "GLVND not supported; legacy OpenGL libraries used") + endif() + + if(OCIO_USE_HEADLESS) + if(CMAKE_SYSTEM_NAME STREQUAL Linux) + if(NOT OCIO_USE_GLVND) + message(STATUS "Can't find EGL without GLVND support; can't render headlessly") set(OCIO_USE_HEADLESS OFF) - set(OCIO_EGL_HEADLESS OFF) else() - add_compile_definitions(OCIO_HEADLESS_ENABLED) + find_package(OpenGL COMPONENTS EGL) + if(NOT OpenGL_EGL_FOUND) + message(WARNING "EGL component missing; can't render headlessly") + set(OCIO_USE_HEADLESS OFF) + else() + add_compile_definitions(OCIO_HEADLESS_ENABLED) + set(OCIO_EGL_HEADLESS ON) + message(STATUS "EGL enabled") + endif() endif() + else() + message(WARNING "OS system is not Linux; can't render headlessly") endif() - else() - message(WARNING "OS system is not Linux; can't render headlessly") - set(OCIO_EGL_HEADLESS OFF) endif() endif() endif() -message(STATUS "GL enabled " ${OCIO_GL_ENABLED}) -message(STATUS "EGL enabled " ${OCIO_EGL_HEADLESS}) - ############################################################################### # Optimization / internal linking preferences