CMake: Build 'contrib'

This commit is contained in:
Sam Edwards 2019-03-17 00:06:26 -06:00
parent d61ecb8a8f
commit 3a9353c0ca
6 changed files with 149 additions and 1 deletions

View File

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

View File

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

18
contrib/CMakeLists.txt Normal file
View File

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

View File

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

View File

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

View File

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