Structure-preserving discretization of incompressible fluids