summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorhathach <[email protected]>2025-12-02 14:22:52 +0700
committerhathach <[email protected]>2025-12-02 23:55:24 +0700
commit09e1113aaf1b2618ffe42e9638d68e6047b6f1ef (patch)
treee9e5ed0b237a7cf7a913fe5dd7e3d1709200fd92 /examples
parentc859744784cc396ae0993a16a1935b10fbd9b797 (diff)
adding metrics for computing average compiled size
Diffstat (limited to 'examples')
-rw-r--r--examples/CMakeLists.txt25
1 files changed, 21 insertions, 4 deletions
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index d34c6ed5d..d9f97d598 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -5,7 +5,24 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/../hw/bsp/family_support.cmake)
project(tinyusb_examples C CXX ASM)
-add_subdirectory(device)
-add_subdirectory(dual)
-add_subdirectory(host)
-add_subdirectory(typec)
+set(EXAMPLES_LIST
+ device
+ dual
+ host
+ typec
+ )
+set(MAPJSON_PATTERNS "")
+
+foreach (example ${EXAMPLES_LIST})
+ add_subdirectory(${example})
+ list(APPEND MAPJSON_PATTERNS "${CMAKE_BINARY_DIR}/${example}/*/*.map.json")
+endforeach ()
+
+# Post-build: run metrics.py on all map.json files
+add_custom_target(tinyusb_examples_metrics
+ COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../tools/metrics.py
+ -f tinyusb/src -j -o ${CMAKE_BINARY_DIR}/metrics
+ ${MAPJSON_PATTERNS}
+ COMMENT "Generating average code size metrics"
+ VERBATIM
+ )