move platform depend code to separate source files