OS X Compatibility

This change affects very little of the actual core and can be completely removed with the removal of 3 lines.
The server appears to run without crashing or race conditions.

Following changes were added:
- OS X has a different type of spinlock, use a compat layer.
- OS X also does not have clock_gettime and CLOCK_MONOTONIC so reimplement these as well
- CMake now can compile from anywhere and not just the current directory (due to not finding the cmake folder in the project root)
- OS X does not have librt; exclude it from CMake target libraries for compile