From 693f7b39cff6b5b197c6b38c31d9117a154df4a8 Mon Sep 17 00:00:00 2001 From: kestred Date: Mon, 9 Dec 2013 00:11:39 -0700 Subject: [PATCH] CMake: Configure: Add option to enable or disable all packages. --- cmake/README.md | 34 ++++++++++++++++++++++++++++ cmake/modules/ConfigurePackage.cmake | 23 +++++++++++++++---- dtool/Configure.cmake | 10 ++++++++ 3 files changed, 62 insertions(+), 5 deletions(-) create mode 100644 cmake/README.md diff --git a/cmake/README.md b/cmake/README.md new file mode 100644 index 0000000000..abbad32fa4 --- /dev/null +++ b/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 +``` + diff --git a/cmake/modules/ConfigurePackage.cmake b/cmake/modules/ConfigurePackage.cmake index da5fe23bac..52793c862c 100644 --- a/cmake/modules/ConfigurePackage.cmake +++ b/cmake/modules/ConfigurePackage.cmake @@ -48,12 +48,23 @@ function(config_package PKG_NAME) if(FOUND_${PKG_NAME}) # 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}") 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}) set(HAVE_${PKG_NAME} TRUE PARENT_SCOPE) endif() @@ -71,6 +82,8 @@ function(config_package PKG_NAME) else() # 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() -endfunction() \ No newline at end of file +endfunction() diff --git a/dtool/Configure.cmake b/dtool/Configure.cmake index b386d1c620..591f332cd7 100644 --- a/dtool/Configure.cmake +++ b/dtool/Configure.cmake @@ -1,6 +1,16 @@ message(STATUS "") 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) # Find and configure Eigen library