From feb36f3f7d73a71ca5c7e9341e8bc2b3e5796783 Mon Sep 17 00:00:00 2001 From: Giacomo Pozzoni Date: Fri, 17 Dec 2021 14:16:18 +0100 Subject: Tools/MMAPs: Show an error when running mmaps_generator built in Debug mode (#27412) * Tools/MMAPs: Show an error when running mmaps_generator built in Debug mode * Fix GCC build (cherry picked from commit 8c80f28581646af110c4d2b316209ef291a95587) --- src/tools/mmaps_generator/PathGenerator.cpp | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/tools/mmaps_generator/PathGenerator.cpp b/src/tools/mmaps_generator/PathGenerator.cpp index ff3cf32e8df..9f7afb54048 100644 --- a/src/tools/mmaps_generator/PathGenerator.cpp +++ b/src/tools/mmaps_generator/PathGenerator.cpp @@ -110,6 +110,13 @@ bool checkDirectories(bool debugOutput, std::vector& dbcLocales) return true; } +int finish(char const* message, int returnValue) +{ + printf("%s", message); + getchar(); // Wait for user input + return returnValue; +} + bool handleArgs(int argc, char** argv, int &mapnum, int &tileX, @@ -128,6 +135,7 @@ bool handleArgs(int argc, char** argv, unsigned int& threads) { char* param = nullptr; + [[maybe_unused]] bool allowDebug = false; for (int i = 1; i < argc; ++i) { if (strcmp(argv[i], "--maxAngle") == 0) @@ -280,6 +288,10 @@ bool handleArgs(int argc, char** argv, offMeshInputPath = param; } + else if (strcmp(argv[i], "--allowDebug") == 0) + { + allowDebug = true; + } else if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-?")) { printf("%s\n", Readme); @@ -299,14 +311,16 @@ bool handleArgs(int argc, char** argv, } } - return true; -} +#ifndef NDEBUG + if (!allowDebug) + { + finish("Build mmaps_generator in RelWithDebInfo or Release mode or it will take hours to complete!!!\nUse '--allowDebug' argument if you really want to run this tool in Debug.\n", -2); + silent = true; + return false; + } +#endif -int finish(char const* message, int returnValue) -{ - printf("%s", message); - getchar(); // Wait for user input - return returnValue; + return true; } std::unordered_map LoadLiquid(std::string const& locale, bool silent, int32 errorExitCode) -- cgit v1.2.3