change COMPILE_DEFINE to CFLAGS_CLI for cmake/make

This commit is contained in:
hathach 2024-06-25 11:31:19 +07:00
parent f9cd5ccdf0
commit 4396ecd22c
No known key found for this signature in database
GPG Key ID: 26FAB84F615C3C52
4 changed files with 9 additions and 7 deletions

2
.idea/cmake.xml generated
View File

@ -3,7 +3,7 @@
<component name="CMakeSharedSettings">
<configurations>
<configuration PROFILE_NAME="pico" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=raspberry_pi_pico -DLOG=1" />
<configuration PROFILE_NAME="pico pio-host" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=raspberry_pi_pico -DLOG=1 -DCOMPILE_DEFINE=&quot;CFG_TUH_RPI_PIO_USB=1&quot;" BUILD_OPTIONS="-v" />
<configuration PROFILE_NAME="pico pio-host" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=raspberry_pi_pico -DLOG=1 -DCFLAGS_CLI=&quot;-DCFG_TUH_RPI_PIO_USB=1&quot;" BUILD_OPTIONS="-v" />
<configuration PROFILE_NAME="feather_rp2040" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=pico_sdk -DPICO_BOARD=adafruit_feather_rp2040 -DLOG=2" />
<configuration PROFILE_NAME="feather_rp2040_max3421" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=feather_rp2040_max3421 -DLOG=2" />
<configuration PROFILE_NAME="metro_rp2040" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=pico_sdk -DPICO_BOARD=adafruit_metro_rp2040 -DLOG=2 -DMAX3421_HOST=1" />

View File

@ -109,6 +109,10 @@ INC += \
BOARD_UPPER = $(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,$(subst z,Z,$(subst -,_,$(BOARD))))))))))))))))))))))))))))
CFLAGS += -DBOARD_$(BOARD_UPPER)
ifdef CFLAGS_CLI
CFLAGS += $(CFLAGS_CLI)
endif
# use max3421 as host controller
ifeq (${MAX3421_HOST},1)
SRC_C += src/portable/analog/max3421/hcd_max3421.c

View File

@ -201,9 +201,8 @@ function(family_configure_common TARGET RTOS)
)
# compile define from command line
if(DEFINED COMPILE_DEFINE)
#separate_arguments(COMPILE_DEFINE_LIST UNIX_COMMAND "${COMPILE_DEFINE}")
target_compile_definitions(${TARGET} PUBLIC ${COMPILE_DEFINE})
if(DEFINED CFLAGS_CLI)
target_compile_options(${TARGET} PUBLIC ${CFLAGS_CLI})
endif()
target_compile_options(${TARGET} PUBLIC ${WARNING_FLAGS_${CMAKE_C_COMPILER_ID}})

View File

@ -176,9 +176,8 @@ function(family_configure_target TARGET RTOS)
set(RTOS_SUFFIX ${RTOS_SUFFIX} PARENT_SCOPE)
# compile define from command line
if(DEFINED COMPILE_DEFINE)
#separate_arguments(COMPILE_DEFINE_LIST UNIX_COMMAND "${COMPILE_DEFINE}")
target_compile_definitions(${TARGET} PUBLIC ${COMPILE_DEFINE})
if(DEFINED CFLAGS_CLI)
target_compile_options(${TARGET} PUBLIC ${CFLAGS_CLI})
endif()
pico_add_extra_outputs(${TARGET})