When I was diagnosed with severe sleep apnea 15 months ago, I told my HMO that I had to have a machine which could run on 12V DC. They provided one. I bought the matching DC cord from CPAP.com. This setup works fine in the camper. Just be sure that you get a cord which matches the make and model of your machine.
Before the cord arrived, I ran my CPAP setup with a small inverter. That also worked well. I have a
Duracell Pocket Inverter, 100W size; other manufacturers probably make something similar. This inverter plugs into a 12V socket.
I nearly always dry camp, without generator or solar, so I monitor the condition of the battery bank. It recharges quickly when I drive the truck. If I plan to stay somewhere for a few days, I turn the heated humidifier part of the CPAP off or down to conserve power. If I will move camp soon, I run the whole thing. No problems so far.
If you also have a heated hose, watch the power consumption for that.