There is a simple solution to this that solves the problem for all parties:
Remove the government from anything to do with marriage. Let marriage be, as it always has been, a social / religious ceremony. If a church doesn't want to allow gay marriage, you can go to a church that does. Or, if no church will have you, organise a private ceremony yourself.
This way, no church can complain about being forced to perform gay marriages, yet gay marriages can still happen.
Remove the government from anything to do with marriage. Let marriage be, as it always has been, a social / religious ceremony. If a church doesn't want to allow gay marriage, you can go to a church that does. Or, if no church will have you, organise a private ceremony yourself.
This way, no church can complain about being forced to perform gay marriages, yet gay marriages can still happen.