We investigate numerically the lattice orientation of cholesteric blue phases in contact with surfaces enforcing unidirectional planar anchoring. Our study is based on the Landau-de Gennes continuum theory in which the orientational order of the liquid crystal is described by a second-rank tensor. We particularly focus on blue phase I (BP I) with its (110) plane parallel to the surfaces, and blue phase II (BP II) with its (100) plane parallel to the surfaces. In the former case, the angle between the direction of unidirectional anchoring and the [1¯10] axis of the BP I lattice is ≃38.5∘, insensitive to the anchoring strength, and consistent with the experimental finding for a cooling process [Takahashi et al., J. Phys. D 51, 104003 (2018)]. In the latter case, the [100] axis of the BP II lattice makes an angle of 45.0∘ with the direction of unidirectional anchoring. Unidirectional anchoring of strength on the order of 1×10−5Jm−2 is sufficient enough to lock the orientation of the blue phase lattice.