From 28d7910faa9ee192d2c3744638fd76b63d9f2355 Mon Sep 17 00:00:00 2001 From: Jesus Armando Anaya Date: Thu, 9 Apr 2026 11:08:13 -0700 Subject: [PATCH] fix(BuildTools): forward --ros2 and --dds-middleware to UE4 editor command line Fixes #9511 --- Util/BuildTools/BuildCarlaUE4.bat | 5 +++++ Util/BuildTools/BuildCarlaUE4.sh | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Util/BuildTools/BuildCarlaUE4.bat b/Util/BuildTools/BuildCarlaUE4.bat index 2c6e70149b7..075e64798c7 100644 --- a/Util/BuildTools/BuildCarlaUE4.bat +++ b/Util/BuildTools/BuildCarlaUE4.bat @@ -75,6 +75,11 @@ if not "%1"=="" ( rem remove quotes from arguments set EDITOR_FLAGS=%EDITOR_FLAGS:"=% +rem Forward ROS2 runtime flags to the UE4 editor command line +if %USE_ROS2% == true ( + set EDITOR_FLAGS=%EDITOR_FLAGS% --ros2 +) + if %REMOVE_INTERMEDIATE% == false ( if %LAUNCH_UE4_EDITOR% == false ( if %BUILD_UE4_EDITOR% == false ( diff --git a/Util/BuildTools/BuildCarlaUE4.sh b/Util/BuildTools/BuildCarlaUE4.sh index b67dd56292c..55dc0e48a0f 100755 --- a/Util/BuildTools/BuildCarlaUE4.sh +++ b/Util/BuildTools/BuildCarlaUE4.sh @@ -19,13 +19,14 @@ USE_PYTORCH=false USE_UNITY=true USE_ROS2=false CHRONO_PATH="" +DDS_MIDDLEWARE="" EDITOR_FLAGS="" GDB= RHI="-vulkan" -OPTS=`getopt -o h --long help,build,rebuild,launch,clean,hard-clean,gdb,opengl,carsim,pytorch,chrono,chrono-path:,ros2,no-simready,no-unity,editor-flags: -n 'parse-options' -- "$@"` +OPTS=`getopt -o h --long help,build,rebuild,launch,clean,hard-clean,gdb,opengl,carsim,pytorch,chrono,chrono-path:,ros2,dds-middleware:,no-simready,no-unity,editor-flags: -n 'parse-options' -- "$@"` eval set -- "$OPTS" @@ -73,6 +74,9 @@ while [[ $# -gt 0 ]]; do --ros2 ) USE_ROS2=true; shift ;; + --dds-middleware ) + DDS_MIDDLEWARE=$2; + shift 2 ;; --no-simready ) USE_SIMREADY=false shift ;; @@ -89,6 +93,16 @@ while [[ $# -gt 0 ]]; do esac done +# Forward ROS2 runtime flags to the UE4 editor command line. +# --ros2 is consumed above for build-time config (OptionalModules.ini); +# the editor also needs it as a runtime flag for CarlaSettings. +if ${USE_ROS2} ; then + EDITOR_FLAGS="${EDITOR_FLAGS} --ros2" +fi +if [ -n "${DDS_MIDDLEWARE}" ] ; then + EDITOR_FLAGS="${EDITOR_FLAGS} --dds-middleware=${DDS_MIDDLEWARE}" +fi + # ============================================================================== # -- Set up environment -------------------------------------------------------- # ==============================================================================