Add a Macro to Target.hpp and check for a std::threads implementation in Yerbacon.hpp.

This commit is contained in:
Username404 2021-07-31 16:47:00 +02:00
parent 905e7e7e82
commit bf5ca80c4d
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
2 changed files with 8 additions and 3 deletions

View File

@ -6,6 +6,10 @@
#define YBCON_VERSION "UNKNOWN"
#endif
#ifdef __STDC_NO_THREADS__
#error "A valid std::threads implementation is required"
#endif
#include <exception>
#include <string_view>
#include <string>

View File

@ -36,15 +36,16 @@ shared_ptr<Target> Target::forName(string_view name) {
}
}
shared_ptr<Target> target;
#define ADDTARGET(X) target = make_shared<X>(X()); break;
switch (selected) {
#ifdef LUA_HPP
case LUA: target = make_shared<LuaTarget>(LuaTarget()); break;
case LUA: ADDTARGET(LuaTarget)
#endif
#ifdef JS_HPP
case JS: target = make_shared<JsTarget>(JsTarget()); break;
case JS: ADDTARGET(JsTarget)
#endif
#ifdef PY_HPP
case PY: target = make_shared<PyTarget>(PyTarget()); break;
case PY: ADDTARGET(PyTarget)
#endif
case NONE:
default: {