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

This commit is contained in:
kestred 2013-12-09 00:11:39 -07:00
parent 90e4926b94
commit 693f7b39cf
3 changed files with 62 additions and 5 deletions

34
cmake/README.md Normal file
View File

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

View File

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

View File

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