FC Barcelona and Memphis Depay have reached an agreement for the player to join the Spanish club, following the end of his contract with Olympique Lyonnais.