The requirements are:
1: Build the orphanage for Emily up to the point where she has her new dress.
2: Complete Mira's quest until the point she likes anal. (need to finish the ritual)
3: In the afternoon have sex with Mira and wait until Mira has an orgasm then change positions. If you completed Emily's quest up to the point where she has her new dress she will now find out that you have sex with Mira and confront you.
4: Talk to Emily again at her bed. IIRC is after sex, If you didn't start a relationship with Emily you now have a chance to change your mind. Either way if Mira didn't know about the MC and Emily's actions the MC will afterwards have to tell Mira about it.
5: The next time you fuck Mira in the afternoon and she has an orgasm Emily will show up again and start masturbating. Depening on her corruption (need 15+) you have the option to invite her in.
If you want to check the Walkthrough, the steps are in the Mira section: