It could be done in a number of different ways, But the easiest way to do it would probably:
Have 3 separate objects inside the same file (base, turret, barrel) and name the objects something easy (base, turret, barrel?)
If you use DBP, run a checklist for limbs inside the object. When you have the limb number of both the turret and the barrel, you can easily control how they move using DBP's native limb commands.
Just make sure that the objects' pivot points are were they would need to be in order for the pieces to rotate correctly.
My green thumb grew the tree my Trojan War horse was crafted from. With roses in our pockets we rally round the tombstones. Ashes to ashes, we all fall down.