You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add Bloaty.cmake module with comprehensive binary analysis targets
* Create per-executable analysis targets and global target
* Support CSV reports, baselines, and specialized template analysis
* Disable by default since it's not available on all systems
* Update AI_GUIDELINES.md with Bloaty usage instructions
* Add Bloaty to the list of optional tools in guidelines
This helps developers identify binary size issues like template
bloat and large static data, which is valuable for performance
optimization and embedded systems development.
The project includes optional support for Bloaty McBloatface, a binary size analyzer. This tool helps identify what's contributing to executable size, which is valuable for embedded systems and performance optimization.
238
+
239
+
Note: Bloaty is disabled by default as it may not be installed on all systems. Enable with `-D<project_name>_ENABLE_BLOATY=ON`.
240
+
241
+
When Bloaty is enabled, it provides several analysis targets for each executable:
242
+
243
+
```bash
244
+
# Basic size analysis for a specific target (e.g., "intro")
245
+
cmake --build build --target bloaty_intro
246
+
247
+
# Generate CSV report
248
+
cmake --build build --target bloaty_intro_csv
249
+
250
+
# Store current binary as a baseline for comparisons
251
+
cmake --build build --target bloaty_intro_store
252
+
253
+
# Analyze template usage (particularly useful for C++ binary bloat)
COMMENT"Analyzing template usage in ${TARGET_NAME}..."
56
+
)
57
+
58
+
message(STATUS"Bloaty McBloatface targets created for ${TARGET_NAME}")
59
+
else()
60
+
message(${myproject_WARNING_TYPE}"Bloaty McBloatface requested but executable not found. Install with 'apt install bloaty' or from https://github.com/google/bloaty")
61
+
endif()
62
+
endfunction()
63
+
64
+
# Function to add bloaty analysis to all executable targets
65
+
function(myproject_enable_bloaty)
66
+
find_program(BLOATYbloaty)
67
+
if(BLOATY)
68
+
# Get all executable targets
69
+
get_all_executable_targets(ALL_TARGETS)
70
+
71
+
# Create global target that will depend on all individual targets
72
+
add_custom_target(bloaty_all)
73
+
74
+
# Create individual bloaty targets for each executable
75
+
foreach(TARGET_NAME${ALL_TARGETS})
76
+
myproject_setup_bloaty(${TARGET_NAME})
77
+
add_dependencies(bloaty_allbloaty_${TARGET_NAME})
78
+
endforeach()
79
+
80
+
message(STATUS"Bloaty McBloatface enabled for all executable targets")
81
+
else()
82
+
message(${myproject_WARNING_TYPE}"Bloaty McBloatface requested but executable not found. Install with 'apt install bloaty' or from https://github.com/google/bloaty")
0 commit comments