Make deps/exprtk dependency optional

This commit is contained in:
WarmUpTill
2026-09-25 21:00:47 +02:00
parent b104f98d02
commit c8f4e524ba
3 changed files with 21 additions and 4 deletions

View File

@@ -2,13 +2,16 @@
#include "obs-module-helper.hpp"
#include <climits>
#ifdef EXPRTK_SUPPORT
#include <exprtk.hpp>
#include <random>
#endif
namespace advss {
std::variant<double, std::string> EvalMathExpression(const std::string &expr)
{
#ifdef EXPRTK_SUPPORT
static auto randomFunc = []() {
thread_local std::mt19937 gen(std::random_device{}());
thread_local std::uniform_real_distribution<double> dis(0.0,
@@ -26,6 +29,7 @@ std::variant<double, std::string> EvalMathExpression(const std::string &expr)
if (parser.compile(expr, expression)) {
return expression.value();
}
#endif
return std::string(obs_module_text(
"AdvSceneSwitcher.math.expressionFail")) +
" \"" + expr + "\"";