8000 rp2/Makefile: Add support for BOARD_VARIANTS. · micropython/micropython@0bc1d10 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0bc1d10

Browse files
mattytrentinidpgeorge
authored andcommitted
rp2/Makefile: Add support for BOARD_VARIANTS.
Following stm32. This allows a single board definition to define variants of its configuration.
1 parent 9d6f474 commit 0bc1d10

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

ports/rp2/Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ ifeq ($(DEBUG),1)
2222
CMAKE_ARGS += -DCMAKE_BUILD_TYPE=Debug
2323
endif
2424

25+
ifdef BOARD_VARIANT
26+
CMAKE_ARGS += -DBOARD_VARIANT=${BOARD_VARIANT}
27+
endif
28+
2529
HELP_BUILD_ERROR ?= "See \033[1;31mhttps://github.com/micropython/micropython/wiki/Build-Troubleshooting\033[0m"
2630

2731
all:
@@ -38,3 +42,8 @@ submodules:
3842
GIT_SUBMODULES=$$(cmake -B $(BUILD)/submodules -DECHO_SUBMODULES=1 ${CMAKE_ARGS} -S . 2>&1 | \
3943
grep '^GIT_SUBMODULES=' | cut -d= -f2); \
4044
$(MAKE) -f ../../py/mkrules.mk GIT_SUBMODULES="$${GIT_SUBMODULES}" submodules
45+
46+
query-variants:
47+
@BOARD_VARIANTS=$$(cmake -B $(BUILD)/variants -DECHO_BOARD_VARIANTS=1 ${CMAKE_ARGS} -S . 2>&1 | \
48+
grep '^BOARD_VARIANTS=' | cut -d= -f2); \
49+
echo "VARIANTS: $${BOARD_VARIANTS}"

py/mkrules.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,3 +223,9 @@ if(ECHO_SUBMODULES)
223223
execute_process(COMMAND ${CMAKE_COMMAND} -E echo "GIT_SUBMODULES=${GIT_SUBMODULES}")
224224
message(FATAL_ERROR "Done")
225225
endif()
226+
227+
# Display BOARD_VARIANTS
228+
if(ECHO_BOARD_VARIANTS)
229+
execute_process(COMMAND ${CMAKE_COMMAND} -E echo "BOARD_VARIANTS=${BOARD_VARIANTS}")
230+
message(FATAL_ERROR "Done")
231+
endif()

0 commit comments

Comments
 (0)
0