--- /dev/null
+#include <msp/strings/format.h>
+#include "displaydevice.h"
+#ifdef WITH_OPENVR
+#include "openvr/openvrdevice.h"
+#endif
+#ifdef WITH_LIBOVR
+#include "ovr/oculusriftdevice.h"
+#endif
+
+using namespace std;
+
+namespace Msp {
+namespace VR {
+
+DisplayDevice *DisplayDevice::create_device(const string &type)
+{
+#ifdef WITH_OPENVR
+ if(type=="openvr")
+ return new OpenVRDevice;
+#endif
+#ifdef WITH_LIBOVR
+ if(type=="libovr")
+ return new OculusRiftDevice;
+#endif
+ throw invalid_argument(format("device type '%s' not supported", type));
+}
+
+} // namespace VR
+} // namespace Msp