refactor cmake and move plugins