Browse Source

CMake: Configure: Add option to enable or disable all packages.

kestred 12 years ago
parent
commit
693f7b39cf
3 changed files with 62 additions and 5 deletions
  1. 34 0
      cmake/README.md
  2. 18 5
      cmake/modules/ConfigurePackage.cmake
  3. 10 0
      dtool/Configure.cmake

+ 34 - 0
cmake/README.md

@@ -0,0 +1,34 @@
+Building with CMake
+-------------------
+
+The quickest way to build and install panda with CMake is to run:
+```sh
+cmake .
+make
+[sudo] make install
+```
+
+It is recommended to create a separate directory to build Panda3D:
+```sh
+mkdir build
+cd build/
+cmake ..
+make
+```
+
+To configure CMake, it is recommended to use cmake-gui (`cmake-gui .`),
+however it is also possible to configure it entirely through CMake's
+command-line interface; see `man cmake` for more details.
+
+All third-party libraries are enabled by default and Panda3D will
+be compiled with any 3rd party library that is found.
+Third-party libraries can be enabled or disabled through
+configuration with the cmake gui or cli.
+
+To quickly enable or disable all third-party libraries, run:
+```sh
+cmake -DEVERYTHING=True .  # or .. if you are in a separate build/ dir
+# OR
+cmake -DNOTHING=True .  # or .. if you are in a separate build/ dir
+```
+

+ 18 - 5
cmake/modules/ConfigurePackage.cmake

@@ -48,12 +48,23 @@ function(config_package PKG_NAME)
 
 
 	if(FOUND_${PKG_NAME})
 	if(FOUND_${PKG_NAME})
 		# Output success after finding the package for the first time
 		# Output success after finding the package for the first time
-		if(NOT DEFINED USE_${PKG_NAME})
+		if(NOT DEFINED USE_${PKG_NAME} AND NOT DISABLE_EVERYTHING)
 			message(STATUS "+ ${DISPLAY_NAME}")
 			message(STATUS "+ ${DISPLAY_NAME}")
 		endif()
 		endif()
 
 
-		# Add a USE_XYZZY config variable to the cache
-		set(USE_${PKG_NAME} TRUE CACHE BOOL "If true, compile Panda3D with ${DISPLAY_NAME}")
+		### Add a USE_XYZZY config variable to the cache ###
+		if(ENABLE_EVERYTHING OR DISABLE_EVERYTHING)
+			unset(USE_${PKG_NAME} CACHE)
+		endif()
+
+		if(DISABLE_EVERYTHING)
+			set(USE_${PKG_NAME} FALSE CACHE BOOL "If true, compile Panda3D with ${DISPLAY_NAME}")
+		else()
+			set(USE_${PKG_NAME} TRUE CACHE BOOL "If true, compile Panda3D with ${DISPLAY_NAME}")
+		endif()
+
+
+		# Update HAVE_XYZZY
 		if(USE_${PKG_NAME})
 		if(USE_${PKG_NAME})
 			set(HAVE_${PKG_NAME} TRUE PARENT_SCOPE)
 			set(HAVE_${PKG_NAME} TRUE PARENT_SCOPE)
 		endif()
 		endif()
@@ -71,6 +82,8 @@ function(config_package PKG_NAME)
 
 
 	else()
 	else()
 		# Output failure to find package
 		# Output failure to find package
-		message(STATUS "- Did not find ${DISPLAY_NAME}")
+		if(NOT DISABLE_EVERYTHING)
+			message(STATUS "- Did not find ${DISPLAY_NAME}")
+		endif()
 	endif()
 	endif()
-endfunction()
+endfunction()

+ 10 - 0
dtool/Configure.cmake

@@ -1,6 +1,16 @@
 message(STATUS "")
 message(STATUS "")
 message("Configuring support for the following optional third-party packages:")
 message("Configuring support for the following optional third-party packages:")
 
 
+set(ENABLE_EVERYTHING Off)
+set(DISABLE_EVERYTHING Off)
+if(EVERYTHING)
+	message("Re-enabling all disabled third-party libraries.")
+	set(ENABLE_EVERYTHING On)
+elseif(NOTHING)
+	message("Disabling all third-party libraries.")
+	set(DISABLE_EVERYTHING On)
+endif()
+
 include(ConfigurePackage)
 include(ConfigurePackage)
 
 
 # Find and configure Eigen library
 # Find and configure Eigen library