First-principle calculation of Chern number in gyrotropic photonic crystals