West Ham have announced the signing of Nikica Jelavic from Hull City on a two-year deal for an undisclosed fee.