diff options
author | Clyne Sullivan <clyne@bitgloo.com> | 2022-05-22 20:15:17 -0800 |
---|---|---|
committer | Clyne Sullivan <clyne@bitgloo.com> | 2022-05-22 20:15:17 -0800 |
commit | 77ff957e5eb03fb459ea1d56f7bd3b3c3f164699 (patch) | |
tree | c011944f1acb3d625fe981dc6b404857623d229a | |
parent | 29636cfebf58094d61b669d99c08a4f76dc98a8c (diff) |
add formula disable flag
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | source/device_formula.cpp | 25 |
2 files changed, 19 insertions, 8 deletions
@@ -20,7 +20,7 @@ OUTPUT := stmdspgui.exe CXXFLAGS := -std=c++20 -O2 \ -Isource -Isource/imgui -Isource/stmdsp -Isource/serial/include \ -Wall -Wextra -pedantic \ - -DSTMDSP_WIN32 -Wa,-mbig-obj + -DSTMDSP_WIN32 -Wa,-mbig-obj -DSTMDSP_DISABLE_FORMULAS LDFLAGS = -mwindows -lSDL2 -lopengl32 -lsetupapi -lole32 all: $(OUTPUT) diff --git a/source/device_formula.cpp b/source/device_formula.cpp index 9a3372f..e21d374 100644 --- a/source/device_formula.cpp +++ b/source/device_formula.cpp @@ -10,6 +10,15 @@ * If not, see <https://www.gnu.org/licenses/>. */ +#include "stmdsp.hpp" + +#include <algorithm> +#include <random> +#include <string_view> +#include <vector> + +#ifndef STMDSP_DISABLE_FORMULAS + #define exprtk_disable_comments #define exprtk_disable_break_continue #define exprtk_disable_sc_andor @@ -22,13 +31,6 @@ //#define exprtk_disable_caseinsensitivity #include "exprtk.hpp" -#include "stmdsp.hpp" - -#include <algorithm> -#include <random> -#include <string_view> -#include <vector> - static std::random_device randomDevice; std::vector<stmdsp::dacsample_t> deviceGenLoadFormulaEval(const std::string& formulaString) @@ -73,3 +75,12 @@ std::vector<stmdsp::dacsample_t> deviceGenLoadFormulaEval(const std::string& for return samples; } +#else // no formula support + +std::vector<stmdsp::dacsample_t> deviceGenLoadFormulaEval(const std::string&) +{ + return {}; +} + +#endif // STMDSP_DISABLE_FORMULAS + |