Mac Sleep and Xcode

Has anyone else experienced this.
I have an iMac and if I have Xcode running, and the computer goes to sleep… it WON’T wake up by touching the keyboard.(if just beeps)… it will only wake if I wiggle the mouse. If Xcode is NOT running, it will wake up with either a key touch, or the mouse…