A first-principle computation of the thermodynamics of glasses