--- /dev/null
+#include <msp/strings/format.h>
+#include "system.h"
+#ifdef WITH_OPENVR
+#include "openvr/openvrsystem.h"
+#endif
+#ifdef WITH_LIBOVR
+#include "ovr/oculusriftsystem.h"
+#endif
+
+using namespace std;
+
+namespace Msp {
+namespace VR {
+
+System *System::create(const string &type)
+{
+#ifdef WITH_OPENVR
+ if(type=="openvr")
+ return new OpenVRSystem;
+#endif
+#ifdef WITH_LIBOVR
+ if(type=="libovr")
+ return new OculusRiftSystem;
+#endif
+ throw invalid_argument(format("system '%s' not supported", type));
+}
+
+} // namespace VR
+} // namespace Msp