How to have some parts of code compiling on Android devices only or iOS devices only ?

Hi !

I have got an Android/iOS Cocos2d-x hybrid project. I have got some parts of code in my classes which are specific to iOS or Android devices. How can I do to compile these parts only when the app is launched on a device where they are required ?

Thanks !

cocos2d-x way: (you can see AppDelegate.cpp AppDelegate::initInstance())
#if (CC_TARGET_PLATFORM == CC_PLATFORM_XXX) // XXX means your platform
#endif

ndk way
#ifdef ANDROID
#endif