File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ class Board:
5151 name : str = None
5252 arch : str = None
5353 soc : str = None
54+ cmake : bool = False
5455 defconfigs : list [Defconfig ] = field (default_factory = list )
5556 """Representation of a NuttX board directory.
5657
@@ -66,6 +67,7 @@ class Board:
6667 provided).
6768 soc: SoC/chip name (inferred from path.parents[0].stem if not
6869 provided).
70+ cmake: Whether the board supports CMake.
6971 defconfigs: List of `Defconfig` objects found under the
7072 `configs/` subdirectory.
7173 """
@@ -77,6 +79,11 @@ def __post_init__(self):
7779 self .arch = self .path .parents [1 ].stem
7880 if not self .soc :
7981 self .soc = self .path .parents [0 ].stem
82+ if not self .cmake :
83+ files = [
84+ f .name == "CMakeLists.txt" for f in self .path .iterdir () if f .is_file ()
85+ ]
86+ self .cmake = any (files )
8087 self ._parse_defconfigs ()
8188
8289 def _parse_defconfigs (self ):
Original file line number Diff line number Diff line change @@ -111,3 +111,27 @@ def test_board_get_defconfig(nuttxspace_path: Path):
111111 # Test getting a non-existent defconfig
112112 non_existent = board .get_defconfig ("nonexistent_defconfig_xyz" )
113113 assert non_existent is None
114+
115+
116+ @pytest .mark .parametrize ("board_name" , ["nucleo-f746zg" , "a2g-tc397-5v-tft" , "sim" ])
117+ def test_board_supports_cmake (nuttxspace_path : Path , board_name : str ):
118+ """Test Board.cmake property to check CMake support."""
119+ nuttx_repo = nuttxspace_path / "nuttx"
120+ nbe = NuttxBoardExplorer (nuttx_path = nuttx_repo )
121+ nbe .set_board (board_name )
122+ board = nbe .boards [0 ]
123+
124+ assert board .cmake is True , f"Board { board .path } should support CMake"
125+
126+
127+ @pytest .mark .parametrize (
128+ "board_name" , ["arduino-mega2560" , "pic32mx7mmb" , "esp32-devkitc" ]
129+ )
130+ def test_board_does_not_support_cmake (nuttxspace_path : Path , board_name : str ):
131+ """Test Board.cmake property to check CMake support."""
132+ nuttx_repo = nuttxspace_path / "nuttx"
133+ nbe = NuttxBoardExplorer (nuttx_path = nuttx_repo )
134+ nbe .set_board (board_name )
135+ board = nbe .boards [0 ]
136+
137+ assert board .cmake is False , f"Board { board .path } should not support CMake"
You can’t perform that action at this time.
0 commit comments