Browse Source

CMake: Migrate over Nvidia Cg package detection

Sam Edwards 7 years ago
parent
commit
75366484b0
3 changed files with 27 additions and 30 deletions
  1. 0 12
      dtool/Config.cmake
  2. 0 18
      dtool/LocalSetup.cmake
  3. 27 0
      dtool/Package.cmake

+ 0 - 12
dtool/Config.cmake

@@ -475,18 +475,6 @@ option(HAVE_VIDEO4LINUX
   "Set this to enable webcam support on Linux." ${IS_LINUX})
 
 
-# Is Cg installed, and where?
-find_package(Cg QUIET)
-package_option(CG
-  "Enable support for Nvidia Cg Shading Language"
-  LICENSE "Nvidia")
-package_option(CGGL
-  "Enable support for Nvidia Cg's OpenGL API."
-  LICENSE "Nvidia")
-package_option(CGDX9 "Enable support for Nvidia Cg's DX9 API."
-  LICENSE "Nvidia")
-
-
 # Is VRPN installed, and where?
 find_package(VRPN QUIET)
 

+ 0 - 18
dtool/LocalSetup.cmake

@@ -189,24 +189,6 @@ endif()
 # Now go through all the packages and report whether we have them.
 show_packages()
 
-if(HAVE_CG)
-  message("+ Nvidia Cg High Level Shading Language")
-else()
-  message("- Did not find Nvidia Cg High Level Shading Language")
-endif()
-
-if(HAVE_CGGL)
-  message("+ Cg OpenGL API")
-else()
-  message("- Did not find Cg OpenGL API")
-endif()
-
-if(HAVE_CGDX9)
-  message("+ Cg DX9 API")
-else()
-  message("- Did not find Cg DX9 API")
-endif()
-
 if(HAVE_VRPN)
   message("+ VRPN")
 else()

+ 27 - 0
dtool/Package.cmake

@@ -96,6 +96,33 @@ package_option(SQUISH
 
 config_package(SQUISH "libsquish")
 
+#
+# ------------ Nvidia Cg ------------
+#
+
+find_package(Cg QUIET)
+
+package_option(CG
+  "Enable support for Nvidia Cg Shading Language"
+  LICENSE "Nvidia")
+package_option(CGGL
+  "Enable support for Nvidia Cg's OpenGL API."
+  LICENSE "Nvidia")
+package_option(CGDX9
+  "Enable support for Nvidia Cg's DirectX 9 API."
+  LICENSE "Nvidia")
+
+if(HAVE_CGGL AND HAVE_CGDX9)
+  set(cg_apis "supporting OpenGL and DirectX 9")
+elseif(HAVE_CGGL)
+  set(cg_apis "supporting OpenGL")
+elseif(HAVE_CGDX9)
+  set(cg_apis "supporting DirectX 9")
+else()
+  set(cg_apis "WITHOUT rendering backend support")
+endif()
+config_package(CG "Nvidia Cg Shading Language" "${cg_apis}")
+
 # Find and configure Miles Sound System
 find_package(Miles QUIET)
 #config_package(RAD_MSS "Miles Sound System")