From 3a9353c0ca995d3df8bbcb89ad7982126769b9cc Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Sun, 17 Mar 2019 00:06:26 -0600 Subject: [PATCH] CMake: Build 'contrib' --- CMakeLists.txt | 5 +++ cmake/install/Panda3DConfig.cmake | 9 ++++- contrib/CMakeLists.txt | 18 +++++++++ contrib/src/ai/CMakeLists.txt | 53 ++++++++++++++++++++++++++ contrib/src/contribbase/CMakeLists.txt | 14 +++++++ contrib/src/rplight/CMakeLists.txt | 51 +++++++++++++++++++++++++ 6 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 contrib/CMakeLists.txt create mode 100644 contrib/src/ai/CMakeLists.txt create mode 100644 contrib/src/contribbase/CMakeLists.txt create mode 100644 contrib/src/rplight/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index aec7d85a2b..211183d65d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,6 +42,7 @@ option(BUILD_DTOOL "Build the dtool source tree." ON) option(BUILD_PANDA "Build the panda source tree." ON) option(BUILD_DIRECT "Build the direct source tree." ON) option(BUILD_PANDATOOL "Build the pandatool source tree." ON) +option(BUILD_CONTRIB "Build the contrib source tree." ON) option(BUILD_MODELS "Build/install the built-in models." ON) # Include Panda3D packages @@ -61,6 +62,10 @@ if(BUILD_PANDATOOL) add_subdirectory(pandatool "${CMAKE_BINARY_DIR}/pandatool") endif() +if(BUILD_CONTRIB) + add_subdirectory(contrib "${CMAKE_BINARY_DIR}/contrib") +endif() + if(BUILD_MODELS) # We don't really "build" the models, just pzip them file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/models/maps/" diff --git a/cmake/install/Panda3DConfig.cmake b/cmake/install/Panda3DConfig.cmake index ceff49f55a..2a7c192926 100644 --- a/cmake/install/Panda3DConfig.cmake +++ b/cmake/install/Panda3DConfig.cmake @@ -41,6 +41,13 @@ # Panda3D::Direct::p3direct # # +# Contrib - Extensions not part of the Panda3D core, but contributed by the +# community. +# +# Panda3D::Contrib::p3ai +# Panda3D::Contrib::p3rplight +# +# # Framework - Panda's "p3framework" C++ framework. # # Panda3D::Framework::p3framework @@ -111,7 +118,7 @@ include("${_panda_config_prefix}/Panda3DPackages.cmake") set(_panda_components Core Python Tools - Direct Framework Egg + Direct Contrib Framework Egg Bullet ODE FFmpeg OpenAL FMOD diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt new file mode 100644 index 0000000000..19f8604966 --- /dev/null +++ b/contrib/CMakeLists.txt @@ -0,0 +1,18 @@ +if(NOT BUILD_PANDA) + message(FATAL_ERROR "Cannot build contrib without panda! Please enable the BUILD_PANDA option.") +endif() + +# Include source directories +add_subdirectory(src/ai) +add_subdirectory(src/contribbase) +add_subdirectory(src/rplight) + +if(HAVE_PYTHON) + add_python_module(ai p3ai + IMPORT panda3d.core COMPONENT ContribPython) + + add_python_module(_rplight p3rplight + IMPORT panda3d.core COMPONENT ContribPython) +endif() + +export_targets(Contrib COMPONENT ContribDevel) diff --git a/contrib/src/ai/CMakeLists.txt b/contrib/src/ai/CMakeLists.txt new file mode 100644 index 0000000000..b32b3b878d --- /dev/null +++ b/contrib/src/ai/CMakeLists.txt @@ -0,0 +1,53 @@ +set(P3AI_HEADERS + aiBehaviors.h + aiCharacter.h + aiGlobals.h + aiNode.h + aiPathFinder.h + aiWorld.h + arrival.h + config_ai.h + evade.h + flee.h + flock.h + meshNode.h + obstacleAvoidance.h + pathFind.h + pathFollow.h + pursue.h + seek.h + wander.h +) + +set(P3AI_SOURCES + aiBehaviors.cxx + aiCharacter.cxx + aiNode.cxx + aiPathFinder.cxx + aiWorld.cxx + arrival.cxx + config_ai.cxx + evade.cxx + flee.cxx + flock.cxx + meshNode.cxx + obstacleAvoidance.cxx + pathFind.cxx + pathFollow.cxx + pursue.cxx + seek.cxx + wander.cxx +) + +composite_sources(p3ai P3AI_SOURCES) +add_library(p3ai ${P3AI_HEADERS} ${P3AI_SOURCES}) +set_target_properties(p3ai PROPERTIES DEFINE_SYMBOL BUILDING_PANDAAI) +target_link_libraries(p3ai p3contribbase) +target_interrogate(p3ai ALL) + +install(TARGETS p3ai + EXPORT Contrib COMPONENT Contrib + DESTINATION lib + RUNTIME DESTINATION bin + ARCHIVE COMPONENT ContribDevel) +install(FILES ${P3AI_HEADERS} COMPONENT ContribDevel DESTINATION include/panda3d) diff --git a/contrib/src/contribbase/CMakeLists.txt b/contrib/src/contribbase/CMakeLists.txt new file mode 100644 index 0000000000..a60e741c6e --- /dev/null +++ b/contrib/src/contribbase/CMakeLists.txt @@ -0,0 +1,14 @@ +set(P3CONTRIBBASE_SOURCES + contribbase.cxx +) + +set(P3CONTRIBBASE_HEADERS + contribbase.h contribsymbols.h +) + +# Yes, INTERFACE: don't build it, there's no code! +add_library(p3contribbase INTERFACE) +target_link_libraries(p3contribbase INTERFACE panda) + +install(TARGETS p3contribbase EXPORT Contrib COMPONENT Contrib) +install(FILES ${P3CONTRIBBASE_HEADERS} COMPONENT ContribDevel DESTINATION include/panda3d) diff --git a/contrib/src/rplight/CMakeLists.txt b/contrib/src/rplight/CMakeLists.txt new file mode 100644 index 0000000000..5bb1f669f3 --- /dev/null +++ b/contrib/src/rplight/CMakeLists.txt @@ -0,0 +1,51 @@ +set(P3RPLIGHT_HEADERS + config_rplight.h + gpuCommand.h gpuCommand.I + gpuCommandList.h + iesDataset.h + internalLightManager.h internalLightManager.I + pointerSlotStorage.h + pssmCameraRig.h pssmCameraRig.I + rpLight.h rpLight.I + rpPointLight.h rpPointLight.I + rpSpotLight.h rpSpotLight.I + shadowAtlas.h shadowAtlas.I + shadowManager.h shadowManager.I + shadowSource.h shadowSource.I + tagStateManager.h tagStateManager.I +) + +set(P3RPLIGHT_SOURCES + config_rplight.cxx + gpuCommand.cxx + gpuCommandList.cxx + iesDataset.cxx + internalLightManager.cxx + pssmCameraRig.cxx + rpLight.cxx + rpPointLight.cxx + rpSpotLight.cxx + shadowAtlas.cxx + shadowManager.cxx + shadowSource.cxx + tagStateManager.cxx +) + +composite_sources(p3rplight P3RPLIGHT_SOURCES) +# STATIC, because it doesn't contain any EXPCL_ stuff +add_library(p3rplight STATIC ${P3RPLIGHT_HEADERS} ${P3RPLIGHT_SOURCES}) +target_link_libraries(p3rplight p3contribbase) +target_interrogate(p3rplight ALL) + +if(MODULE_TYPE STREQUAL "MODULE") + # Because it's STATIC (see above), we need to make it PIC so it can link into + # a Python module + set_target_properties(p3rplight PROPERTIES POSITION_INDEPENDENT_CODE ON) +endif() + +install(TARGETS p3rplight + EXPORT Contrib COMPONENT Contrib + DESTINATION lib + RUNTIME DESTINATION bin + ARCHIVE COMPONENT ContribDevel) +install(FILES ${P3RPLIGHT_HEADERS} COMPONENT ContribDevel DESTINATION include/panda3d)