Add conditional build stuff

Also removed non-clang compatibility
Removed unused headers
Adding support for cancellation

Also removed unused headers
Support thumbnail cancellation

Also removed unused headers
Updated build settings