Browse Source

CMake: Organize Package.cmake a bit better

Sam Edwards 7 years ago
parent
commit
c3f9fdf778
1 changed files with 112 additions and 108 deletions
  1. 112 108
      dtool/Package.cmake

+ 112 - 108
dtool/Package.cmake

@@ -80,36 +80,12 @@ if(HAVE_PYTHON)
     "Suffix for Python binary extension modules.")
 endif()
 
-#
-# ------------ Eigen ------------
-#
-find_package(Eigen3 QUIET)
-
-package_option(EIGEN
-  "Enables experimental support for the Eigen linear algebra library.
-If this is provided, Panda will use this library as the fundamental
-implementation of its own linmath library; otherwise, it will use
-its own internal implementation.  The primary advantage of using
-Eigen is SSE2 support, which is only activated if LINMATH_ALIGN
-is also enabled."
-  FOUND_AS EIGEN3
-  LICENSE "MPL-2")
-
-option(LINMATH_ALIGN
-  "This is required for activating SSE2 support using Eigen.
-Activating this does constrain most objects in Panda to 16-byte
-alignment, which could impact memory usage on very-low-memory
-platforms.  Currently experimental." ON)
-
-if(LINMATH_ALIGN)
-  package_status(EIGEN "Eigen linear algebra library" "vectorization enabled in build")
-else()
-  package_status(EIGEN "Eigen linear algebra library" "vectorization NOT enabled in build")
-endif()
 
 #
-# ------------ OpenSSL ------------
+# ------------ Data handling libraries ------------
 #
+
+# OpenSSL
 find_package(OpenSSL COMPONENTS SSL Crypto QUIET)
 
 package_option(OPENSSL
@@ -127,16 +103,26 @@ else()
   package_status(OPENSSL "OpenSSL")
 endif()
 
+# zlib
+find_package(ZLIB QUIET)
+
+package_option(ZLIB
+  "Enables support for compression of Panda assets."
+  IMPORTED_AS ZLIB::ZLIB)
+
+package_status(ZLIB "zlib")
+
+
 #
-# ------------ IMAGE FORMATS ------------
+# ------------ Image formats ------------
 #
 
-# JPEG:
+# JPEG
 find_package(JPEG QUIET)
 package_option(JPEG DEFAULT ON "Enable support for loading .jpg images.")
 package_status(JPEG "libjpeg")
 
-# PNG:
+# PNG
 find_package(PNG QUIET)
 package_option(PNG
   DEFAULT ON
@@ -144,43 +130,17 @@ package_option(PNG
   IMPORTED_AS PNG::PNG)
 package_status(PNG "libpng")
 
-# TIFF:
+# TIFF
 find_package(TIFF QUIET)
 package_option(TIFF "Enable support for loading .tif images.")
 package_status(TIFF "libtiff")
 
-# OpenEXR:
+# OpenEXR
 find_package(OpenEXR QUIET)
 package_option(OPENEXR "Enable support for loading .exr images.")
 package_status(OPENEXR "OpenEXR")
 
-#
-# ------------ LIBTAR ------------
-#
-find_package(Tar QUIET)
-package_option(TAR
-  "This is used to optimize patch generation against tar files.")
-package_status(TAR "libtar")
-
-#
-# ------------ FFTW ------------
-#
-
-find_package(FFTW3 QUIET)
-
-package_option(FFTW
-  "This enables support for compression of animations in .bam files.
-  This is only necessary for creating or reading .bam files containing
-  compressed animations."
-  FOUND_AS "FFTW3"
-  LICENSE "GPL")
-
-package_status(FFTW "FFTW")
-
-#
-# ------------ libsquish ------------
-#
-
+# libsquish
 find_package(LibSquish QUIET)
 
 package_option(SQUISH
@@ -189,61 +149,65 @@ package_option(SQUISH
 
 package_status(SQUISH "libsquish")
 
+
 #
-# ------------ Nvidia Cg ------------
+# ------------ Archival formats ------------
 #
 
-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(CGD3D9
-  "Enable support for Nvidia Cg's Direct3D 9 API."
-  LICENSE "Nvidia")
+# libtar
+find_package(Tar QUIET)
+package_option(TAR
+  "This is used to optimize patch generation against tar files.")
+package_status(TAR "libtar")
 
-if(HAVE_CGGL AND HAVE_CGD3D9)
-  set(cg_apis "supporting OpenGL and Direct3D 9")
-elseif(HAVE_CGGL)
-  set(cg_apis "supporting OpenGL")
-elseif(HAVE_CGDX9)
-  set(cg_apis "supporting Direct3D 9")
-else()
-  set(cg_apis "WITHOUT rendering backend support")
-endif()
-package_status(CG "Nvidia Cg Shading Language" "${cg_apis}")
 
 #
-# ------------ VRPN ------------
+# ------------ Math libraries ------------
 #
 
-find_package(VRPN QUIET)
+# Eigen
+find_package(Eigen3 QUIET)
 
-package_option(VRPN
-  "Enables support for connecting to VRPN servers. This is only needed if you
-  are building Panda3D for a fixed VRPN-based VR installation.")
+package_option(EIGEN
+  "Enables experimental support for the Eigen linear algebra library.
+If this is provided, Panda will use this library as the fundamental
+implementation of its own linmath library; otherwise, it will use
+its own internal implementation.  The primary advantage of using
+Eigen is SSE2 support, which is only activated if LINMATH_ALIGN
+is also enabled."
+  FOUND_AS EIGEN3
+  LICENSE "MPL-2")
 
-package_status(VRPN "VRPN")
+option(LINMATH_ALIGN
+  "This is required for activating SSE2 support using Eigen.
+Activating this does constrain most objects in Panda to 16-byte
+alignment, which could impact memory usage on very-low-memory
+platforms.  Currently experimental." ON)
 
-#
-# ------------ zlib ------------
-#
+if(LINMATH_ALIGN)
+  package_status(EIGEN "Eigen linear algebra library" "vectorization enabled in build")
+else()
+  package_status(EIGEN "Eigen linear algebra library" "vectorization NOT enabled in build")
+endif()
 
-find_package(zlib QUIET)
+# FFTW
+find_package(FFTW3 QUIET)
 
-package_option(ZLIB
-  "Enables support for compression of Panda assets."
-  IMPORTED_AS ZLIB::ZLIB)
+package_option(FFTW
+  "This enables support for compression of animations in .bam files.
+  This is only necessary for creating or reading .bam files containing
+  compressed animations."
+  FOUND_AS "FFTW3"
+  LICENSE "GPL")
+
+package_status(FFTW "FFTW")
 
-package_status(ZLIB "zlib")
 
 #
-# ------------ FFmpeg ------------
+# ------------ Multimedia formats ------------
 #
 
+# FFmpeg
 find_package(FFMPEG QUIET)
 find_package(SWScale QUIET)
 find_package(SWResample QUIET)
@@ -333,13 +297,13 @@ package_status(HARFBUZZ "HarfBuzz")
 
 # GTK2
 
-# Find and configure GTK
 set(Freetype_FIND_QUIETLY TRUE) # Fix for builtin FindGTK2
 set(GTK2_GTK_FIND_QUIETLY TRUE) # Fix for builtin FindGTK2
 find_package(GTK2 QUIET COMPONENTS gtk)
 package_option(GTK2)
 package_status(GTK2 "gtk+-2")
 
+
 #
 # ------------ Physics engines ------------
 #
@@ -371,6 +335,7 @@ package_option(PHYSX
 
 package_status(PHYSX "Nvidia PhysX")
 
+
 #
 # ------------ SpeedTree ------------
 #
@@ -384,6 +349,7 @@ package_option(SPEEDTREE
 
 package_status(SPEEDTREE "SpeedTree")
 
+
 #
 # ------------ Rendering APIs ------------
 #
@@ -416,11 +382,45 @@ package_option(GLES2
 
 package_status(GLES2 "OpenGL ES 2.x")
 
+# Direct3D 9
+find_package(Direct3D9 QUIET COMPONENTS dxguid dxerr d3dx9)
+
+package_option(DX9
+  "Enable support for DirectX 9.  This is typically only viable on Windows."
+  FOUND_AS DIRECT3D9)
+
+package_status(DX9 "Direct3D 9.x")
+
+# 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(CGD3D9
+  "Enable support for Nvidia Cg's Direct3D 9 API."
+  LICENSE "Nvidia")
+
+if(HAVE_CGGL AND HAVE_CGD3D9)
+  set(cg_apis "supporting OpenGL and Direct3D 9")
+elseif(HAVE_CGGL)
+  set(cg_apis "supporting OpenGL")
+elseif(HAVE_CGDX9)
+  set(cg_apis "supporting Direct3D 9")
+else()
+  set(cg_apis "WITHOUT rendering backend support")
+endif()
+package_status(CG "Nvidia Cg Shading Language" "${cg_apis}")
+
+
 #
 # ------------ Display APIs ------------
 #
 
-# X11
+# X11 (and GLX)
 find_package(X11 QUIET)
 
 if(NOT X11_Xkb_FOUND OR NOT X11_Xutil_FOUND)
@@ -458,16 +458,6 @@ package_option(EGL
 
 package_status(EGL "EGL")
 
-# Direct3D 9
-
-find_package(Direct3D9 QUIET COMPONENTS dxguid dxerr d3dx9)
-
-package_option(DX9
-  "Enable support for DirectX 9.  This is typically only viable on Windows."
-  FOUND_AS DIRECT3D9)
-
-package_status(DX9 "Direct3D 9.x")
-
 #
 # ------------ Vision tools ------------
 #
@@ -488,3 +478,17 @@ package_option(ARTOOLKIT
   "Enable support for ARToolKit.  This will be built into the 'vision' package.")
 
 package_status(ARTOOLKIT "ARToolKit")
+
+
+#
+# ------------ VR integration ------------
+#
+
+# VRPN
+find_package(VRPN QUIET)
+
+package_option(VRPN
+  "Enables support for connecting to VRPN servers.  This is only needed if you
+  are building Panda3D for a fixed VRPN-based VR installation.")
+
+package_status(VRPN "VRPN")