mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
CMake: Generate/install exported target sets
This commit is contained in:
parent
b20c6e801c
commit
bddd7c1b4b
@ -166,3 +166,13 @@ if(INTERROGATE_PYTHON_INTERFACE)
|
|||||||
|
|
||||||
add_test(pytest "${PYTHON_EXECUTABLE}" -m pytest "${PROJECT_SOURCE_DIR}/tests")
|
add_test(pytest "${PYTHON_EXECUTABLE}" -m pytest "${PROJECT_SOURCE_DIR}/tests")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Generate the Panda3DConfig.cmake file so find_package(Panda3D) works, and
|
||||||
|
# also register the build directory with CMake's package registry.
|
||||||
|
|
||||||
|
file(COPY "${PROJECT_SOURCE_DIR}/cmake/install/Panda3DConfig.cmake"
|
||||||
|
DESTINATION "${PROJECT_BINARY_DIR}")
|
||||||
|
install(FILES "${PROJECT_SOURCE_DIR}/cmake/install/Panda3DConfig.cmake"
|
||||||
|
DESTINATION "lib/cmake/Panda3D")
|
||||||
|
|
||||||
|
export(PACKAGE Panda3D)
|
||||||
|
141
cmake/install/Panda3DConfig.cmake
Normal file
141
cmake/install/Panda3DConfig.cmake
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
# PANDA 3D SOFTWARE
|
||||||
|
# Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||||
|
#
|
||||||
|
# All use of this software is subject to the terms of the revised BSD
|
||||||
|
# license. You should have received a copy of this license along
|
||||||
|
# with this source code in a file named "LICENSE."
|
||||||
|
#
|
||||||
|
# Author: CFSworks (Dec. 11, 2018)
|
||||||
|
|
||||||
|
# This file is installed to CMake's package search path, and is invoked for
|
||||||
|
# find_package(Panda3D [COMPONENTS ...])
|
||||||
|
#
|
||||||
|
# The following components are available for importing:
|
||||||
|
#
|
||||||
|
# Core - The core Panda3D libraries; this component is always included.
|
||||||
|
#
|
||||||
|
# Panda3D::Core::panda
|
||||||
|
# Panda3D::Core::pandaexpress
|
||||||
|
# etc.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Python - Python targets, which can be used for linking against the Python
|
||||||
|
# extension modules directly. Note that this also imports the
|
||||||
|
# Python bindings for other requested components that have them.
|
||||||
|
#
|
||||||
|
# Panda3D::Python::panda3d.core
|
||||||
|
# Panda3D::Python::panda3d.physics
|
||||||
|
# etc.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Tools - Various tools used in asset manipulation and debugging.
|
||||||
|
#
|
||||||
|
# Panda3D::Tools::egg2bam
|
||||||
|
# Panda3D::Tools::egg-optchar
|
||||||
|
# Panda3D::Tools::pview
|
||||||
|
# etc.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Direct - Panda's "direct" Python framework; C++ support library.
|
||||||
|
#
|
||||||
|
# Panda3D::Direct::p3direct
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Egg - Support for the Egg file format.
|
||||||
|
#
|
||||||
|
# Panda3D::Egg::pandaegg
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Bullet - Support for Bullet physics.
|
||||||
|
#
|
||||||
|
# Panda3D::Bullet::p3bullet
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# ODE - Support for the ODE physics engine.
|
||||||
|
#
|
||||||
|
# Panda3D::ODE::p3ode
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# FFmpeg - Support for FFmpeg media format loading.
|
||||||
|
#
|
||||||
|
# Panda3D::FFmpeg::p3ffmpeg
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# OpenAL - Support for OpenAL audio output.
|
||||||
|
#
|
||||||
|
# Panda3D::OpenAL::p3openal_audio
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# FMOD - Support for FMOD audio output.
|
||||||
|
#
|
||||||
|
# Panda3D::OpenAL::p3fmod_audio
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# OpenGL - Support for OpenGL rendering.
|
||||||
|
#
|
||||||
|
# Panda3D::OpenGL::pandagl
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# DX9 - Support for Direct3D 9 rendering.
|
||||||
|
#
|
||||||
|
# Panda3D::DX9::pandadx9
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# GLES - Support for OpenGL ES rendering.
|
||||||
|
#
|
||||||
|
# Panda3D::GLES::pandagles
|
||||||
|
# Panda3D::GLES::pandagles2
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Vision - Support for vision processing.
|
||||||
|
#
|
||||||
|
# Panda3D::Vision::p3vision
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# VRPN - Support for connecting to a VRPN virtual reality server.
|
||||||
|
#
|
||||||
|
# Panda3D::VRPN::p3vrpn
|
||||||
|
|
||||||
|
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 3.0)
|
||||||
|
message(FATAL_ERROR "CMake >= 3.0.2 required")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
get_filename_component(_panda_config_prefix "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||||
|
|
||||||
|
include("${_panda_config_prefix}/Panda3DPackages.cmake")
|
||||||
|
|
||||||
|
set(_panda_components
|
||||||
|
Core Python Tools
|
||||||
|
Direct Egg
|
||||||
|
Bullet ODE
|
||||||
|
FFmpeg
|
||||||
|
OpenAL FMOD
|
||||||
|
OpenGL DX9 GLES
|
||||||
|
Vision VRPN
|
||||||
|
)
|
||||||
|
|
||||||
|
set(Panda3D_FIND_REQUIRED_Core ON)
|
||||||
|
|
||||||
|
foreach(_comp Core ${Panda3D_FIND_COMPONENTS})
|
||||||
|
if(";${_panda_components};" MATCHES ";${_comp};" AND
|
||||||
|
EXISTS "${_panda_config_prefix}/Panda3D${_comp}Targets.cmake")
|
||||||
|
|
||||||
|
include("${_panda_config_prefix}/Panda3D${_comp}Targets.cmake")
|
||||||
|
|
||||||
|
if(";${Panda3D_FIND_COMPONENTS};" MATCHES ";Python;" AND
|
||||||
|
EXISTS "${_panda_config_prefix}/Panda3D${_comp}PythonTargets.cmake")
|
||||||
|
|
||||||
|
include("${_panda_config_prefix}/Panda3D${_comp}PythonTargets.cmake")
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
elseif(Panda3D_FIND_REQUIRED_${_comp})
|
||||||
|
|
||||||
|
message(FATAL_ERROR "Panda3D REQUIRED component ${_comp} not found")
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endforeach(_comp)
|
||||||
|
unset(_comp)
|
||||||
|
|
||||||
|
unset(_panda_components)
|
@ -370,6 +370,47 @@ function(export_packages filename)
|
|||||||
file(GENERATE OUTPUT "${filename}" CONTENT "${exports}")
|
file(GENERATE OUTPUT "${filename}" CONTENT "${exports}")
|
||||||
endfunction(export_packages)
|
endfunction(export_packages)
|
||||||
|
|
||||||
|
#
|
||||||
|
# export_targets(set [NAMESPACE namespace] [COMPONENT component])
|
||||||
|
#
|
||||||
|
# Export targets in the export set named by "set"
|
||||||
|
#
|
||||||
|
# NAMESPACE overrides the namespace prefixed to the exported targets; it
|
||||||
|
# defaults to "Panda3D::[set]::" if no explicit override is given.
|
||||||
|
#
|
||||||
|
# COMPONENT overrides the install component for the generated .cmake file; it
|
||||||
|
# defaults to "[set]" if no explicit override is given.
|
||||||
|
#
|
||||||
|
function(export_targets set)
|
||||||
|
set(namespace "Panda3D::${set}::")
|
||||||
|
set(component "${set}")
|
||||||
|
set(keyword)
|
||||||
|
foreach(arg ${ARGN})
|
||||||
|
if(arg STREQUAL "NAMESPACE" OR
|
||||||
|
arg STREQUAL "COMPONENT")
|
||||||
|
|
||||||
|
set(keyword "${arg}")
|
||||||
|
|
||||||
|
elseif(keyword STREQUAL "NAMESPACE")
|
||||||
|
set(namespace "${arg}")
|
||||||
|
|
||||||
|
elseif(keyword STREQUAL "COMPONENT")
|
||||||
|
set(component "${arg}")
|
||||||
|
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "export_targets() given unexpected arg: ${arg}")
|
||||||
|
|
||||||
|
endif()
|
||||||
|
endforeach(arg)
|
||||||
|
|
||||||
|
export(EXPORT "${set}" NAMESPACE "${namespace}"
|
||||||
|
FILE "${PROJECT_BINARY_DIR}/Panda3D${set}Targets.cmake")
|
||||||
|
install(EXPORT "${set}" NAMESPACE "${namespace}"
|
||||||
|
FILE "Panda3D${set}Targets.cmake"
|
||||||
|
COMPONENT "${component}" DESTINATION lib/cmake/Panda3D)
|
||||||
|
|
||||||
|
endfunction(export_targets)
|
||||||
|
|
||||||
#
|
#
|
||||||
# find_package
|
# find_package
|
||||||
#
|
#
|
||||||
|
@ -80,3 +80,7 @@ except ImportError as err:
|
|||||||
# Now install ourselves:
|
# Now install ourselves:
|
||||||
install_python_package("${PROJECT_BINARY_DIR}/pandac" LIB COMPONENT Direct)
|
install_python_package("${PROJECT_BINARY_DIR}/pandac" LIB COMPONENT Direct)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# "Direct" component contains both the Python stuff and the non-Python stuff,
|
||||||
|
# because direct has a pretty solid dependency on Python.
|
||||||
|
export_targets(Direct NAMESPACE "Panda3D::Direct::" COMPONENT DirectDevel)
|
||||||
|
@ -192,3 +192,9 @@ configure_file(dtool_config.h.in "${PROJECT_BINARY_DIR}/include/${intdir}/dtool_
|
|||||||
install(FILES "${PROJECT_BINARY_DIR}/include/${intdir}/dtool_config.h"
|
install(FILES "${PROJECT_BINARY_DIR}/include/${intdir}/dtool_config.h"
|
||||||
COMPONENT CoreDevel
|
COMPONENT CoreDevel
|
||||||
DESTINATION include/panda3d)
|
DESTINATION include/panda3d)
|
||||||
|
|
||||||
|
# Generate the package configuration file
|
||||||
|
export_packages("${PROJECT_BINARY_DIR}/Panda3DPackages.cmake")
|
||||||
|
install(FILES "${PROJECT_BINARY_DIR}/Panda3DPackages.cmake"
|
||||||
|
COMPONENT CoreDevel
|
||||||
|
DESTINATION "lib/cmake/Panda3D")
|
||||||
|
@ -99,23 +99,37 @@ if(HAVE_PYTHON)
|
|||||||
|
|
||||||
if(HAVE_BULLET)
|
if(HAVE_BULLET)
|
||||||
add_python_module(bullet p3bullet IMPORT panda3d.core COMPONENT BulletPython)
|
add_python_module(bullet p3bullet IMPORT panda3d.core COMPONENT BulletPython)
|
||||||
|
|
||||||
|
export_targets(BulletPython NAMESPACE "Panda3D::Python::" COMPONENT BulletDevel)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(HAVE_EGG)
|
if(HAVE_EGG)
|
||||||
add_python_module(egg p3egg p3egg2pg LINK pandaegg IMPORT panda3d.core COMPONENT EggPython)
|
add_python_module(egg p3egg p3egg2pg LINK pandaegg IMPORT panda3d.core COMPONENT EggPython)
|
||||||
|
|
||||||
|
export_targets(EggPython NAMESPACE "Panda3D::Python::" COMPONENT EggDevel)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_python_module(physics p3physics p3particlesystem LINK pandaphysics IMPORT panda3d.core)
|
add_python_module(physics p3physics p3particlesystem LINK pandaphysics IMPORT panda3d.core)
|
||||||
|
|
||||||
if(HAVE_ODE)
|
if(HAVE_ODE)
|
||||||
add_python_module(ode p3ode IMPORT panda3d.core COMPONENT ODEPython)
|
add_python_module(ode p3ode IMPORT panda3d.core COMPONENT ODEPython)
|
||||||
|
|
||||||
|
export_targets(ODEPython NAMESPACE "Panda3D::Python::" COMPONENT ODEDevel)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(HAVE_OPENCV OR HAVE_ARTOOLKIT)
|
if(HAVE_OPENCV OR HAVE_ARTOOLKIT)
|
||||||
add_python_module(vision p3vision IMPORT panda3d.core COMPONENT VisionPython)
|
add_python_module(vision p3vision IMPORT panda3d.core COMPONENT VisionPython)
|
||||||
|
|
||||||
|
export_targets(VisionPython NAMESPACE "Panda3D::Python::" COMPONENT VisionDevel)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(HAVE_VRPN)
|
if(HAVE_VRPN)
|
||||||
add_python_module(vrpn p3vrpn IMPORT panda3d.core COMPONENT VRPNPython)
|
add_python_module(vrpn p3vrpn IMPORT panda3d.core COMPONENT VRPNPython)
|
||||||
|
|
||||||
|
export_targets(VRPNPython NAMESPACE "Panda3D::Python::" COMPONENT VRPNDevel)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
export_targets(Python NAMESPACE "Panda3D::Python::" COMPONENT CoreDevel)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
export_targets(Core COMPONENT CoreDevel)
|
||||||
|
@ -14,3 +14,5 @@ install(TARGETS pandaegg
|
|||||||
DESTINATION lib
|
DESTINATION lib
|
||||||
RUNTIME DESTINATION bin
|
RUNTIME DESTINATION bin
|
||||||
ARCHIVE COMPONENT EggDevel)
|
ARCHIVE COMPONENT EggDevel)
|
||||||
|
|
||||||
|
export_targets(Egg COMPONENT EggDevel)
|
||||||
|
@ -40,3 +40,5 @@ install(TARGETS pandagl
|
|||||||
EXPORT OpenGL COMPONENT OpenGL
|
EXPORT OpenGL COMPONENT OpenGL
|
||||||
DESTINATION ${MODULE_DESTINATION}
|
DESTINATION ${MODULE_DESTINATION}
|
||||||
ARCHIVE COMPONENT OpenGLDevel)
|
ARCHIVE COMPONENT OpenGLDevel)
|
||||||
|
|
||||||
|
export_targets(OpenGL NAMESPACE "Panda3D::OpenGL::" COMPONENT OpenGLDevel)
|
||||||
|
@ -30,6 +30,8 @@ if(HAVE_RAD_MSS)
|
|||||||
DESTINATION lib
|
DESTINATION lib
|
||||||
RUNTIME DESTINATION bin
|
RUNTIME DESTINATION bin
|
||||||
ARCHIVE COMPONENT MilesDevel)
|
ARCHIVE COMPONENT MilesDevel)
|
||||||
|
|
||||||
|
export_targets(Miles NAMESPACE "Panda3D::Miles::" COMPONENT MilesDevel)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(HAVE_FMODEX)
|
if(HAVE_FMODEX)
|
||||||
@ -51,6 +53,8 @@ if(HAVE_FMODEX)
|
|||||||
DESTINATION lib
|
DESTINATION lib
|
||||||
RUNTIME DESTINATION bin
|
RUNTIME DESTINATION bin
|
||||||
ARCHIVE COMPONENT FMODDevel)
|
ARCHIVE COMPONENT FMODDevel)
|
||||||
|
|
||||||
|
export_targets(FMOD NAMESPACE "Panda3D::FMOD::" COMPONENT FMODDevel)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(HAVE_OPENAL)
|
if(HAVE_OPENAL)
|
||||||
@ -73,4 +77,6 @@ if(HAVE_OPENAL)
|
|||||||
DESTINATION lib
|
DESTINATION lib
|
||||||
RUNTIME DESTINATION bin
|
RUNTIME DESTINATION bin
|
||||||
ARCHIVE COMPONENT OpenALDevel)
|
ARCHIVE COMPONENT OpenALDevel)
|
||||||
|
|
||||||
|
export_targets(OpenAL NAMESPACE "Panda3D::OpenAL::" COMPONENT OpenALDevel)
|
||||||
endif()
|
endif()
|
||||||
|
@ -118,3 +118,5 @@ install(TARGETS p3bullet
|
|||||||
RUNTIME DESTINATION bin
|
RUNTIME DESTINATION bin
|
||||||
ARCHIVE COMPONENT BulletDevel)
|
ARCHIVE COMPONENT BulletDevel)
|
||||||
install(FILES ${P3BULLET_HEADERS} COMPONENT BulletDevel DESTINATION include/panda3d)
|
install(FILES ${P3BULLET_HEADERS} COMPONENT BulletDevel DESTINATION include/panda3d)
|
||||||
|
|
||||||
|
export_targets(Bullet COMPONENT BulletDevel)
|
||||||
|
@ -98,3 +98,5 @@ install(TARGETS p3ode
|
|||||||
RUNTIME DESTINATION bin
|
RUNTIME DESTINATION bin
|
||||||
ARCHIVE COMPONENT ODEDevel)
|
ARCHIVE COMPONENT ODEDevel)
|
||||||
install(FILES ${P3ODE_HEADERS} COMPONENT ODEDevel DESTINATION include/panda3d)
|
install(FILES ${P3ODE_HEADERS} COMPONENT ODEDevel DESTINATION include/panda3d)
|
||||||
|
|
||||||
|
export_targets(ODE COMPONENT ODEDevel)
|
||||||
|
@ -39,3 +39,5 @@ install(TARGETS p3vision
|
|||||||
RUNTIME DESTINATION bin
|
RUNTIME DESTINATION bin
|
||||||
ARCHIVE COMPONENT VisionDevel)
|
ARCHIVE COMPONENT VisionDevel)
|
||||||
install(FILES ${P3VISION_HEADERS} COMPONENT VisionDevel DESTINATION include/panda3d)
|
install(FILES ${P3VISION_HEADERS} COMPONENT VisionDevel DESTINATION include/panda3d)
|
||||||
|
|
||||||
|
export_targets(Vision COMPONENT VisionDevel)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user