From 03efedab37959714b93e2ec544d72973ee261af8 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 1 Sep 2024 16:55:58 -0500 Subject: [PATCH] Adds a TORQUE_TOOLS_EXT cmake flag/preprocessor and moves the systemCommand method into that so that one can lock down full shell command execution calls without dropping tools support --- Engine/source/console/consoleFunctions.cpp | 4 +++- Tools/CMake/modules/tools.cmake | 3 +++ Tools/CMake/torque_configs.cmake | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Engine/source/console/consoleFunctions.cpp b/Engine/source/console/consoleFunctions.cpp index 0e002fb11b..cff1d87b22 100644 --- a/Engine/source/console/consoleFunctions.cpp +++ b/Engine/source/console/consoleFunctions.cpp @@ -2803,7 +2803,7 @@ DefineEngineFunction(getTimestamp, const char*, (), , return returnBuffer; } -#ifdef TORQUE_TOOLS +#ifdef TORQUE_TOOLS_EXT_COMMANDS DefineEngineFunction(systemCommand, S32, (const char* commandLineAction, const char* callBackFunction), (""), "") { if (commandLineAction && commandLineAction[0] != '\0') @@ -2819,7 +2819,9 @@ DefineEngineFunction(systemCommand, S32, (const char* commandLineAction, const c return -1; } +#endif +#ifdef TORQUE_TOOLS const char* getDocsLink(const char* filename, U32 lineNumber) { Vector fileStringSplit; diff --git a/Tools/CMake/modules/tools.cmake b/Tools/CMake/modules/tools.cmake index 62cad2f3b6..dcd3b3d53e 100644 --- a/Tools/CMake/modules/tools.cmake +++ b/Tools/CMake/modules/tools.cmake @@ -16,3 +16,6 @@ if(TORQUE_TOOLS) source_group(TREE "${CMAKE_SOURCE_DIR}/Engine/source/environment/editors/" PREFIX "Modules/TOOLS/environment" FILES ${TORQUE_TOOLS_SOURCES2}) source_group(TREE "${CMAKE_SOURCE_DIR}/Engine/source/forest/editor/" PREFIX "Modules/TOOLS/forest" FILES ${TORQUE_TOOLS_SOURCES3}) endif(TORQUE_TOOLS) +if(TORQUE_TOOLS_EXT_COMMANDS) + set(TORQUE_COMPILE_DEFINITIONS ${TORQUE_COMPILE_DEFINITIONS} TORQUE_TOOLS_EXT_COMMANDS) +endif(TORQUE_TOOLS_EXT_COMMANDS) \ No newline at end of file diff --git a/Tools/CMake/torque_configs.cmake b/Tools/CMake/torque_configs.cmake index 7cfbd2f6b1..739a7b28b8 100644 --- a/Tools/CMake/torque_configs.cmake +++ b/Tools/CMake/torque_configs.cmake @@ -71,6 +71,7 @@ advanced_option(TORQUE_DEBUG_NET "debug network" OFF) advanced_option(TORQUE_DEBUG_NET_MOVES "debug network moves" OFF) advanced_option(TORQUE_ENABLE_ASSERTS "enables or disable asserts" OFF) advanced_option(TORQUE_TOOLS "Enable or disable the tools" ON) +advanced_option(TORQUE_TOOLS_EXT_COMMANDS "Enable or disable some extended functionality like shell commands or free write access" OFF) advanced_option(TORQUE_ENABLE_PROFILER "Enable or disable the profiler" OFF) advanced_option(TORQUE_SHOW_LEGACY_FILE_FIELDS "If on, shows legacy direct file path fields in the inspector." OFF)