Pārlūkot izejas kodu

CMake: Detect OpenGL (and SpeedTree) the proper way

Sam Edwards 7 gadi atpakaļ
vecāks
revīzija
cfb32fad84
3 mainītis faili ar 28 papildinājumiem un 27 dzēšanām
  1. 0 5
      dtool/Config.cmake
  2. 0 12
      dtool/LocalSetup.cmake
  3. 28 10
      dtool/Package.cmake

+ 0 - 5
dtool/Config.cmake

@@ -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

+ 0 - 12
dtool/LocalSetup.cmake

@@ -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()

+ 28 - 10
dtool/Package.cmake

@@ -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")