mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-27 15:25:54 -04:00
CMake: Don't assume <PackageName>_FOUND will always be caps
This is more consistent with the new find_package() behavior, especially when CONFIG mode is involved.
This commit is contained in:
parent
cdc16291dd
commit
74e9c610d3
@ -76,6 +76,8 @@ function(package_option name)
|
|||||||
set(license "")
|
set(license "")
|
||||||
set(cache_string)
|
set(cache_string)
|
||||||
|
|
||||||
|
string(TOUPPER "${name}" name)
|
||||||
|
|
||||||
foreach(arg ${ARGN})
|
foreach(arg ${ARGN})
|
||||||
if(command STREQUAL "DEFAULT")
|
if(command STREQUAL "DEFAULT")
|
||||||
set(default "${arg}")
|
set(default "${arg}")
|
||||||
@ -207,16 +209,26 @@ function(package_option name)
|
|||||||
endforeach(implib)
|
endforeach(implib)
|
||||||
|
|
||||||
if(use_variables)
|
if(use_variables)
|
||||||
if(${found_as}_INCLUDE_DIRS)
|
string(TOUPPER "${found_as}" FOUND_AS)
|
||||||
|
|
||||||
|
if(DEFINED ${found_as}_INCLUDE_DIRS)
|
||||||
set(includes ${${found_as}_INCLUDE_DIRS})
|
set(includes ${${found_as}_INCLUDE_DIRS})
|
||||||
else()
|
elseif(DEFINED ${found_as}_INCLUDE_DIR)
|
||||||
set(includes "${${found_as}_INCLUDE_DIR}")
|
set(includes "${${found_as}_INCLUDE_DIR}")
|
||||||
|
elseif(DEFINED ${FOUND_AS}_INCLUDE_DIRS)
|
||||||
|
set(includes ${${FOUND_AS}_INCLUDE_DIRS})
|
||||||
|
else()
|
||||||
|
set(includes "${${FOUND_AS}_INCLUDE_DIR}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(${found_as}_LIBRARIES)
|
if(DEFINED ${found_as}_LIBRARIES)
|
||||||
set(libs ${${found_as}_LIBRARIES})
|
set(libs ${${found_as}_LIBRARIES})
|
||||||
else()
|
elseif(DEFINED ${found_as}_LIBRARY)
|
||||||
set(libs "${${found_as}_LIBRARY}")
|
set(libs "${${found_as}_LIBRARY}")
|
||||||
|
elseif(DEFINED ${FOUND_AS}_LIBRARIES)
|
||||||
|
set(libs ${${FOUND_AS}_LIBRARIES})
|
||||||
|
else()
|
||||||
|
set(libs "${${FOUND_AS}_LIBRARY}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(PKG::${name} INTERFACE ${libs})
|
target_link_libraries(PKG::${name} INTERFACE ${libs})
|
||||||
@ -239,6 +251,8 @@ function(package_status name desc)
|
|||||||
set(note "${arg}")
|
set(note "${arg}")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
string(TOUPPER "${name}" name)
|
||||||
|
|
||||||
if(NOT ";${_ALL_PACKAGE_OPTIONS};" MATCHES ";${name};")
|
if(NOT ";${_ALL_PACKAGE_OPTIONS};" MATCHES ";${name};")
|
||||||
message(SEND_ERROR "package_status(${name}) was called before package_option(${name}).
|
message(SEND_ERROR "package_status(${name}) was called before package_option(${name}).
|
||||||
This is a bug in the cmake build scripts.")
|
This is a bug in the cmake build scripts.")
|
||||||
@ -481,18 +495,12 @@ macro(find_package name)
|
|||||||
_find_package(${ARGV})
|
_find_package(${ARGV})
|
||||||
|
|
||||||
else()
|
else()
|
||||||
string(TOUPPER "${name}" __pkgname_upper)
|
|
||||||
|
|
||||||
# Try CONFIG
|
# Try CONFIG
|
||||||
_find_package("${name}" CONFIG ${ARGN})
|
_find_package("${name}" CONFIG ${ARGN})
|
||||||
|
|
||||||
if(NOT ${name}_FOUND)
|
if(NOT ${name}_FOUND)
|
||||||
# CONFIG didn't work, fall back to MODULE
|
# CONFIG didn't work, fall back to MODULE
|
||||||
_find_package("${name}" MODULE ${ARGN})
|
_find_package("${name}" MODULE ${ARGN})
|
||||||
|
|
||||||
else()
|
|
||||||
# Case-sensitivity
|
|
||||||
set(${__pkgname_upper}_FOUND 1)
|
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endmacro(find_package)
|
endmacro(find_package)
|
||||||
|
@ -226,7 +226,7 @@ if(CMAKE_VERSION VERSION_LESS "3.15")
|
|||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
package_option(PYTHON
|
package_option(Python
|
||||||
DEFAULT ON
|
DEFAULT ON
|
||||||
"Enables support for Python. If INTERROGATE_PYTHON_INTERFACE
|
"Enables support for Python. If INTERROGATE_PYTHON_INTERFACE
|
||||||
is also enabled, Python bindings will be generated."
|
is also enabled, Python bindings will be generated."
|
||||||
@ -309,7 +309,7 @@ set(_PREV_WANT_PYTHON_VERSION "${WANT_PYTHON_VERSION}" CACHE INTERNAL "Internal.
|
|||||||
# OpenSSL
|
# OpenSSL
|
||||||
find_package(OpenSSL COMPONENTS SSL Crypto QUIET)
|
find_package(OpenSSL COMPONENTS SSL Crypto QUIET)
|
||||||
|
|
||||||
package_option(OPENSSL
|
package_option(OpenSSL
|
||||||
DEFAULT ON
|
DEFAULT ON
|
||||||
"Enable OpenSSL support"
|
"Enable OpenSSL support"
|
||||||
IMPORTED_AS OpenSSL::SSL OpenSSL::Crypto)
|
IMPORTED_AS OpenSSL::SSL OpenSSL::Crypto)
|
||||||
@ -319,9 +319,9 @@ option(REPORT_OPENSSL_ERRORS
|
|||||||
error messages when they occur." ${IS_DEBUG_BUILD})
|
error messages when they occur." ${IS_DEBUG_BUILD})
|
||||||
|
|
||||||
if(REPORT_OPENSSL_ERRORS)
|
if(REPORT_OPENSSL_ERRORS)
|
||||||
package_status(OPENSSL "OpenSSL" "with verbose error reporting")
|
package_status(OpenSSL "OpenSSL" "with verbose error reporting")
|
||||||
else()
|
else()
|
||||||
package_status(OPENSSL "OpenSSL")
|
package_status(OpenSSL "OpenSSL")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# zlib
|
# zlib
|
||||||
@ -364,16 +364,16 @@ package_status(TIFF "libtiff")
|
|||||||
# OpenEXR
|
# OpenEXR
|
||||||
find_package(OpenEXR QUIET)
|
find_package(OpenEXR QUIET)
|
||||||
|
|
||||||
package_option(OPENEXR "Enable support for loading .exr images.")
|
package_option(OpenEXR "Enable support for loading .exr images.")
|
||||||
|
|
||||||
package_status(OPENEXR "OpenEXR")
|
package_status(OpenEXR "OpenEXR")
|
||||||
|
|
||||||
# libsquish
|
# libsquish
|
||||||
find_package(LibSquish QUIET)
|
find_package(LibSquish QUIET)
|
||||||
|
|
||||||
package_option(SQUISH
|
package_option(SQUISH
|
||||||
"Enables support for automatic compression of DXT textures."
|
"Enables support for automatic compression of DXT textures."
|
||||||
FOUND_AS LIBSQUISH)
|
FOUND_AS LibSquish)
|
||||||
|
|
||||||
package_status(SQUISH "libsquish")
|
package_status(SQUISH "libsquish")
|
||||||
|
|
||||||
@ -385,19 +385,19 @@ package_status(SQUISH "libsquish")
|
|||||||
# Assimp
|
# Assimp
|
||||||
find_package(Assimp QUIET)
|
find_package(Assimp QUIET)
|
||||||
|
|
||||||
package_option(ASSIMP
|
package_option(Assimp
|
||||||
"Build pandatool with support for loading 3D assets supported by Assimp.")
|
"Build pandatool with support for loading 3D assets supported by Assimp.")
|
||||||
|
|
||||||
package_status(ASSIMP "Assimp")
|
package_status(Assimp "Assimp")
|
||||||
|
|
||||||
# FCollada
|
# FCollada
|
||||||
find_package(FCollada QUIET)
|
find_package(FCollada QUIET)
|
||||||
|
|
||||||
package_option(FCOLLADA
|
package_option(FCollada
|
||||||
"Build pandatool with support for loading Collada files using FCollada."
|
"Build pandatool with support for loading Collada files using FCollada."
|
||||||
IMPORTED_AS FCollada::FCollada)
|
IMPORTED_AS FCollada::FCollada)
|
||||||
|
|
||||||
package_status(FCOLLADA "FCollada")
|
package_status(FCollada "FCollada")
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -414,7 +414,7 @@ implementation of its own linmath library; otherwise, it will use
|
|||||||
its own internal implementation. The primary advantage of using
|
its own internal implementation. The primary advantage of using
|
||||||
Eigen is SSE2 support, which is only activated if LINMATH_ALIGN
|
Eigen is SSE2 support, which is only activated if LINMATH_ALIGN
|
||||||
is also enabled."
|
is also enabled."
|
||||||
FOUND_AS EIGEN3
|
FOUND_AS Eigen3
|
||||||
LICENSE "MPL-2")
|
LICENSE "MPL-2")
|
||||||
|
|
||||||
option(LINMATH_ALIGN
|
option(LINMATH_ALIGN
|
||||||
@ -456,9 +456,9 @@ find_package(SWResample QUIET)
|
|||||||
|
|
||||||
package_option(FFMPEG
|
package_option(FFMPEG
|
||||||
"Enables support for audio- and video-decoding using the FFmpeg library.")
|
"Enables support for audio- and video-decoding using the FFmpeg library.")
|
||||||
package_option(SWSCALE
|
package_option(SWScale
|
||||||
"Enables support for FFmpeg's libswscale for video rescaling.")
|
"Enables support for FFmpeg's libswscale for video rescaling.")
|
||||||
package_option(SWRESAMPLE
|
package_option(SWResample
|
||||||
"Enables support for FFmpeg's libresample for audio resampling.")
|
"Enables support for FFmpeg's libresample for audio resampling.")
|
||||||
|
|
||||||
if(HAVE_SWSCALE AND HAVE_SWRESAMPLE)
|
if(HAVE_SWSCALE AND HAVE_SWRESAMPLE)
|
||||||
@ -476,7 +476,7 @@ package_status(FFMPEG "FFmpeg" "${ffmpeg_features}")
|
|||||||
find_package(VorbisFile QUIET)
|
find_package(VorbisFile QUIET)
|
||||||
|
|
||||||
package_option(VORBIS
|
package_option(VORBIS
|
||||||
FOUND_AS VORBISFILE
|
FOUND_AS VorbisFile
|
||||||
"Enables support for decoding Vorbis-encoded .ogg audio files via libvorbisfile.")
|
"Enables support for decoding Vorbis-encoded .ogg audio files via libvorbisfile.")
|
||||||
|
|
||||||
package_status(VORBIS "Vorbis")
|
package_status(VORBIS "Vorbis")
|
||||||
@ -485,7 +485,7 @@ package_status(VORBIS "Vorbis")
|
|||||||
find_package(OpusFile QUIET)
|
find_package(OpusFile QUIET)
|
||||||
|
|
||||||
package_option(OPUS
|
package_option(OPUS
|
||||||
FOUND_AS OPUSFILE
|
FOUND_AS OpusFile
|
||||||
"Enables support for decoding .opus audio files via libopusfile.")
|
"Enables support for decoding .opus audio files via libopusfile.")
|
||||||
|
|
||||||
package_status(OPUS "Opus")
|
package_status(OPUS "Opus")
|
||||||
@ -497,27 +497,27 @@ package_status(OPUS "Opus")
|
|||||||
# FMOD Ex
|
# FMOD Ex
|
||||||
find_package(FMODEx QUIET)
|
find_package(FMODEx QUIET)
|
||||||
|
|
||||||
package_option(FMODEX
|
package_option(FMODEx
|
||||||
"This enables support for the FMOD Ex sound library,
|
"This enables support for the FMOD Ex sound library,
|
||||||
from Firelight Technologies. This audio library is free for non-commercial
|
from Firelight Technologies. This audio library is free for non-commercial
|
||||||
use."
|
use."
|
||||||
LICENSE "FMOD")
|
LICENSE "FMOD")
|
||||||
|
|
||||||
package_status(FMODEX "FMOD Ex sound library")
|
package_status(FMODEx "FMOD Ex sound library")
|
||||||
|
|
||||||
# OpenAL
|
# OpenAL
|
||||||
find_package(OpenAL QUIET)
|
find_package(OpenAL QUIET)
|
||||||
|
|
||||||
package_option(OPENAL
|
package_option(OpenAL
|
||||||
"This enables support for audio output via OpenAL. Some platforms, such as
|
"This enables support for audio output via OpenAL. Some platforms, such as
|
||||||
macOS, provide their own OpenAL implementation, which Panda3D can use. But,
|
macOS, provide their own OpenAL implementation, which Panda3D can use. But,
|
||||||
on most platforms this will imply OpenAL Soft, which is LGPL licensed."
|
on most platforms this will imply OpenAL Soft, which is LGPL licensed."
|
||||||
IMPORTED_AS OpenAL::OpenAL
|
IMPORTED_AS OpenAL::OpenAL
|
||||||
LICENSE "LGPL")
|
LICENSE "LGPL")
|
||||||
|
|
||||||
package_status(OPENAL "OpenAL sound library")
|
package_status(OpenAL "OpenAL sound library")
|
||||||
|
|
||||||
if(OPENAL_FOUND AND APPLE)
|
if(OpenAL_FOUND AND APPLE OR OPENAL_FOUND AND APPLE)
|
||||||
set(HAVE_OPENAL_FRAMEWORK YES)
|
set(HAVE_OPENAL_FRAMEWORK YES)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -530,12 +530,12 @@ endif()
|
|||||||
|
|
||||||
find_package(Freetype QUIET)
|
find_package(Freetype QUIET)
|
||||||
|
|
||||||
package_option(FREETYPE
|
package_option(Freetype
|
||||||
"This enables support for the FreeType font-rendering library. If disabled,
|
"This enables support for the FreeType font-rendering library. If disabled,
|
||||||
Panda3D will only be able to read fonts specially made with egg-mkfont."
|
Panda3D will only be able to read fonts specially made with egg-mkfont."
|
||||||
IMPORTED_AS freetype)
|
IMPORTED_AS freetype)
|
||||||
|
|
||||||
package_status(FREETYPE "FreeType")
|
package_status(Freetype "FreeType")
|
||||||
|
|
||||||
# HarfBuzz
|
# HarfBuzz
|
||||||
|
|
||||||
@ -543,11 +543,11 @@ package_status(FREETYPE "FreeType")
|
|||||||
# force MODULE mode here.
|
# force MODULE mode here.
|
||||||
find_package(HarfBuzz MODULE QUIET)
|
find_package(HarfBuzz MODULE QUIET)
|
||||||
|
|
||||||
package_option(HARFBUZZ
|
package_option(HarfBuzz
|
||||||
"This enables support for the HarfBuzz text shaping library."
|
"This enables support for the HarfBuzz text shaping library."
|
||||||
IMPORTED_AS harfbuzz::harfbuzz)
|
IMPORTED_AS harfbuzz::harfbuzz)
|
||||||
|
|
||||||
package_status(HARFBUZZ "HarfBuzz")
|
package_status(HarfBuzz "HarfBuzz")
|
||||||
|
|
||||||
# GTK2
|
# GTK2
|
||||||
|
|
||||||
@ -567,10 +567,10 @@ package_status(GTK2 "gtk+-2")
|
|||||||
# Bullet
|
# Bullet
|
||||||
find_package(Bullet MODULE QUIET)
|
find_package(Bullet MODULE QUIET)
|
||||||
|
|
||||||
package_option(BULLET
|
package_option(Bullet
|
||||||
"Enable this option to support game dynamics with the Bullet physics library.")
|
"Enable this option to support game dynamics with the Bullet physics library.")
|
||||||
|
|
||||||
package_status(BULLET "Bullet physics")
|
package_status(Bullet "Bullet physics")
|
||||||
|
|
||||||
# ODE
|
# ODE
|
||||||
find_package(ODE QUIET)
|
find_package(ODE QUIET)
|
||||||
@ -585,11 +585,11 @@ package_status(ODE "Open Dynamics Engine")
|
|||||||
# PhysX
|
# PhysX
|
||||||
find_package(PhysX QUIET)
|
find_package(PhysX QUIET)
|
||||||
|
|
||||||
package_option(PHYSX
|
package_option(PhysX
|
||||||
"Enable this option to support game dynamics with Nvidia PhysX."
|
"Enable this option to support game dynamics with Nvidia PhysX."
|
||||||
LICENSE "Nvidia")
|
LICENSE "Nvidia")
|
||||||
|
|
||||||
package_status(PHYSX "Nvidia PhysX")
|
package_status(PhysX "Nvidia PhysX")
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -599,11 +599,11 @@ package_status(PHYSX "Nvidia PhysX")
|
|||||||
# SpeedTree
|
# SpeedTree
|
||||||
find_package(SpeedTree QUIET)
|
find_package(SpeedTree QUIET)
|
||||||
|
|
||||||
package_option(SPEEDTREE
|
package_option(SpeedTree
|
||||||
"Enable this option to include scenegraph support for SpeedTree trees."
|
"Enable this option to include scenegraph support for SpeedTree trees."
|
||||||
LICENSE "SpeedTree")
|
LICENSE "SpeedTree")
|
||||||
|
|
||||||
package_status(SPEEDTREE "SpeedTree")
|
package_status(SpeedTree "SpeedTree")
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -647,7 +647,7 @@ find_package(Direct3D9 QUIET COMPONENTS dxguid dxerr d3dx9)
|
|||||||
|
|
||||||
package_option(DX9
|
package_option(DX9
|
||||||
"Enable support for DirectX 9. This is typically only viable on Windows."
|
"Enable support for DirectX 9. This is typically only viable on Windows."
|
||||||
FOUND_AS DIRECT3D9)
|
FOUND_AS Direct3D9)
|
||||||
|
|
||||||
package_status(DX9 "Direct3D 9.x")
|
package_status(DX9 "Direct3D 9.x")
|
||||||
|
|
||||||
@ -728,11 +728,11 @@ package_status(EGL "EGL")
|
|||||||
# OpenCV
|
# OpenCV
|
||||||
find_package(OpenCV QUIET COMPONENTS core highgui OPTIONAL_COMPONENTS videoio)
|
find_package(OpenCV QUIET COMPONENTS core highgui OPTIONAL_COMPONENTS videoio)
|
||||||
|
|
||||||
package_option(OPENCV
|
package_option(OpenCV
|
||||||
"Enable support for OpenCV. This will be built into the 'vision' package."
|
"Enable support for OpenCV. This will be built into the 'vision' package."
|
||||||
FOUND_AS OpenCV)
|
FOUND_AS OpenCV)
|
||||||
|
|
||||||
package_status(OPENCV "OpenCV")
|
package_status(OpenCV "OpenCV")
|
||||||
|
|
||||||
# CMake <3.7 doesn't support GREATER_EQUAL, so this uses NOT LESS instead.
|
# CMake <3.7 doesn't support GREATER_EQUAL, so this uses NOT LESS instead.
|
||||||
if(NOT OpenCV_VERSION_MAJOR LESS 3)
|
if(NOT OpenCV_VERSION_MAJOR LESS 3)
|
||||||
@ -747,10 +747,10 @@ endif()
|
|||||||
# ARToolKit
|
# ARToolKit
|
||||||
find_package(ARToolKit QUIET)
|
find_package(ARToolKit QUIET)
|
||||||
|
|
||||||
package_option(ARTOOLKIT
|
package_option(ARToolKit
|
||||||
"Enable support for ARToolKit. This will be built into the 'vision' package.")
|
"Enable support for ARToolKit. This will be built into the 'vision' package.")
|
||||||
|
|
||||||
package_status(ARTOOLKIT "ARToolKit")
|
package_status(ARToolKit "ARToolKit")
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user