diff --git a/CMakeLists.txt b/CMakeLists.txt index 5cb2e5a600..4c6e29be9d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -461,6 +461,16 @@ if(ANDROID) list(APPEND GAME_COMPILE_DEFS TARGET_ANDROID=1) endif () +set(DUSK_ENABLE_CODE_MODS_DEFAULT OFF) +option(DUSK_ENABLE_CODE_MODS "Enable code mods" ${DUSK_ENABLE_CODE_MODS_DEFAULT}) +if (DUSK_ENABLE_CODE_MODS) + if (NOT ANDROID AND NOT IOS AND NOT TVOS) + list(APPEND GAME_COMPILE_DEFS DUSK_CODE_MODS=1) + else () + message(FATAL_ERROR "Code mods not supported on the target platform!") + endif () +endif () + # game_debug is for game code files that we know work when compiled with DEBUG=1 # Of course, if building a release build, this distinction is irrelevant set(GAME_DEBUG_FILES diff --git a/src/dusk/modding/mod_loader.cpp b/src/dusk/modding/mod_loader.cpp index 1f81978176..91afbcc7f0 100644 --- a/src/dusk/modding/mod_loader.cpp +++ b/src/dusk/modding/mod_loader.cpp @@ -412,6 +412,11 @@ static bool checkDuplicateMod(const ModMetadata& metadata, const std::vector #include "miniz.h" +#if __APPLE__ +#include +#endif + namespace dusk::modding { +#if DUSK_CODE_MODS +constexpr bool EnableCodeMods = true; +#else +constexpr bool EnableCodeMods = false; +#endif + class ModBundle { public: virtual ~ModBundle() = default;