diff --git a/Source/Engine/Core/Config.h b/Source/Engine/Core/Config.h index 014ebb0c2..810217050 100644 --- a/Source/Engine/Core/Config.h +++ b/Source/Engine/Core/Config.h @@ -30,13 +30,17 @@ #endif // Enable logging service (saving log to file, can be disabled using -nolog command line) +#ifndef LOG_ENABLE #define LOG_ENABLE 1 +#endif // Enable crash reporting service (stack trace and crash dump collecting) #define CRASH_LOG_ENABLE (!BUILD_RELEASE) // Enable/disable assertion +#ifndef ENABLE_ASSERTION #define ENABLE_ASSERTION (!BUILD_RELEASE) +#endif // Enable/disable assertion for Engine low layers #define ENABLE_ASSERTION_LOW_LAYERS ENABLE_ASSERTION && (BUILD_DEBUG || FLAX_TESTS) diff --git a/Source/Tools/Flax.Build/Build/ProjectTarget.cs b/Source/Tools/Flax.Build/Build/ProjectTarget.cs index 77b7cfe94..e408452a0 100644 --- a/Source/Tools/Flax.Build/Build/ProjectTarget.cs +++ b/Source/Tools/Flax.Build/Build/ProjectTarget.cs @@ -79,6 +79,10 @@ namespace Flax.Build options.CompileEnv.PreprocessorDefinitions.Add("USE_LARGE_WORLDS"); options.ScriptingAPI.Defines.Add("USE_LARGE_WORLDS"); } + if (!EngineConfiguration.UseLogInRelease && !IsEditor) + { + options.CompileEnv.PreprocessorDefinitions.Add("LOG_ENABLE=0"); + } // Add include paths for this and all referenced projects sources foreach (var project in Project.GetAllProjects()) diff --git a/Source/Tools/Flax.Build/Configuration.cs b/Source/Tools/Flax.Build/Configuration.cs index f6ad3b3a5..3bb84760e 100644 --- a/Source/Tools/Flax.Build/Configuration.cs +++ b/Source/Tools/Flax.Build/Configuration.cs @@ -276,6 +276,12 @@ namespace Flax.Build [CommandLine("useDotNet", "1 to enable .NET support in build, 0 to enable Mono support in build")] public static bool UseDotNet = true; + /// + /// True if enable logging in Release game builds. + /// + [CommandLine("useLogInRelease", "Can be used to disable logging in Release game builds")] + public static bool UseLogInRelease = true; + public static bool WithCSharp(NativeCpp.BuildOptions options) { return UseCSharp || options.Target.IsEditor;