Refactor 3rdparty/, splitting out targets into logical pieces

Closes #388