Solute strengthening from first-principles and applications to Al and Mg alloys