@ -1510,6 +1510,22 @@ endfunction()
#
#
# T h i s i s a c o m m o n f u n c t i o n t o e n s u r e t h a t b u i l d s t r i n g s a r e a l w a y s c r e a t e d
# T h i s i s a c o m m o n f u n c t i o n t o e n s u r e t h a t b u i l d s t r i n g s a r e a l w a y s c r e a t e d
# i n a u n i f o r m w a y .
# i n a u n i f o r m w a y .
# A s i n g l e s t r i n g i s r e t u r n e d c o n t a i n i n g t h e f u l l b u i l d s t r i n g c o n s t r u c t e d f r o m
# a l l a r g u m e n t s .
#
# W h e n M E R G E i s s u p p l i e d a l i s t o f b u i l d s t r i n g s w i l l b e r e t u r n e d w i t h t h e f u l l
# b u i l d s t r i n g a s f i r s t i t e m i n t h e l i s t .
# T h e f u l l o r d e r o f b u i l d s t r i n g s r e t u r n e d i n t h e l i s t w i l l b e :
# - F u l l b u i l d s t r i n g , i n c l u d i n g i d e n t i f i e r a n d r e v i s i o n
# - B u i l d s t r i n g w i t h b o a r d v a r i a n t s r e m o v e d i n a d d i t i o n
# - B u i l d s t r i n g w i t h c p u s e t r e m o v e d i n a d d i t i o n
# - B u i l d s t r i n g w i t h s o c r e m o v e d i n a d d i t i o n
#
# I f B U I L D i s s u p p l i e d , t h e n b u i l d t y p e w i l l b e a p p e n d e d t o e a c h e n t r y i n t h e
# l i s t a b o v e .
# I f R E V I S I O N i s s u p p l i e d o r o b t a i n e d a s s y s t e m w i d e s e t t i n g a b u i l d s t r i n g
# w i t h t h e s a n i t i z e d r e v i s i o n s t r i n g w i l l b e a d d e d i n a d d i t i o n t o t h e
# n o n - r e v i s i o n e d e n t r y f o r e a c h e n t r y .
#
#
# U s a g e :
# U s a g e :
# zephyr_build_string ( <out-variable>
# zephyr_build_string ( <out-variable>
@ -1517,12 +1533,15 @@ endfunction()
# [ B O A R D _ I D E N T I F I E R < i d e n t i f i e r > ]
# [ B O A R D _ I D E N T I F I E R < i d e n t i f i e r > ]
# [ B O A R D _ R E V I S I O N < r e v i s i o n > ]
# [ B O A R D _ R E V I S I O N < r e v i s i o n > ]
# [ B U I L D < t y p e > ]
# [ B U I L D < t y p e > ]
# [ M E R G E [ R E V E R S E ] ]
# )
# )
#
#
# < o u t - v a r i a b l e > : O u t p u t v a r i a b l e w h e r e t h e b u i l d s t r i n g w i l l b e r e t u r n e d .
# < o u t - v a r i a b l e > : O u t p u t v a r i a b l e w h e r e t h e b u i l d s t r i n g w i l l b e r e t u r n e d .
# B O A R D < b o a r d > : B o a r d n a m e t o u s e w h e n c r e a t i n g t h e b u i l d s t r i n g .
# B O A R D < b o a r d > : B o a r d n a m e t o u s e w h e n c r e a t i n g t h e b u i l d s t r i n g .
# B O A R D _ R E V I S I O N < r e v i s i o n > : B o a r d r e v i s i o n t o u s e w h e n c r e a t i n g t h e b u i l d s t r i n g .
# B O A R D _ R E V I S I O N < r e v i s i o n > : B o a r d r e v i s i o n t o u s e w h e n c r e a t i n g t h e b u i l d s t r i n g .
# B U I L D < t y p e > : B u i l d t y p e t o u s e w h e n c r e a t i n g t h e b u i l d s t r i n g .
# B U I L D < t y p e > : B u i l d t y p e t o u s e w h e n c r e a t i n g t h e b u i l d s t r i n g .
# M E R G E : R e t u r n a l i s t o f b u i l d i d e n t i f i e r s i n s t e a d o f a s i n g l e b u i l d s t r i n g .
# R E V E R S E : R e v e r s e t h e l i s t b e f o r e r e t u r n i n g i t .
#
#
# E x a m p l e s
# E x a m p l e s
# c a l l i n g
# c a l l i n g
@ -1533,10 +1552,20 @@ endfunction()
# zephyr_build_string ( build_string BOARD alpha BOARD_REVISION 1.0.0 BUILD debug )
# zephyr_build_string ( build_string BOARD alpha BOARD_REVISION 1.0.0 BUILD debug )
# w i l l r e t u r n t h e s t r i n g ` a l p h a _ 1 _ 0 _ 0 _ d e b u g ` i n ` b u i l d _ s t r i n g ` p a r a m e t e r .
# w i l l r e t u r n t h e s t r i n g ` a l p h a _ 1 _ 0 _ 0 _ d e b u g ` i n ` b u i l d _ s t r i n g ` p a r a m e t e r .
#
#
# c a l l i n g
# zephyr_build_string ( build_string BOARD alpha BOARD_IDENTIFIER /soc/bar )
# w i l l r e t u r n t h e s t r i n g ` a l p h a _ s o c _ b a r ` i n ` b u i l d _ s t r i n g ` p a r a m e t e r .
#
# c a l l i n g
# zephyr_build_string ( build_string BOARD alpha BOARD_REVISION 1.0.0 BOARD_IDENTIFIER /soc/bar MERGE )
# w i l l r e t u r n a l i s t o f t h e f o l l o w i n g s t r i n g s
# ` a l p h a _ s o c _ b a r _ 1 _ 0 _ 0 ; a l p h a _ s o c _ b a r ; a l p h a _ s o c _ 1 _ 0 _ 0 ; a l p h a _ s o c ; a l p h a _ 1 _ 0 _ 0 ; a l p h a ` i n ` b u i l d _ s t r i n g ` p a r a m e t e r .
#
function ( zephyr_build_string outvar )
function ( zephyr_build_string outvar )
set ( options MERGE REVERSE )
set ( single_args BOARD BOARD_IDENTIFIER BOARD_REVISION BUILD )
set ( single_args BOARD BOARD_IDENTIFIER BOARD_REVISION BUILD )
cmake_parse_arguments ( BUILD_STR "" "${single_args}" "" ${ ARGN } )
cmake_parse_arguments ( BUILD_STR "${options} " "${single_args}" "" ${ ARGN } )
if ( BUILD_STR_UNPARSED_ARGUMENTS )
if ( BUILD_STR_UNPARSED_ARGUMENTS )
message ( FATAL_ERROR
message ( FATAL_ERROR
" zephyr_build_string ( ${ ARGV0 } <val> ... ) g i v e n u n k n o w n a r g u m e n t s : "
" zephyr_build_string ( ${ ARGV0 } <val> ... ) g i v e n u n k n o w n a r g u m e n t s : "
@ -1558,20 +1587,30 @@ function(zephyr_build_string outvar)
)
)
endif ( )
endif ( )
set ( ${ outvar } ${ BUILD_STR_BOARD } )
string ( REPLACE "/" ";" str_segment_list "${BUILD_STR_BOARD}${BUILD_STR_BOARD_IDENTIFIER}" )
string ( REPLACE "." "_" revision_string "${BUILD_STR_BOARD_REVISION}" )
if ( DEFINED BUILD_STR_BOARD_IDENTIFIER )
string ( JOIN "_" ${ outvar } ${ str_segment_list } ${ revision_string } ${ BUILD_STR_BUILD } )
string ( REPLACE "/" "_" variant_string ${ BUILD_STR_BOARD_IDENTIFIER } )
set ( ${ outvar } "${${outvar}}${variant_string}" )
endif ( )
if ( BUILD_STR_MERGE )
if ( DEFINED BUILD_STR_BOARD_REVISION )
string ( JOIN "_" variant_string ${ str_segment_list } ${ BUILD_STR_BUILD } )
list ( APPEND ${ outvar } "${variant_string}" )
endif ( )
list ( POP_BACK str_segment_list )
while ( NOT str_segment_list STREQUAL "" )
if ( DEFINED BUILD_STR_BOARD_REVISION )
if ( DEFINED BUILD_STR_BOARD_REVISION )
string ( REPLACE "." "_" revision_string ${ BUILD_STR_BOARD_REVISION } )
string ( JOIN "_" variant_string ${ str_segment_list } ${ revision_string } ${ BUILD_STR_BUILD } )
set ( ${ outvar } "${${outvar}}_${revision_string}" )
list ( APPEND ${ outvar } "${variant_string}" )
endif ( )
string ( JOIN "_" variant_string ${ str_segment_list } ${ BUILD_STR_BUILD } )
list ( APPEND ${ outvar } "${variant_string}" )
list ( POP_BACK str_segment_list )
endwhile ( )
endif ( )
endif ( )
if ( BUILD_STR_BUILD )
if ( BUILD_STR_REVERSE )
set ( ${ outvar } "${${outvar}}_${BUILD_STR_BUILD}" )
li st( REVERSE ${ outvar } )
endif ( )
endif ( )
# T h i s u p d a t e s t h e p r o v i d e d o u t v a r i n p a r e n t scope ( callers scope )
# T h i s u p d a t e s t h e p r o v i d e d o u t v a r i n p a r e n t scope ( callers scope )
@ -2449,6 +2488,7 @@ endfunction()
# f i l e s a r e r e t u r n e d . C o n f i g u r a t i o n f i l e s w i l l b e :
# f i l e s a r e r e t u r n e d . C o n f i g u r a t i o n f i l e s w i l l b e :
# - D T S : O v e r l a y files ( .overlay )
# - D T S : O v e r l a y files ( .overlay )
# - K c o n f i g : C o n f i g fragments ( .conf )
# - K c o n f i g : C o n f i g fragments ( .conf )
# - d e f c o n f i g : d e f c o n f i g files ( _defconfig )
# T h e c o n f f i l e s e a r c h w i l l r e t u r n e x i s t i n g c o n f i g u r a t i o n
# T h e c o n f f i l e s e a r c h w i l l r e t u r n e x i s t i n g c o n f i g u r a t i o n
# f i l e s f o r t h e c u r r e n t b o a r d .
# f i l e s f o r t h e c u r r e n t b o a r d .
# C O N F _ F I L E S t a k e s t h e f o l l o w i n g a d d i t i o n a l a r g u m e n t s :
# C O N F _ F I L E S t a k e s t h e f o l l o w i n g a d d i t i o n a l a r g u m e n t s :
@ -2467,6 +2507,7 @@ endfunction()
#
#
# D T S < l i s t > : L i s t t o a p p e n d D T S o v e r l a y f i l e s i n < p a t h > t o
# D T S < l i s t > : L i s t t o a p p e n d D T S o v e r l a y f i l e s i n < p a t h > t o
# K C O N F < l i s t > : L i s t t o a p p e n d K c o n f i g f r a g m e n t f i l e s i n < p a t h > t o
# K C O N F < l i s t > : L i s t t o a p p e n d K c o n f i g f r a g m e n t f i l e s i n < p a t h > t o
# D E F C O N F < l i s t > : L i s t t o a p p e n d _ d e f c o n f i g f i l e s i n < p a t h > t o
# B U I L D < t y p e > : B u i l d t y p e t o i n c l u d e f o r s e a r c h .
# B U I L D < t y p e > : B u i l d t y p e t o i n c l u d e f o r s e a r c h .
# F o r e x a m p l e :
# F o r e x a m p l e :
# B U I L D d e b u g , w i l l l o o k f o r < b o a r d > _ d e b u g . c o n f
# B U I L D d e b u g , w i l l l o o k f o r < b o a r d > _ d e b u g . c o n f
@ -2490,7 +2531,7 @@ Please provide one of following: APPLICATION_ROOT, CONF_FILES")
set ( single_args APPLICATION_ROOT )
set ( single_args APPLICATION_ROOT )
elseif ( ${ ARGV0 } STREQUAL CONF_FILES )
elseif ( ${ ARGV0 } STREQUAL CONF_FILES )
set ( options REQUIRED )
set ( options REQUIRED )
set ( single_args BOARD BOARD_REVISION DTS KCONF BUILD SUFFIX )
set ( single_args BOARD BOARD_REVISION BOARD_IDENTIFIER DTS KCONF DEFCONFIG BUILD SUFFIX )
set ( multi_args CONF_FILES NAMES )
set ( multi_args CONF_FILES NAMES )
endif ( )
endif ( )
@ -2548,24 +2589,23 @@ Relative paths are only allowed with `-D${ARGV1}=<path>`")
if ( DEFINED BOARD_REVISION )
if ( DEFINED BOARD_REVISION )
set ( FILE_BOARD_REVISION ${ BOARD_REVISION } )
set ( FILE_BOARD_REVISION ${ BOARD_REVISION } )
endif ( )
endif ( )
if ( DEFINED BOARD_IDENTIFIER )
set ( FILE_BOARD_IDENTIFIER ${ BOARD_IDENTIFIER } )
endif ( )
endif ( )
endif ( )
if ( FILE_NAMES )
if ( FILE_NAMES )
set ( dts_filename_list ${ FILE_NAMES } )
set ( dts_filename_list ${ FILE_NAMES } )
set ( kconf_filename_list ${ FILE_NAMES } )
set ( kconf_filename_list ${ FILE_NAMES } )
else ( )
else ( )
zephyr_build_string ( filename
zephyr_build_string ( filename_list
B O A R D $ { F I L E _ B O A R D }
B U I L D $ { F I L E _ B U I L D }
)
set ( filename_list ${ filename } )
zephyr_build_string ( filename
B O A R D $ { F I L E _ B O A R D }
B O A R D $ { F I L E _ B O A R D }
B O A R D _ R E V I S I O N $ { F I L E _ B O A R D _ R E V I S I O N }
B O A R D _ R E V I S I O N $ { F I L E _ B O A R D _ R E V I S I O N }
B O A R D _ I D E N T I F I E R $ { F I L E _ B O A R D _ I D E N T I F I E R }
B U I L D $ { F I L E _ B U I L D }
B U I L D $ { F I L E _ B U I L D }
M E R G E R E V E R S E
)
)
list ( APPEND filename_list ${ filename } )
list ( REMOVE_DUPLICATES filename_list )
list ( REMOVE_DUPLICATES filename_list )
set ( dts_filename_list ${ filename_list } )
set ( dts_filename_list ${ filename_list } )
list ( TRANSFORM dts_filename_list APPEND ".overlay" )
list ( TRANSFORM dts_filename_list APPEND ".overlay" )
@ -2649,6 +2689,19 @@ Relative paths are only allowed with `-D${ARGV1}=<path>`")
message ( DEPRECATION "prj_<build>.conf was deprecated after Zephyr 3.5,"
message ( DEPRECATION "prj_<build>.conf was deprecated after Zephyr 3.5,"
" y o u s h o u l d s w i t c h t o u s i n g - D F I L E _ S U F F I X i n s t e a d " )
" y o u s h o u l d s w i t c h t o u s i n g - D F I L E _ S U F F I X i n s t e a d " )
endif ( )
endif ( )
if ( FILE_DEFCONFIG )
foreach ( path ${ FILE_CONF_FILES } )
foreach ( filename ${ filename_list } )
if ( EXISTS ${ path } / ${ filename } _defconfig )
list ( APPEND ${ FILE_DEFCONFIG } ${ path } / ${ filename } _defconfig )
endif ( )
endforeach ( )
endforeach ( )
# T h i s u p d a t e s t h e p r o v i d e d l i s t i n p a r e n t scope ( callers scope )
set ( ${ FILE_DEFCONFIG } ${ ${FILE_DEFCONFIG } } PARENT_SCOPE )
endif ( )
endif ( )
endif ( )
endfunction ( )
endfunction ( )