CMake: Detect OpenGL (and SpeedTree) the proper way

This commit is contained in:
Sam Edwards 2018-09-22 15:55:03 -06:00
parent bd187643f3
commit cfb32fad84
3 changed files with 28 additions and 27 deletions

View File

@ -419,11 +419,6 @@ option(HAVE_VIDEO4LINUX
"Set this to enable webcam support on Linux." ${IS_LINUX})
# Is OpenGL installed, and where?
find_package(OpenGL QUIET)
set(GL_FOUND ${OPENGL_FOUND})
package_option(GL "Enable OpenGL support.")
# If you are having trouble linking in OpenGL extension functions at
# runtime for some reason, you can set this variable. It also,
# requires you to install the OpenGL header files and compile-time

View File

@ -155,24 +155,12 @@ endif()
# Now go through all the packages and report whether we have them.
show_packages()
if(HAVE_SPEEDTREE)
message("+ SpeedTree")
else()
message("- Did not find SpeedTree")
endif()
if(HAVE_GTK2)
message("+ gtk+-2")
else()
message("- Did not find gtk+-2")
endif()
if(HAVE_GL)
message("+ OpenGL")
else()
message("- Did not find OpenGL")
endif()
if(HAVE_GLES)
message("+ OpenGL ES 1")
else()

View File

@ -315,25 +315,43 @@ config_package(ODE "Open Dynamics Engine")
# PhysX
find_package(PhysX QUIET)
package_option(PhysX
package_option(PHYSX
"Enable this option to support game dynamics with Nvidia PhysX."
LICENSE "Nvidia")
config_package(PhysX "Nvidia PhysX")
config_package(PHYSX "Nvidia PhysX")
#
# ------------ SpeedTree ------------
#
# SpeedTree
find_package(SpeedTree QUIET)
package_option(SPEEDTREE
"Enable this option to include scenegraph support for SpeedTree trees."
LICENSE "SpeedTree")
config_package(SPEEDTREE "SpeedTree")
#
# ------------ Rendering APIs ------------
#
# OpenGL
find_package(OpenGL QUIET)
package_option(GL
"Enable OpenGL support."
FOUND_AS OPENGL
IMPORTED_AS OpenGL::GL)
config_package(GL "OpenGL")
########
# TODO #
########
# Find and configure PhysX
#find_package(PhysX)
#config_package(PHYSX "Aegia PhysX")
# Find and configure SpeedTree
#find_package(SpeedTree)
#config_package(SPEEDTREE "SpeedTree")
# Find and configure OpenGL ES 1
#find_package(GLES)
#config_package(GLES COMMENT "OpenGL ES 1")