godot/modules/jolt_physics/SCsub
Mikael Hermansson d470c2ac6a Add Jolt Physics as an alternative 3D physics engine
Co-authored-by: Jorrit Rouwe <jrouwe@gmail.com>
2024-12-11 13:57:25 +01:00

179 lines
7.5 KiB
Python

#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")
Import("env_modules")
env_jolt = env_modules.Clone()
# Thirdparty source files
thirdparty_dir = "#thirdparty/jolt_physics/"
thirdparty_sources = [
"Jolt/RegisterTypes.cpp",
"Jolt/AABBTree/AABBTreeBuilder.cpp",
"Jolt/Core/Color.cpp",
"Jolt/Core/Factory.cpp",
"Jolt/Core/IssueReporting.cpp",
"Jolt/Core/JobSystemSingleThreaded.cpp",
"Jolt/Core/JobSystemThreadPool.cpp",
"Jolt/Core/JobSystemWithBarrier.cpp",
"Jolt/Core/LinearCurve.cpp",
"Jolt/Core/Memory.cpp",
"Jolt/Core/Profiler.cpp",
"Jolt/Core/RTTI.cpp",
"Jolt/Core/Semaphore.cpp",
"Jolt/Core/StringTools.cpp",
"Jolt/Core/TickCounter.cpp",
"Jolt/Geometry/ConvexHullBuilder.cpp",
"Jolt/Geometry/ConvexHullBuilder2D.cpp",
"Jolt/Geometry/Indexify.cpp",
"Jolt/Geometry/OrientedBox.cpp",
"Jolt/Math/Vec3.cpp",
"Jolt/ObjectStream/SerializableObject.cpp",
"Jolt/Physics/DeterminismLog.cpp",
"Jolt/Physics/IslandBuilder.cpp",
"Jolt/Physics/LargeIslandSplitter.cpp",
"Jolt/Physics/PhysicsScene.cpp",
"Jolt/Physics/PhysicsSystem.cpp",
"Jolt/Physics/PhysicsUpdateContext.cpp",
"Jolt/Physics/StateRecorderImpl.cpp",
"Jolt/Physics/Body/Body.cpp",
"Jolt/Physics/Body/BodyCreationSettings.cpp",
"Jolt/Physics/Body/BodyInterface.cpp",
"Jolt/Physics/Body/BodyManager.cpp",
"Jolt/Physics/Body/MassProperties.cpp",
"Jolt/Physics/Body/MotionProperties.cpp",
"Jolt/Physics/Character/Character.cpp",
"Jolt/Physics/Character/CharacterBase.cpp",
"Jolt/Physics/Character/CharacterVirtual.cpp",
"Jolt/Physics/Collision/CastConvexVsTriangles.cpp",
"Jolt/Physics/Collision/CastSphereVsTriangles.cpp",
"Jolt/Physics/Collision/CollideConvexVsTriangles.cpp",
"Jolt/Physics/Collision/CollideSphereVsTriangles.cpp",
"Jolt/Physics/Collision/CollisionDispatch.cpp",
"Jolt/Physics/Collision/CollisionGroup.cpp",
"Jolt/Physics/Collision/EstimateCollisionResponse.cpp",
"Jolt/Physics/Collision/GroupFilter.cpp",
"Jolt/Physics/Collision/GroupFilterTable.cpp",
"Jolt/Physics/Collision/ManifoldBetweenTwoFaces.cpp",
"Jolt/Physics/Collision/NarrowPhaseQuery.cpp",
"Jolt/Physics/Collision/NarrowPhaseStats.cpp",
"Jolt/Physics/Collision/PhysicsMaterial.cpp",
"Jolt/Physics/Collision/PhysicsMaterialSimple.cpp",
"Jolt/Physics/Collision/TransformedShape.cpp",
"Jolt/Physics/Collision/BroadPhase/BroadPhase.cpp",
"Jolt/Physics/Collision/BroadPhase/BroadPhaseBruteForce.cpp",
"Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.cpp",
"Jolt/Physics/Collision/BroadPhase/QuadTree.cpp",
"Jolt/Physics/Collision/Shape/BoxShape.cpp",
"Jolt/Physics/Collision/Shape/CapsuleShape.cpp",
"Jolt/Physics/Collision/Shape/CompoundShape.cpp",
"Jolt/Physics/Collision/Shape/ConvexHullShape.cpp",
"Jolt/Physics/Collision/Shape/ConvexShape.cpp",
"Jolt/Physics/Collision/Shape/CylinderShape.cpp",
"Jolt/Physics/Collision/Shape/DecoratedShape.cpp",
"Jolt/Physics/Collision/Shape/EmptyShape.cpp",
"Jolt/Physics/Collision/Shape/HeightFieldShape.cpp",
"Jolt/Physics/Collision/Shape/MeshShape.cpp",
"Jolt/Physics/Collision/Shape/MutableCompoundShape.cpp",
"Jolt/Physics/Collision/Shape/OffsetCenterOfMassShape.cpp",
"Jolt/Physics/Collision/Shape/PlaneShape.cpp",
"Jolt/Physics/Collision/Shape/RotatedTranslatedShape.cpp",
"Jolt/Physics/Collision/Shape/ScaledShape.cpp",
"Jolt/Physics/Collision/Shape/Shape.cpp",
"Jolt/Physics/Collision/Shape/SphereShape.cpp",
"Jolt/Physics/Collision/Shape/StaticCompoundShape.cpp",
"Jolt/Physics/Collision/Shape/TaperedCapsuleShape.cpp",
"Jolt/Physics/Collision/Shape/TaperedCylinderShape.cpp",
"Jolt/Physics/Collision/Shape/TriangleShape.cpp",
"Jolt/Physics/Constraints/ConeConstraint.cpp",
"Jolt/Physics/Constraints/Constraint.cpp",
"Jolt/Physics/Constraints/ConstraintManager.cpp",
"Jolt/Physics/Constraints/ContactConstraintManager.cpp",
"Jolt/Physics/Constraints/DistanceConstraint.cpp",
"Jolt/Physics/Constraints/FixedConstraint.cpp",
"Jolt/Physics/Constraints/GearConstraint.cpp",
"Jolt/Physics/Constraints/HingeConstraint.cpp",
"Jolt/Physics/Constraints/MotorSettings.cpp",
"Jolt/Physics/Constraints/PathConstraint.cpp",
"Jolt/Physics/Constraints/PathConstraintPath.cpp",
"Jolt/Physics/Constraints/PathConstraintPathHermite.cpp",
"Jolt/Physics/Constraints/PointConstraint.cpp",
"Jolt/Physics/Constraints/PulleyConstraint.cpp",
"Jolt/Physics/Constraints/RackAndPinionConstraint.cpp",
"Jolt/Physics/Constraints/SixDOFConstraint.cpp",
"Jolt/Physics/Constraints/SliderConstraint.cpp",
"Jolt/Physics/Constraints/SpringSettings.cpp",
"Jolt/Physics/Constraints/SwingTwistConstraint.cpp",
"Jolt/Physics/Constraints/TwoBodyConstraint.cpp",
"Jolt/Physics/Ragdoll/Ragdoll.cpp",
"Jolt/Physics/SoftBody/SoftBodyCreationSettings.cpp",
"Jolt/Physics/SoftBody/SoftBodyMotionProperties.cpp",
"Jolt/Physics/SoftBody/SoftBodyShape.cpp",
"Jolt/Physics/SoftBody/SoftBodySharedSettings.cpp",
"Jolt/Physics/Vehicle/MotorcycleController.cpp",
"Jolt/Physics/Vehicle/TrackedVehicleController.cpp",
"Jolt/Physics/Vehicle/VehicleAntiRollBar.cpp",
"Jolt/Physics/Vehicle/VehicleCollisionTester.cpp",
"Jolt/Physics/Vehicle/VehicleConstraint.cpp",
"Jolt/Physics/Vehicle/VehicleController.cpp",
"Jolt/Physics/Vehicle/VehicleDifferential.cpp",
"Jolt/Physics/Vehicle/VehicleEngine.cpp",
"Jolt/Physics/Vehicle/VehicleTrack.cpp",
"Jolt/Physics/Vehicle/VehicleTransmission.cpp",
"Jolt/Physics/Vehicle/Wheel.cpp",
"Jolt/Physics/Vehicle/WheeledVehicleController.cpp",
"Jolt/Renderer/DebugRenderer.cpp",
"Jolt/Renderer/DebugRendererPlayback.cpp",
"Jolt/Renderer/DebugRendererRecorder.cpp",
"Jolt/Renderer/DebugRendererSimple.cpp",
"Jolt/Skeleton/SkeletalAnimation.cpp",
"Jolt/Skeleton/Skeleton.cpp",
"Jolt/Skeleton/SkeletonMapper.cpp",
"Jolt/Skeleton/SkeletonPose.cpp",
"Jolt/TriangleGrouper/TriangleGrouperClosestCentroid.cpp",
"Jolt/TriangleGrouper/TriangleGrouperMorton.cpp",
"Jolt/TriangleSplitter/TriangleSplitter.cpp",
"Jolt/TriangleSplitter/TriangleSplitterBinning.cpp",
"Jolt/TriangleSplitter/TriangleSplitterFixedLeafSize.cpp",
"Jolt/TriangleSplitter/TriangleSplitterLongestAxis.cpp",
"Jolt/TriangleSplitter/TriangleSplitterMean.cpp",
"Jolt/TriangleSplitter/TriangleSplitterMorton.cpp",
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_jolt.Prepend(CPPPATH=[thirdparty_dir])
if env.dev_build:
env_jolt.Append(CPPDEFINES=["JPH_ENABLE_ASSERTS"])
if env.editor_build:
env_jolt.Append(CPPDEFINES=["JPH_DEBUG_RENDERER"])
if env["precision"] == "double":
env_jolt.Append(CPPDEFINES=["JPH_DOUBLE_PRECISION"])
env_thirdparty = env_jolt.Clone()
env_thirdparty.disable_warnings()
thirdparty_obj = []
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
env.modules_sources += thirdparty_obj
# Godot source files
module_obj = []
env_jolt.add_source_files(module_obj, "*.cpp")
env_jolt.add_source_files(module_obj, "joints/*.cpp")
env_jolt.add_source_files(module_obj, "misc/*.cpp")
env_jolt.add_source_files(module_obj, "objects/*.cpp")
env_jolt.add_source_files(module_obj, "shapes/*.cpp")
env_jolt.add_source_files(module_obj, "spaces/*.cpp")
env.modules_sources += module_obj
# Needed to force rebuilding the module files when the thirdparty library is updated.
env.Depends(module_obj, thirdparty_obj)