Supersymmetric M3-branes and G2 manifolds