In thermodynamics, we usually find the work done by/on an ideal gas by considering a cylinder with a moveable piston as one of its flat ends. We consider the work done by moving the piston end a small amount, and find the well known result that
$dW = P dV$ (up to sign convention and inexact differential notation).
In books I've used (Finn, Zemansky), it's then asserted that this relationship generalises to systems of arbitrary shapes. However, this seems highly non-obvious to me, and they don't provide a sketch of why this result is generalisable.
Could anyone shed some light on this? I'm not necessarily looking for an ironclad argument -- more, just an indication on why it is sensible to generalise this. Thanks!