Skip to content

[MAINTENANCE] Automate Carla libcarla dependencies management in build system #109

@yunlishao

Description

@yunlishao

Task Summary
Automate the management of Carla dependencies by integrating the copy and rename operation of ${CARLA_Root}\PythonAPI\carla\dependencies\ to ${FIXS_Root}\CommonLib\libcarla\ into the build system.

Why is this needed?
Currently, per doc/CARLAdoc.md:35, users must manually copy the Carla dependencies directory after building LibCarla:

Once the build is finished, copy the directory ${CARLA_Root}\PythonAPI\carla\dependencies\ into the ${FIXS_Root}\CommonLib\ and rename the directory as libcarla.

This manual step is error-prone and breaks the automated build workflow established by the dispatch system. Automating this will:

  • Ensure consistent Carla dependency management across development environments
  • Reduce setup friction for new developers
  • Align with existing build automation patterns (yaml-cpp, libevent, CarMaker, dSPACE)
  • Prevent build failures due to missing or incorrectly placed libcarla dependencies

Scope of Work
The automation should integrate into the existing modular build system:

  1. Configuration: Add Carla path detection to dependencies.yaml (similar to existing tool entries)

    • carla_root: Path to Carla installation
    • carla_version: Version tracking (e.g., "0.9.15")
  2. Detection Script: Extend scripts/dispatch/detect_tool_paths.ps1 to locate Carla installation

    • Search common installation paths: C:\CARLA, C:\Program Files\CARLA, user-specified paths
    • Validate PythonAPI\carla\dependencies\ exists
    • Return Carla root path and version
  3. Build Script: Create new dispatch script scripts\dispatch\6_carla_dependencies.ps1

    • Check if ${CARLA_Root}\PythonAPI\carla\dependencies\ exists
    • Copy directory to ${FIXS_Root}\CommonLib\libcarla\
    • Handle existing libcarla directory (backup/overwrite with user confirmation in manual mode)
    • Log operation to build.log and build_summary.log
    • Skip gracefully if Carla not detected (not all developers need Carla)
  4. Integration: Update dispatch.bat to call the new script after external libraries step

    • Execute after 1_external_libraries.bat (libcarla is an external dependency)
    • Before 2_core_components.bat (VirtualEnvironment.lib depends on libcarla headers)
  5. Documentation: Update doc/BUILD.md and doc/CARLAdoc.md

    • Document automated Carla dependency management
    • Explain how to configure Carla path in dependencies.yaml
    • Note manual fallback if auto-detection fails

Environment (if version-specific)

  • CARLA version: 0.9.15 (current target version per doc/CARLAdoc.md)
  • Visual Studio: 2022 17.8 (MSVC 14.3, per Carla build requirements)
  • Build system: PowerShell-based dispatch scripts (Windows-only)

Risks or Dependencies

  • Carla installation variability: Unlike MATLAB/dSPACE which have standard install paths, Carla may be in custom locations

    • Mitigation: Support both auto-detection and manual path specification in dependencies.yaml
  • Breaking existing workflows: Some users may have manually managed libcarla with custom modifications

    • Mitigation: Add backup/confirmation logic; document migration path
  • Cross-version compatibility: Future Carla versions may change dependency structure

    • Mitigation: Version-specific handling in detection script; clear error messages
  • Dependency ordering: VirtualEnvironment.lib compilation requires libcarla headers to be in place first

    • Must execute before step 2 (core components) in dispatch sequence

Additional Context
Related documentation:

Example existing automation pattern (dSPACE libraries):

  • Detection in detect_tool_paths.ps1 finds dSPACE installation
  • Build script 4b_carmaker_dspace.ps1 compiles version-specific libraries
  • Output copied to CommonLib/ and build/ directories
  • Logged to build summary files

The Carla automation should follow this established pattern for consistency.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions