From b5d9b8658d1b4529da92b95be54a90e626ec299d Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Fri, 7 Feb 2014 18:19:05 -0700 Subject: [PATCH 01/13] CMake: Panda3D physics and particlesystem. --- panda/CMakeLists.txt | 7 ++++ panda/metalibs/pandaphysics/CMakeLists.txt | 4 ++ panda/src/particlesystem/CMakeLists.txt | 45 ++++++++++++++++++++++ panda/src/physics/CMakeLists.txt | 43 +++++++++++++++++++++ 4 files changed, 99 insertions(+) create mode 100644 panda/metalibs/pandaphysics/CMakeLists.txt create mode 100644 panda/src/particlesystem/CMakeLists.txt create mode 100644 panda/src/physics/CMakeLists.txt diff --git a/panda/CMakeLists.txt b/panda/CMakeLists.txt index 1a0c7ded18..74a1f8bc34 100644 --- a/panda/CMakeLists.txt +++ b/panda/CMakeLists.txt @@ -61,10 +61,15 @@ add_subdirectory(src/egg2pg) add_subdirectory(src/framework) add_subdirectory(src/testbed) +# For other metalibs +add_subdirectory(src/physics) +add_subdirectory(src/particlesystem) + # Include panda metalibs add_subdirectory(metalibs/panda) add_subdirectory(metalibs/pandagl) add_subdirectory(metalibs/pandaegg) +add_subdirectory(metalibs/pandaphysics) # Now add the Python modules: @@ -86,3 +91,5 @@ add_python_module(core ${CORE_MODULE_COMPONENTS}) if(HAVE_EGG) add_python_module(egg p3egg p3egg2pg) endif() + +add_python_module(physics p3physics p3particlesystem) diff --git a/panda/metalibs/pandaphysics/CMakeLists.txt b/panda/metalibs/pandaphysics/CMakeLists.txt new file mode 100644 index 0000000000..f48411820c --- /dev/null +++ b/panda/metalibs/pandaphysics/CMakeLists.txt @@ -0,0 +1,4 @@ +add_library(pandaphysics pandaphysics.cxx) +target_link_libraries(pandaphysics p3physics p3particlesystem) + +install(TARGETS pandaphysics DESTINATION lib) diff --git a/panda/src/particlesystem/CMakeLists.txt b/panda/src/particlesystem/CMakeLists.txt new file mode 100644 index 0000000000..f2e405b41b --- /dev/null +++ b/panda/src/particlesystem/CMakeLists.txt @@ -0,0 +1,45 @@ +set(P3PARTICLESYSTEM_HEADERS + baseParticle.I baseParticle.h baseParticleEmitter.I + baseParticleEmitter.h baseParticleFactory.I + baseParticleFactory.h baseParticleRenderer.I + baseParticleRenderer.h arcEmitter.I arcEmitter.h + boxEmitter.I boxEmitter.h + config_particlesystem.h discEmitter.I discEmitter.h + geomParticleRenderer.I geomParticleRenderer.h lineEmitter.I + lineEmitter.h lineParticleRenderer.I lineParticleRenderer.h + particleSystem.I particleSystem.h particleSystemManager.I + particleSystemManager.h pointEmitter.I pointEmitter.h + pointParticle.h pointParticleFactory.h + pointParticleRenderer.I pointParticleRenderer.h + rectangleEmitter.I rectangleEmitter.h ringEmitter.I + ringEmitter.h sparkleParticleRenderer.I + sparkleParticleRenderer.h sphereSurfaceEmitter.I + sphereSurfaceEmitter.h sphereVolumeEmitter.I + sphereVolumeEmitter.h spriteParticleRenderer.I + spriteParticleRenderer.h tangentRingEmitter.I + tangentRingEmitter.h zSpinParticle.I zSpinParticle.h + zSpinParticleFactory.I zSpinParticleFactory.h + particleCommonFuncs.h colorInterpolationManager.I + colorInterpolationManager.h) + +set(P3PARTICLESYSTEM_SOURCES + baseParticle.cxx baseParticleEmitter.cxx baseParticleFactory.cxx + baseParticleRenderer.cxx boxEmitter.cxx arcEmitter.cxx + config_particlesystem.cxx discEmitter.cxx + geomParticleRenderer.cxx lineEmitter.cxx + lineParticleRenderer.cxx particleSystem.cxx + particleSystemManager.cxx pointEmitter.cxx pointParticle.cxx + pointParticleFactory.cxx pointParticleRenderer.cxx + rectangleEmitter.cxx ringEmitter.cxx + sparkleParticleRenderer.cxx sphereSurfaceEmitter.cxx + sphereVolumeEmitter.cxx spriteParticleRenderer.cxx + tangentRingEmitter.cxx zSpinParticle.cxx + zSpinParticleFactory.cxx colorInterpolationManager.cxx) + + +composite_sources(p3particlesystem P3PARTICLESYSTEM_SOURCES) +add_library(p3particlesystem ${P3PARTICLESYSTEM_HEADERS} ${P3PARTICLESYSTEM_SOURCES}) +target_link_libraries(p3particlesystem p3pgraph p3physics) +target_interrogate(p3particlesystem ALL) + +install(TARGETS p3particlesystem DESTINATION lib) diff --git a/panda/src/physics/CMakeLists.txt b/panda/src/physics/CMakeLists.txt new file mode 100644 index 0000000000..3353864326 --- /dev/null +++ b/panda/src/physics/CMakeLists.txt @@ -0,0 +1,43 @@ +set(P3PHYSICS_HEADERS + actorNode.I actorNode.h angularEulerIntegrator.h angularForce.h + angularIntegrator.h angularVectorForce.I + angularVectorForce.h baseForce.I baseForce.h + baseIntegrator.I baseIntegrator.h config_physics.h + forceNode.I forceNode.h + linearControlForce.I linearControlForce.h + linearCylinderVortexForce.I linearCylinderVortexForce.h + linearDistanceForce.I + linearDistanceForce.h linearEulerIntegrator.h linearForce.I + linearForce.h linearFrictionForce.I linearFrictionForce.h + linearIntegrator.h linearJitterForce.h linearNoiseForce.I + linearNoiseForce.h linearRandomForce.I linearRandomForce.h + linearSinkForce.h linearSourceForce.h + linearUserDefinedForce.I linearUserDefinedForce.h + linearVectorForce.I linearVectorForce.h physical.I + physical.h physicalNode.I physicalNode.h + physicsCollisionHandler.I physicsCollisionHandler.h + physicsManager.I physicsManager.h + physicsObject.I physicsObject.h + physicsObjectCollection.I physicsObjectCollection.h) + +set(P3PHYSICS_SOURCES + actorNode.cxx angularEulerIntegrator.cxx angularForce.cxx + angularIntegrator.cxx angularVectorForce.cxx baseForce.cxx + baseIntegrator.cxx config_physics.cxx forceNode.cxx + linearControlForce.cxx + linearCylinderVortexForce.cxx linearDistanceForce.cxx + linearEulerIntegrator.cxx linearForce.cxx + linearFrictionForce.cxx linearIntegrator.cxx + linearJitterForce.cxx linearNoiseForce.cxx + linearRandomForce.cxx linearSinkForce.cxx + linearSourceForce.cxx linearUserDefinedForce.cxx + linearVectorForce.cxx physical.cxx physicalNode.cxx + physicsCollisionHandler.cxx physicsManager.cxx physicsObject.cxx + physicsObjectCollection.cxx) + +composite_sources(p3physics P3PHYSICS_SOURCES) +add_library(p3physics ${P3PHYSICS_HEADERS} ${P3PHYSICS_SOURCES}) +target_link_libraries(p3physics p3pgraph p3linmath p3collide) +target_interrogate(p3physics ALL) + +install(TARGETS p3physics DESTINATION lib) From f97222135747cbfc2e553842964668b50bc94b7d Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Sat, 8 Feb 2014 16:20:57 -0700 Subject: [PATCH 02/13] CMake: Detect ODE. --- cmake/modules/FindODE.cmake | 80 +++++++++++++++++++++++++++++++++++++ dtool/Config.cmake | 5 +++ 2 files changed, 85 insertions(+) create mode 100644 cmake/modules/FindODE.cmake diff --git a/cmake/modules/FindODE.cmake b/cmake/modules/FindODE.cmake new file mode 100644 index 0000000000..6c70f69de7 --- /dev/null +++ b/cmake/modules/FindODE.cmake @@ -0,0 +1,80 @@ +# Filename: FindODE.cmake +# Author: CFSworks (7 Feb, 2014) +# +# Usage: +# find_package(ODE [REQUIRED] [QUIET]) +# +# Once done this will define: +# ODE_FOUND - system has ode +# ODE_INCLUDE_DIR - the ode include directory +# ODE_LIBRARY_DIR - the ode library directory +# ODE_LIBRARY - the path to the library binary +# +# ODE_RELEASE_LIBRARY - the filepath of the ode release library +# ODE_DEBUG_LIBRARY - the filepath of the ode debug library +# + +if(NOT ODE_INCLUDE_DIR OR NOT ODE_LIBRARY_DIR) + # Find the libode include files + find_path(ODE_INCLUDE_DIR + NAMES "ode.h" + PATHS "/usr/include" + "/usr/local/include" + "/sw/include" + "/opt/include" + "/opt/local/include" + "/opt/csw/include" + PATH_SUFFIXES "" "ode" + ) + + # Find the libode library built for release + find_library(ODE_RELEASE_LIBRARY + NAMES "ode" "libode" + PATHS "/usr" + "/usr/local" + "/usr/freeware" + "/sw" + "/opt" + "/opt/csw" + PATH_SUFFIXES "lib" "lib32" "lib64" + ) + + # Find the libode library built for debug + find_library(ODE_DEBUG_LIBRARY + NAMES "oded" "liboded" + PATHS "/usr" + "/usr/local" + "/usr/freeware" + "/sw" + "/opt" + "/opt/csw" + PATH_SUFFIXES "lib" "lib32" "lib64" + ) + + + mark_as_advanced(ODE_INCLUDE_DIR) + mark_as_advanced(ODE_RELEASE_LIBRARY) + mark_as_advanced(ODE_DEBUG_LIBRARY) +endif() + +# Choose library +if(CMAKE_BUILD_TYPE MATCHES "Debug" AND ODE_DEBUG_LIBRARY) + set(ODE_LIBRARY ${ODE_DEBUG_LIBRARY} CACHE FILEPATH "The filepath to libode's library binary.") +elseif(ODE_RELEASE_LIBRARY) + set(ODE_LIBRARY ${ODE_RELEASE_LIBRARY} CACHE FILEPATH "The filepath to libode's library binary.") +elseif(ODE_DEBUG_LIBRARY) + set(ODE_LIBRARY ${ODE_DEBUG_LIBRARY} CACHE FILEPATH "The filepath to libode's library binary.") +endif() + +# Translate library into library directory +if(ODE_LIBRARY) + unset(ODE_LIBRARY_DIR CACHE) + get_filename_component(ODE_LIBRARY_DIR "${ODE_LIBRARY}" PATH) + set(ODE_LIBRARY_DIR "${ODE_LIBRARY_DIR}" CACHE PATH "The path to libode's library directory.") # Library path +endif() + +mark_as_advanced(ODE_LIBRARY) +mark_as_advanced(ODE_LIBRARY_DIR) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(ODE DEFAULT_MSG ODE_LIBRARY ODE_INCLUDE_DIR ODE_LIBRARY_DIR) diff --git a/dtool/Config.cmake b/dtool/Config.cmake index a5595f22fc..5851928cfc 100644 --- a/dtool/Config.cmake +++ b/dtool/Config.cmake @@ -589,6 +589,11 @@ find_package(ZLIB) package_option(ZLIB DEFAULT ON "Enables support for compression of Panda assets.") +# Is ODE installed, and where? +find_package(ODE) + +package_option(ODE DEFAULT ON + "Enables support for ridid-body physics using the Open Dynamics Engine.") # Is OpenGL installed, and where? find_package(OpenGL QUIET) From 3c240ae0cd5a94909397f2deacb1171d31404b6f Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Sat, 8 Feb 2014 16:21:49 -0700 Subject: [PATCH 03/13] CMake: Build panda3d.ode. --- panda/CMakeLists.txt | 9 ++++- panda/src/ode/CMakeLists.txt | 76 ++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 1 deletion(-) create mode 100755 panda/src/ode/CMakeLists.txt diff --git a/panda/CMakeLists.txt b/panda/CMakeLists.txt index 74a1f8bc34..c057dc6539 100644 --- a/panda/CMakeLists.txt +++ b/panda/CMakeLists.txt @@ -61,9 +61,12 @@ add_subdirectory(src/egg2pg) add_subdirectory(src/framework) add_subdirectory(src/testbed) -# For other metalibs +# For other components +# physics add_subdirectory(src/physics) add_subdirectory(src/particlesystem) +# ode +add_subdirectory(src/ode) # Include panda metalibs add_subdirectory(metalibs/panda) @@ -93,3 +96,7 @@ if(HAVE_EGG) endif() add_python_module(physics p3physics p3particlesystem) + +if(HAVE_ODE) + add_python_module(ode p3ode) +endif() diff --git a/panda/src/ode/CMakeLists.txt b/panda/src/ode/CMakeLists.txt new file mode 100755 index 0000000000..9e17af5b24 --- /dev/null +++ b/panda/src/ode/CMakeLists.txt @@ -0,0 +1,76 @@ +if(HAVE_ODE) + set(P3ODE_HEADERS + ode_includes.h config_ode.h + odeWorld.I odeWorld.h + odeMass.I odeMass.h + odeBody.I odeBody.h + odeJointGroup.I odeJointGroup.h + odeJoint.I odeJoint.h + odeUtil.h + odeSpace.I odeSpace.h + odeGeom.I odeGeom.h + odeSurfaceParameters.I odeSurfaceParameters.h + odeContactGeom.I odeContactGeom.h + odeContact.I odeContact.h + odeAMotorJoint.I odeAMotorJoint.h + odeBallJoint.I odeBallJoint.h + odeContactJoint.I odeContactJoint.h + odeFixedJoint.I odeFixedJoint.h + odeHingeJoint.I odeHingeJoint.h + odeHinge2Joint.I odeHinge2Joint.h + odeLMotorJoint.I odeLMotorJoint.h + odeNullJoint.I odeNullJoint.h + odePlane2dJoint.I odePlane2dJoint.h + odeSliderJoint.I odeSliderJoint.h + odeUniversalJoint.I odeUniversalJoint.h + odeJointCollection.I odeJointCollection.h + odeSimpleSpace.I odeSimpleSpace.h + odeHashSpace.I odeHashSpace.h + odeQuadTreeSpace.I odeQuadTreeSpace.h + odeSphereGeom.I odeSphereGeom.h + odeBoxGeom.I odeBoxGeom.h + odePlaneGeom.I odePlaneGeom.h + odeCappedCylinderGeom.I odeCappedCylinderGeom.h + odeCylinderGeom.I odeCylinderGeom.h + odeRayGeom.I odeRayGeom.h + odeTriMeshData.I odeTriMeshData.h + odeTriMeshGeom.I odeTriMeshGeom.h + odeCollisionEntry.I odeCollisionEntry.h + odeHelperStructs.h) + + set(P3ODE_SOURCES + config_ode.cxx + odeWorld.cxx odeMass.cxx odeBody.cxx + odeJointGroup.cxx odeJoint.cxx + odeUtil.cxx + odeSpace.cxx + odeGeom.cxx + odeSurfaceParameters.cxx + odeContactGeom.cxx odeContact.cxx + odeAMotorJoint.cxx odeBallJoint.cxx + odeContactJoint.cxx odeFixedJoint.cxx + odeHingeJoint.cxx odeHinge2Joint.cxx + odeLMotorJoint.cxx odeNullJoint.cxx + odePlane2dJoint.cxx odeSliderJoint.cxx + odeUniversalJoint.cxx odeJointCollection.cxx + odeSimpleSpace.cxx + odeHashSpace.cxx odeQuadTreeSpace.cxx + odeSphereGeom.cxx odeBoxGeom.cxx + odePlaneGeom.cxx odeCappedCylinderGeom.cxx + odeCylinderGeom.cxx odeRayGeom.cxx + odeTriMeshData.cxx odeTriMeshGeom.cxx + odeCollisionEntry.cxx) + + set(P3ODE_IGATE_SOURCES "${P3ODE_HEADERS};${P3ODE_SOURCES}") + list(REMOVE_ITEM P3ODE_IGATE_SOURCES "odeConvexGeom.h") + list(REMOVE_ITEM P3ODE_IGATE_SOURCES "odeHeightFieldGeom.h") + list(REMOVE_ITEM P3ODE_IGATE_SOURCES "odeHelperStructs.h") + + composite_sources(p3ode P3ODE_SOURCES) + add_library(p3ode ${P3ODE_SOURCES} ${P3ODE_HEADERS}) + set_target_properties(p3ode PROPERTIES COMPILE_DEFINITIONS dSINGLE) + target_link_libraries(p3ode p3pgraph p3physics ${ODE_LIBRARY}) + target_interrogate(p3ode ${P3ODE_IGATE_SOURCES}) + + install(TARGETS p3ode DESTINATION lib) +endif() From 9f8ab63e754b1bf893a524b305fbb3ae5e033591 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Fri, 14 Feb 2014 06:23:05 -0700 Subject: [PATCH 04/13] CMake: Build audiotraits. --- panda/CMakeLists.txt | 1 + panda/src/audiotraits/CMakeLists.txt | 64 ++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 panda/src/audiotraits/CMakeLists.txt diff --git a/panda/CMakeLists.txt b/panda/CMakeLists.txt index c057dc6539..98c570bd4f 100644 --- a/panda/CMakeLists.txt +++ b/panda/CMakeLists.txt @@ -42,6 +42,7 @@ add_subdirectory(src/x11display) add_subdirectory(src/glxdisplay) add_subdirectory(src/movies) add_subdirectory(src/audio) +add_subdirectory(src/audiotraits) add_subdirectory(src/chan) add_subdirectory(src/char) add_subdirectory(src/dgraph) diff --git a/panda/src/audiotraits/CMakeLists.txt b/panda/src/audiotraits/CMakeLists.txt new file mode 100644 index 0000000000..e4a28424fe --- /dev/null +++ b/panda/src/audiotraits/CMakeLists.txt @@ -0,0 +1,64 @@ +if(HAVE_AUDIO) + + if(HAVE_RAD_MSS) + set(P3MILES_HEADERS + config_milesAudio.h + milesAudioManager.h + milesAudioSound.I milesAudioSound.h + milesAudioSample.I milesAudioSample.h + milesAudioSequence.I milesAudioSequence.h + milesAudioStream.I milesAudioStream.h + globalMilesManager.I globalMilesManager.h) + + set(P3MILES_SOURCES + config_milesAudio.cxx milesAudioManager.cxx milesAudioSound.cxx + milesAudioStream.cxx globalMilesManager.cxx milesAudioSample.cxx + milesAudioSequence.cxx) + + composite_sources(p3miles_audio P3MILES_SOURCES) + include_directories(${MILES_INCLUDE_DIR}) + add_library(p3miles_audio ${P3MILES_HEADERS} ${P3MILES_SOURCES}) + target_link_libraries(p3miles_audio p3audio p3event p3pipeline + ${_MILES_LIBRARY}) + + install(TARGETS p3miles_audio DESTINATION lib) + endif() + + if(HAVE_FMODEX) + set(P3FMOD_HEADERS + config_fmodAudio.h + fmodAudioManager.h + fmodAudioSound.I fmodAudioSound.h) + + set(P3FMOD_SOURCES + config_fmodAudio.cxx fmodAudioManager.cxx fmodAudioSound.cxx) + + composite_sources(p3fmod_audio P3FMOD_SOURCES) + include_directories(${FMODEX_INCLUDE_DIR}) + add_library(p3fmod_audio ${P3FMOD_HEADERS} ${P3FMOD_SOURCES}) + target_link_libraries(p3fmod_audio p3audio p3event + ${_FMODEX_LIBRARY}) + + install(TARGETS p3fmod_audio DESTINATION lib) + endif() + + if(HAVE_OPENAL) + set(P3OPENAL_HEADERS + config_openalAudio.h + openalAudioManager.h + openalAudioSound.I openalAudioSound.h) + + set(P3OPENAL_SOURCES + config_openalAudio.cxx openalAudioManager.cxx openalAudioSound.cxx) + + + composite_sources(p3openal_audio P3OPENAL_SOURCES) + include_directories(${OPENAL_INCLUDE_DIR}) + add_library(p3openal_audio ${P3OPENAL_HEADERS} ${P3OPENAL_SOURCES}) + target_link_libraries(p3openal_audio p3audio p3event + ${_OPENAL_LIBRARY}) + + install(TARGETS p3openal_audio DESTINATION lib) + endif() + +endif() From 3969d0e1acda6cdff8ec3cdc3d2b72af7d27df87 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Sun, 2 Mar 2014 18:33:00 -0700 Subject: [PATCH 05/13] CMake: Link Interrogate bindings against metalibs. --- cmake/macros/Interrogate.cmake | 26 ++++++++++++++++++++++---- panda/CMakeLists.txt | 2 +- panda/metalibs/panda/CMakeLists.txt | 13 ++++++++++++- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/cmake/macros/Interrogate.cmake b/cmake/macros/Interrogate.cmake index 72b595ec1c..0025cc9161 100644 --- a/cmake/macros/Interrogate.cmake +++ b/cmake/macros/Interrogate.cmake @@ -219,16 +219,34 @@ function(interrogate_sources target output database module) endfunction(interrogate_sources) # -# Function: add_python_module(module [lib1 [lib2 ...]]) -# Uses interrogate to create a Python module. +# Function: add_python_module(module [lib1 [lib2 ...]] [LINK lib1 ...]) +# Uses interrogate to create a Python module. If the LINK keyword is specified, +# the Python module is linked against the specified libraries instead of those +# listed before. # function(add_python_module module) if(HAVE_PYTHON AND HAVE_INTERROGATE) - set(targets ${ARGN}) + set(targets) + set(link_targets) set(infiles) set(sources) set(HACKlinklibs) + set(link_keyword OFF) + foreach(arg ${ARGN}) + if(arg STREQUAL "LINK") + set(link_keyword ON) + elseif(link_keyword) + list(APPEND link_targets "${arg}") + else() + list(APPEND targets "${arg}") + endif() + endforeach(arg) + + if(NOT link_keyword) + set(link_targets ${targets}) + endif() + foreach(target ${targets}) interrogate_sources(${target} "${target}_igate.cxx" "${target}.in" "${module}") list(APPEND infiles "${target}.in") @@ -262,7 +280,7 @@ function(add_python_module module) add_library(${module} MODULE "${module}_module.cxx" ${sources}) target_link_libraries(${module} - ${targets} ${PYTHON_LIBRARIES} p3interrogatedb) + ${link_targets} ${PYTHON_LIBRARIES} p3interrogatedb) target_link_libraries(${module} ${HACKlinklibs}) set_target_properties(${module} PROPERTIES diff --git a/panda/CMakeLists.txt b/panda/CMakeLists.txt index 98c570bd4f..3f7ac5b30d 100644 --- a/panda/CMakeLists.txt +++ b/panda/CMakeLists.txt @@ -90,7 +90,7 @@ if(HAVE_FREETYPE) list(APPEND CORE_MODULE_COMPONENTS p3pnmtext) endif() -add_python_module(core ${CORE_MODULE_COMPONENTS}) +add_python_module(core ${CORE_MODULE_COMPONENTS} LINK panda) if(HAVE_EGG) add_python_module(egg p3egg p3egg2pg) diff --git a/panda/metalibs/panda/CMakeLists.txt b/panda/metalibs/panda/CMakeLists.txt index 3170a4717e..a44ef0cdd0 100644 --- a/panda/metalibs/panda/CMakeLists.txt +++ b/panda/metalibs/panda/CMakeLists.txt @@ -1,5 +1,16 @@ add_definitions(-DBUILDING_PANDA) -set(PANDA_LINK_TARGETS p3pnmimagetypes p3device) +set(PANDA_LINK_TARGETS + p3chan p3char p3collide p3cull p3device p3dgraph p3display p3downloader + p3event p3express p3gobj p3grutil p3gsgbase p3linmath p3mathutil p3nativenet + p3net p3movies p3parametrics p3pgraph p3pgraphnodes p3pgui p3pipeline + p3pnmimage p3pnmimagetypes p3pstatclient p3putil p3recorder p3text p3tform) + +if(HAVE_AUDIO) + list(APPEND PANDA_LINK_TARGETS p3audio) +endif() +if(HAVE_FREETYPE) + list(APPEND PANDA_LINK_TARGETS p3pnmtext) +endif() if(LINK_IN_PHYSX) add_definitions(-DBUILDING_PANDAPHYSX) From 0c04655f86a37261c08e7d5a8a9ca1ae96efa3a0 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Sun, 2 Mar 2014 18:33:47 -0700 Subject: [PATCH 06/13] CMake: Explicitly require Python 2.x. --- dtool/Config.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dtool/Config.cmake b/dtool/Config.cmake index 5851928cfc..a21bbee98c 100644 --- a/dtool/Config.cmake +++ b/dtool/Config.cmake @@ -429,8 +429,8 @@ platforms. Currently experimental." ON) # Is Python installed, and should Python interfaces be generated? -find_package(PythonLibs) -find_package(PythonInterp) +find_package(PythonLibs 2.5) +find_package(PythonInterp 2.5) set(PYTHON_FOUND ${PYTHONLIBS_FOUND}) package_option(PYTHON DEFAULT ON From 161beda242c29245144757ab7870d6ff73eb0cb9 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Sun, 2 Mar 2014 21:53:15 -0700 Subject: [PATCH 07/13] CMake: Add missing quotes in FindCg module. --- cmake/modules/FindCg.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/modules/FindCg.cmake b/cmake/modules/FindCg.cmake index 3fdfe757ca..f7c43884a2 100644 --- a/cmake/modules/FindCg.cmake +++ b/cmake/modules/FindCg.cmake @@ -141,7 +141,7 @@ if(NOT CG_LIBRARY_DIR OR NOT CG_INCLUDE_DIRS) set(CG_LIBRARY_DIR "${CG_LIBRARY_DIR}" CACHE PATH "The path to NvidiaCG's library directory.") # Library path endif() - string(REGEX REPLACE "/Cg$" "" CG_BASE_INCLUDE_DIR ${CG_INCLUDE_DIR}) + string(REGEX REPLACE "/Cg$" "" CG_BASE_INCLUDE_DIR "${CG_INCLUDE_DIR}") set(CG_INCLUDE_DIRS ${CG_BASE_INCLUDE_DIR} ${CG_INCLUDE_DIR}) mark_as_advanced(CG_INCLUDE_DIRS) From 301ee4b8c3fc0d0b00163ee232e56e3fe1eb1a8b Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Sun, 2 Mar 2014 21:53:35 -0700 Subject: [PATCH 08/13] CMake: Add missing dependency on zlib from p3express. --- panda/src/express/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda/src/express/CMakeLists.txt b/panda/src/express/CMakeLists.txt index 631078215f..56d324bcbf 100644 --- a/panda/src/express/CMakeLists.txt +++ b/panda/src/express/CMakeLists.txt @@ -127,7 +127,7 @@ composite_sources(p3express P3EXPRESS_SOURCES) add_library(p3express ${P3EXPRESS_SOURCES} ${P3EXPRESS_HEADERS}) target_link_libraries(p3express p3pandabase p3dtool p3dtoolconfig - ${_TAR_LIBRARY}) + ${_TAR_LIBRARY} ${_ZLIB_LIBRARY}) target_interrogate(p3express ALL) install(TARGETS p3express DESTINATION lib) From 0bcce442c3bb4b74df5360ef8d409258d41885d5 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Sun, 2 Mar 2014 21:57:15 -0700 Subject: [PATCH 09/13] CMake: Properly link against the proper frameworks on OS X. --- dtool/src/dtoolutil/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dtool/src/dtoolutil/CMakeLists.txt b/dtool/src/dtoolutil/CMakeLists.txt index 04a4e0ce6c..f68db48a5b 100644 --- a/dtool/src/dtoolutil/CMakeLists.txt +++ b/dtool/src/dtoolutil/CMakeLists.txt @@ -56,4 +56,10 @@ if(HAVE_PYTHON) target_link_libraries(p3dtoolutil ${PYTHON_LIBRARIES}) endif() +if(APPLE) + find_library(FOUNDATION_LIBRARY Foundation) + find_library(APPKIT_LIBRARY AppKit) + target_link_libraries(p3dtoolutil ${FOUNDATION_LIBRARY} ${APPKIT_LIBRARY}) +endif() + install(TARGETS p3dtoolutil DESTINATION lib) From cfe06ed30fb83c7406cb93c92aaeb68025fe6079 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Sun, 2 Mar 2014 22:07:32 -0700 Subject: [PATCH 10/13] CMake: Fix building p3display under OSX. --- panda/src/display/CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/panda/src/display/CMakeLists.txt b/panda/src/display/CMakeLists.txt index 106fab5646..583b60f79e 100644 --- a/panda/src/display/CMakeLists.txt +++ b/panda/src/display/CMakeLists.txt @@ -78,12 +78,17 @@ if(HAVE_PYTHON) ) endif() -if(OSX_PLATFORM) - set(P3DISPLAY_HEADER +if(APPLE) + set(P3DISPLAY_HEADERS ${P3DISPLAY_HEADERS} subprocessWindowBuffer.h subprocessWindowBuffer.I ) + + set(P3DISPLAY_SOURCES + ${P3DISPLAY_SOURCES} + subprocessWindowBuffer.cxx + ) endif() composite_sources(p3display P3DISPLAY_SOURCES) From 56d180c26e0a9ad6213e767718685ecb20db44fa Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Sun, 2 Mar 2014 22:11:29 -0700 Subject: [PATCH 11/13] CMake: Adjust indentation. --- panda/src/display/CMakeLists.txt | 34 ++++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/panda/src/display/CMakeLists.txt b/panda/src/display/CMakeLists.txt index 583b60f79e..245f076ea1 100644 --- a/panda/src/display/CMakeLists.txt +++ b/panda/src/display/CMakeLists.txt @@ -68,27 +68,27 @@ set(P3DISPLAY_SOURCES ) if(HAVE_PYTHON) - set(P3DISPLAY_HEADERS - ${P3DISPLAY_HEADERS} - pythonGraphicsWindowProc.h - ) - set(P3DISPLAY_SOURCES - ${P3DISPLAY_SOURCES} - pythonGraphicsWindowProc.cxx - ) + set(P3DISPLAY_HEADERS + ${P3DISPLAY_HEADERS} + pythonGraphicsWindowProc.h + ) + set(P3DISPLAY_SOURCES + ${P3DISPLAY_SOURCES} + pythonGraphicsWindowProc.cxx + ) endif() if(APPLE) - set(P3DISPLAY_HEADERS - ${P3DISPLAY_HEADERS} - subprocessWindowBuffer.h - subprocessWindowBuffer.I - ) + set(P3DISPLAY_HEADERS + ${P3DISPLAY_HEADERS} + subprocessWindowBuffer.h + subprocessWindowBuffer.I + ) - set(P3DISPLAY_SOURCES - ${P3DISPLAY_SOURCES} - subprocessWindowBuffer.cxx - ) + set(P3DISPLAY_SOURCES + ${P3DISPLAY_SOURCES} + subprocessWindowBuffer.cxx + ) endif() composite_sources(p3display P3DISPLAY_SOURCES) From ea48d3d7a6e92437ffa5e42e0189aefa26871709 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Tue, 4 Mar 2014 03:27:39 -0700 Subject: [PATCH 12/13] CMake: Build OS X display modules. --- panda/CMakeLists.txt | 2 ++ panda/metalibs/pandagl/CMakeLists.txt | 7 +++++++ panda/src/cocoadisplay/CMakeLists.txt | 29 +++++++++++++++++++++++++++ panda/src/osxdisplay/CMakeLists.txt | 27 +++++++++++++++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 panda/src/cocoadisplay/CMakeLists.txt create mode 100644 panda/src/osxdisplay/CMakeLists.txt diff --git a/panda/CMakeLists.txt b/panda/CMakeLists.txt index 3f7ac5b30d..c0f544b3a8 100644 --- a/panda/CMakeLists.txt +++ b/panda/CMakeLists.txt @@ -40,6 +40,8 @@ add_subdirectory(src/glstuff) add_subdirectory(src/glgsg) add_subdirectory(src/x11display) add_subdirectory(src/glxdisplay) +add_subdirectory(src/osxdisplay) +add_subdirectory(src/cocoadisplay) add_subdirectory(src/movies) add_subdirectory(src/audio) add_subdirectory(src/audiotraits) diff --git a/panda/metalibs/pandagl/CMakeLists.txt b/panda/metalibs/pandagl/CMakeLists.txt index 2134f350eb..8a2c3248e7 100644 --- a/panda/metalibs/pandagl/CMakeLists.txt +++ b/panda/metalibs/pandagl/CMakeLists.txt @@ -14,6 +14,13 @@ if(HAVE_GL) set(PANDAGL_LINK_TARGETS ${PANDAGL_LINK_TARGETS} p3glxdisplay) endif() + if(HAVE_COCOA) + set(PANDAGL_LINK_TARGETS ${PANDAGL_LINK_TARGETS} p3cocoadisplay) + endif() + + if(HAVE_CARBON) + set(PANDAGL_LINK_TARGETS ${PANDAGL_LINK_TARGETS} p3osxdisplay) + endif() add_library(pandagl pandagl.cxx) target_link_libraries(pandagl ${PANDAGL_LINK_TARGETS}) diff --git a/panda/src/cocoadisplay/CMakeLists.txt b/panda/src/cocoadisplay/CMakeLists.txt new file mode 100644 index 0000000000..d8fb78d894 --- /dev/null +++ b/panda/src/cocoadisplay/CMakeLists.txt @@ -0,0 +1,29 @@ +if(APPLE AND HAVE_GL AND HAVE_COCOA) + set(P3COCOADISPLAY_HEADERS + config_cocoadisplay.h + cocoaGraphicsPipe.h cocoaGraphicsPipe.I + cocoaGraphicsWindow.h cocoaGraphicsWindow.I + cocoaGraphicsStateGuardian.h cocoaGraphicsStateGuardian.I + cocoaPandaView.h cocoaPandaWindowDelegate.h) + + set(P3COCOADISPLAY_SOURCES + config_cocoadisplay.mm + cocoaGraphicsPipe.mm + cocoaGraphicsStateGuardian.mm + cocoaGraphicsWindow.mm + cocoaPandaView.mm + cocoaPandaWindow.mm + cocoaPandaWindowDelegate.mm) + + #composite_sources(p3cocoadisplay P3COCOADISPLAY_SOURCES) + add_library(p3cocoadisplay ${P3COCOADISPLAY_SOURCES} ${P3COCOADISPLAY_HEADERS}) + target_link_libraries(p3cocoadisplay p3display p3putil p3glgsg) + + # Frameworks: + find_library(APPLICATIONSERVICES_LIBRARY ApplicationServices) + find_library(APPKIT_LIBRARY AppKit) + target_link_libraries(p3cocoadisplay + ${APPLICATIONSERVICES_LIBRARY} ${APPKIT_LIBRARY}) + + install(TARGETS p3cocoadisplay DESTINATION lib) +endif() diff --git a/panda/src/osxdisplay/CMakeLists.txt b/panda/src/osxdisplay/CMakeLists.txt new file mode 100644 index 0000000000..2a16f6c3ce --- /dev/null +++ b/panda/src/osxdisplay/CMakeLists.txt @@ -0,0 +1,27 @@ +if(APPLE AND HAVE_GL AND HAVE_CARBON) + set(P3OSXDISPLAY_HEADERS + config_osxdisplay.h + osxGraphicsPipe.h + osxGraphicsWindow.h osxGraphicsWindow.I + osxGraphicsStateGuardian.h) + + set(P3OSXDISPLAY_SOURCES + config_osxdisplay.cxx osxGraphicsPipe.cxx osxGraphicsStateGuardian.cxx + osxGraphicsBuffer.cxx) + + composite_sources(p3osxdisplay P3OSXDISPLAY_SOURCES) + add_library(p3osxdisplay ${P3OSXDISPLAY_SOURCES} ${P3OSXDISPLAY_HEADERS}) + target_link_libraries(p3osxdisplay p3display p3putil p3glgsg) + + # Frameworks: + find_library(APPLICATIONSERVICES_LIBRARY ApplicationServices) + find_library(CARBON_LIBRARY Carbon) + find_library(AGL_LIBRARY AGL) + find_library(CORESERVICES_LIBRARY CoreServices) + find_library(COCOA_LIBRARY Cocoa) + target_link_libraries(p3osxdisplay + ${APPLICATIONSERVICES_LIBRARY} ${CARBON_LIBRARY} ${AGL_LIBRARY} + ${CORESERVICES_LIBRARY} ${COCOA_LIBRARY}) + + install(TARGETS p3osxdisplay DESTINATION lib) +endif() From c8797058cb173f2528ac21c46c4025dd940bbf70 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Tue, 4 Mar 2014 03:27:57 -0700 Subject: [PATCH 13/13] Fix missing imports/includes in cocoadisplay. --- panda/src/cocoadisplay/cocoaGraphicsWindow.mm | 1 + panda/src/cocoadisplay/cocoaPandaView.h | 3 +++ panda/src/cocoadisplay/cocoaPandaView.mm | 1 + panda/src/cocoadisplay/cocoaPandaWindowDelegate.h | 2 ++ 4 files changed, 7 insertions(+) diff --git a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm index e314fbe4a0..c34215233f 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm @@ -38,6 +38,7 @@ #import #import #import +#import #import //#import diff --git a/panda/src/cocoadisplay/cocoaPandaView.h b/panda/src/cocoadisplay/cocoaPandaView.h index f892c6a685..05ac92bc81 100644 --- a/panda/src/cocoadisplay/cocoaPandaView.h +++ b/panda/src/cocoadisplay/cocoaPandaView.h @@ -12,7 +12,10 @@ // //////////////////////////////////////////////////////////////////// +#include "graphicsWindow.h" + #import +#import class CocoaGraphicsWindow; diff --git a/panda/src/cocoadisplay/cocoaPandaView.mm b/panda/src/cocoadisplay/cocoaPandaView.mm index 05c73213e5..bb7d03c832 100644 --- a/panda/src/cocoadisplay/cocoaPandaView.mm +++ b/panda/src/cocoadisplay/cocoaPandaView.mm @@ -12,6 +12,7 @@ // //////////////////////////////////////////////////////////////////// +#include "config_cocoadisplay.h" #import "cocoaPandaView.h" #import "cocoaGraphicsWindow.h" diff --git a/panda/src/cocoadisplay/cocoaPandaWindowDelegate.h b/panda/src/cocoadisplay/cocoaPandaWindowDelegate.h index 78c8c2eabe..fd7333bed0 100644 --- a/panda/src/cocoadisplay/cocoaPandaWindowDelegate.h +++ b/panda/src/cocoadisplay/cocoaPandaWindowDelegate.h @@ -14,6 +14,8 @@ #import +#import "cocoaGraphicsWindow.h" + class CocoaGraphicsWindow; #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1060