Skip to content

Commit

Permalink
Merge branch 'opengl-option' into 'master'
Browse files Browse the repository at this point in the history
cmake: Add tiff-opengl option

See merge request libtiff/libtiff!340
  • Loading branch information
rleigh-codelibre committed Jun 4, 2022
2 parents ce539dc + b63e406 commit 560f1b0
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -197,5 +197,5 @@ message(STATUS "")
message(STATUS " C++ support: ${cxx} (requested) ${CXX_SUPPORT} (availability)")
message(STATUS "")
# message(STATUS " X Athena Widgets support: ${HAVE_XAW}")
message(STATUS " OpenGL support: ${HAVE_OPENGL}")
message(STATUS " OpenGL support: Requested:${tiff-opengl} Availability:${HAVE_OPENGL} Support:${OPENGL_SUPPORT}")
message(STATUS "")
7 changes: 7 additions & 0 deletions cmake/OpenGLChecks.cmake
Expand Up @@ -29,6 +29,7 @@ set(OpenGL_GL_PREFERENCE LEGACY)
find_package(OpenGL COMPONENTS OpenGL)
find_package(GLUT)

set(OPENGL_SUPPORT FALSE)
set(HAVE_OPENGL FALSE)
if(OPENGL_FOUND AND OPENGL_GLU_FOUND AND GLUT_FOUND)
set(HAVE_OPENGL TRUE)
Expand All @@ -41,3 +42,9 @@ check_include_file(GL/glut.h HAVE_GL_GLUT_H)
check_include_file(GLUT/glut.h HAVE_GLUT_GLUT_H)
check_include_file(OpenGL/gl.h HAVE_OPENGL_GL_H)
check_include_file(OpenGL/glu.h HAVE_OPENGL_GLU_H)

option(tiff-opengl "use OpenGL (required for tiffgt viewer)" ${HAVE_OPENGL})

if (tiff-opengl AND HAVE_OPENGL)
set(OPENGL_SUPPORT TRUE)
endif()
28 changes: 17 additions & 11 deletions configure.ac
Expand Up @@ -927,22 +927,28 @@ dnl ---------------------------------------------------------------------------

HAVE_OPENGL=no

AC_ARG_ENABLE(opengl,
AS_HELP_STRING([--disable-opengl],
[disable OpenGL usage (required by tiffgt, enabled by default)]),,)

AC_PATH_XTRA
if test "x$enable_opengl" != "xno" ; then

dnl AX_CHECK_GL sets GL_CFLAGS & GL_LIBS. Also PTHREAD_LIBS,
dnl PTHREAD_CFLAGS, & PTHREAD_CC as a side-effect
AX_CHECK_GL
AC_PATH_XTRA

dnl AX_CHECK_GLU sets GLU_CFLAGS & GLU_LIBS
AX_CHECK_GLU
dnl AX_CHECK_GL sets GL_CFLAGS & GL_LIBS. Also PTHREAD_LIBS,
dnl PTHREAD_CFLAGS, & PTHREAD_CC as a side-effect
AX_CHECK_GL

dnl AX_CHECK_GLUT sets GLUT_CFLAGS & GLUT_LIBS
AX_CHECK_GLUT
dnl AX_CHECK_GLU sets GLU_CFLAGS & GLU_LIBS
AX_CHECK_GLU

if test "$no_x" != "yes" -a "$no_gl" != "yes" \
-a "$no_glu" != "yes" -a "$no_glut" != "yes" ; then
HAVE_OPENGL=yes
dnl AX_CHECK_GLUT sets GLUT_CFLAGS & GLUT_LIBS
AX_CHECK_GLUT

if test "$no_x" != "yes" -a "$no_gl" != "yes" \
-a "$no_glu" != "yes" -a "$no_glut" != "yes" ; then
HAVE_OPENGL=yes
fi
fi

AM_CONDITIONAL(HAVE_OPENGL, test "$HAVE_OPENGL" = "yes")
Expand Down
2 changes: 1 addition & 1 deletion tools/CMakeLists.txt
Expand Up @@ -124,7 +124,7 @@ install(TARGETS fax2ps
tiffsplit
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")

if(HAVE_OPENGL)
if(OPENGL_SUPPORT)
add_executable(tiffgt ../placeholder.h)
target_sources(tiffgt PRIVATE tiffgt.c)
target_link_libraries(tiffgt PRIVATE tiff port)
Expand Down

0 comments on commit 560f1b0

Please sign in to comment.