BP has appointed Meg O'Neill as its chief executive, making her the first female boss of a major oil giant.