Adapt codebase to Windows platform

Create a new module `common`, introduce CMake build files, and adapt
some source files to MSVC particularities.