@ -1,8 +1,24 @@
# S u p p o r t m a c r o s f o r c r e a t i n g C a l a m a r e s b r a n d i n g c o m p o n e n t s .
#
# C a l a m a r e s b r a n d i n g c o m p o n e n t s h a v e t w o p a r t s :
# - a b r a n d i n g . d e s c f i l e t h a t t e l l s C a l a m a r e s h o w t o d e s c r i b e t h e p r o d u c t
# ( e . g . s t r i n g s l i k e " G e n e r i c G N U / L i n u x " ) a n d t h e n a m e o f a Q M L f i l e
# ( t h e " s l i d e s h o w " ) t h a t i s d i s p l a y e d d u r i n g i n s t a l l a t i o n .
# - t h e Q M L f i l e s t h e m s e l v e s , p l u s s u p p o r t i n g i m a g e s e t c .
#
# B r a n d i n g c o m p o n e n t s c a n b e c r e a t e d i n s i d e t h e C a l a m a r e s s o u r c e t r e e
# ( t h e r e i s o n e e x a m p l e t h e ` d e f a u l t / ` b r a n d i n g , w h i c h i s a l s o c o n n e c t e d
# t o t h e d e f a u l t c o n f i g u r a t i o n s h i p p e d w i t h C a l a m a r e s ) , b u t t h e y c a n b e
# b u i l t o u t s i d e o f , a n d l a r g e l y i n d e p e n d e n t l y o f , C a l a m a r e s b y u s i n g
# t h e s e C M a k e m a c r o s .
#
# S e e t h e c a l a m a r e s - e x a m p l e s r e p o s i t o r y f o r m o r e e x a m p l e s .
#
include ( CMakeParseArguments )
include ( CMakeColors )
# U s a g e calamares_add_branding ( NAME <name> [SUBDIRECTORY <dir>] )
# U s a g e calamares_add_branding ( <name> [DIRECTORY <dir>] [SUBDIRECTORIES <dir> ... ])
#
# A d d s a b r a n d i n g c o m p o n e n t t o t h e b u i l d :
# - t h e c o m p o n e n t ' s t o p - l e v e l f i l e s a r e c o p i e d i n t o t h e b u i l d - d i r ;
@ -14,30 +30,31 @@ include( CMakeColors )
# w i t h t h e g i v e n < n a m e > , w h i c h i s u s u a l l y t h e n a m e o f t h e
# d i r e c t o r y c o n t a i n i n g t h e c o m p o n e n t , a n d w h i c h m u s t m a t c h t h e
# * c o m p o n e n t N a m e * i n ` b r a n d i n g . d e s c ` .
function ( calamares_add_branding )
set ( _CABT_SUBDIRECTORY "." )
cmake_parse_arguments ( _CABT "" "NAME;SUBDIRECTORY" "" ${ ARGN } )
if ( NOT _CABT_NAME )
message ( FATAL_ERROR "Branding component must have a NAME" )
endif ( )
set ( NAME ${ _CABT_NAME } )
set ( SUBDIRECTORY ${ _CABT_SUBDIRECTORY } )
#
# I f S U B D I R E C T O R I E S a r e g i v e n , t h e n t h o s e a r e copied ( each one level deep )
# t o t h e i n s t a l l a t i o n l o c a t i o n a s w e l l , p r e s e r v i n g t h e s u b d i r e c t o r y n a m e .
function ( calamares_add_branding NAME )
set ( _CABT_DIRECTORY "." )
cmake_parse_arguments ( _CABT "" "DIRECTORY" "SUBDIRECTORIES" ${ ARGN } )
set ( SUBDIRECTORY ${ _CABT_DIRECTORY } )
set ( _brand_dir ${ _CABT_DIRECTORY } )
set ( BRANDING_DIR share/calamares/branding )
set ( BRANDING_COMPONENT_DESTINATION ${ BRANDING_DIR } / ${ NAME } )
# W e g l o b a l l t h e f i l e s i n s i d e t h e s u b d i r e c t o r y , a n d w e m a k e s u r e t h e y a r e
# s y n c e d w i t h t h e b i n d i r s t r u c t u r e a n d i n s t a l l e d .
file ( GLOB BRANDING_COMPONENT_FILES RELATIVE ${ CMAKE_CURRENT_SOURCE_DIR } / ${ SUBDIRECTORY } "${SUBDIRECTORY}/*" )
foreach ( _subdir "" ${ _CABT_SUBDIRECTORIES } )
file ( GLOB BRANDING_COMPONENT_FILES RELATIVE ${ CMAKE_CURRENT_SOURCE_DIR } / ${ _brand_dir } "${_brand_dir}/${_subdir}/*" )
message ( STATUS "${BRANDING_COMPONENT_FILES}" )
foreach ( BRANDING_COMPONENT_FILE ${ BRANDING_COMPONENT_FILES } )
if ( NOT IS_DIRECTORY ${ CMAKE_CURRENT_SOURCE_DIR } / ${ SUBDIRECTORY } / ${ BRANDING_COMPONENT_FILE } )
configure_file ( ${ SUBDIRECTORY } / ${ BRANDING_COMPONENT_FILE } ${ SUBDIRECTORY } / ${ BRANDING_COMPONENT_FILE } COPYONLY )
set ( _subpath ${ _brand_dir } / ${ BRANDING_COMPONENT_FILE } )
if ( NOT IS_DIRECTORY ${ CMAKE_CURRENT_SOURCE_DIR } / ${ _subpath } )
configure_file ( ${ _subpath } ${ _subpath } COPYONLY )
install ( FILES ${ CMAKE_CURRENT_BINARY_DIR } / ${ SUBDIRECTORY} / ${ BRANDING_COMPONENT_FILE }
D E S T I N A T I O N $ { B R A N D I N G _ C O M P O N E N T _ D E S T I N A T I O N } )
install ( FILES ${ CMAKE_CURRENT_BINARY_DIR } / ${ _subpath }
D E S T I N A T I O N $ { B R A N D I N G _ C O M P O N E N T _ D E S T I N A T I O N } / $ { _ s u b d i r } / )
endif ( )
endforeach ( )
endforeach ( )
message ( "-- ${BoldYellow}Found ${CALAMARES_APPLICATION_NAME} branding component: ${BoldRed}${NAME}${ColorReset}" )
if ( NOT CMAKE_BUILD_TYPE STREQUAL "Release" )
@ -46,7 +63,7 @@ function( calamares_add_branding )
endif ( )
endfunction ( )
# U s a g e calamares_add_branding_translations ( NAME <name> [ SUB DIRECTORY <dir>] )
# U s a g e calamares_add_branding_translations ( <name> [ DIRECTORY <dir>] )
#
# A d d s t h e t r a n s l a t i o n s f o r a b r a n d i n g c o m p o n e n t t o t h e b u i l d :
# - t h e c o m p o n e n t ' s l a n g / d i r e c t o r y i s s c a n n e d f o r . t s f i l e s
@ -55,15 +72,11 @@ endfunction()
# T r a n s l a t i o n f i l e s m u s t b e c a l l e d c a l a m a r e s - < n a m e > _ < l a n g > . t s . O p t i o n a l l y
# t h e l a n g / d i r i s f o u n d i n t h e g i v e n < d i r > i n s t e a d o f t h e c u r r e n t s o u r c e
# d i r e c t o r y .
function ( calamares_add_branding_translations )
set ( _CABT_SUBDIRECTORY "." )
cmake_parse_arguments ( _CABT "" "NAME;SUBDIRECTORY" "" ${ ARGN } )
if ( NOT _CABT_NAME )
message ( FATAL_ERROR "Branding component must have a NAME" )
endif ( )
set ( NAME ${ _CABT_NAME } )
set ( SUBDIRECTORY ${ _CABT_SUBDIRECTORY } )
function ( calamares_add_branding_translations NAME )
set ( _CABT_DIRECTORY "." )
cmake_parse_arguments ( _CABT "" "DIRECTORY" "" ${ ARGN } )
set ( SUBDIRECTORY ${ _CABT_DIRECTORY } )
set ( _brand_dir ${ _CABT_DIRECTORY } )
set ( BRANDING_DIR share/calamares/branding )
set ( BRANDING_COMPONENT_DESTINATION ${ BRANDING_DIR } / ${ NAME } )
@ -78,19 +91,23 @@ function( calamares_add_branding_translations )
endif ( )
endfunction ( )
# U s a g e calamares_add_branding_subdirectory ( <dir> )
# U s a g e calamares_add_branding_subdirectory ( <dir> [SUBDIRECTORIES <dir> ...] )
#
# A d d s a b r a n d i n g c o m p o n e n t f r o m a s u b d i r e c t o r y :
# - i f t h e r e i s a C M a k e L i s t s . t x t , u s e t h a t
# - o t h e r w i s e a s s u m e a " s t a n d a r d " s e t u p w i t h t o p - l e v e l f i l e s a n d a l a n g / d i r f o r t r a n s l a t i o n s
#
# I f S U B D I R E C T O R I E S a r e g i v e n , t h e y a r e r e l a t i v e t o < d i r > , a n d a r e
# copied ( one level deep ) t o t h e i n s t a l l l o c a t i o n a s w e l l .
function ( calamares_add_branding_subdirectory SUBDIRECTORY )
cmake_parse_arguments ( _CABS "" "" "SUBDIRECTORIES" ${ ARGN } )
if ( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/CMakeLists.txt" )
add_subdirectory ( ${ SUBDIRECTORY } )
elseif ( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/branding.desc" )
calamares_add_branding ( NAME ${ SUBDIRECTORY } SUBDIRECTORY ${ SUBDIRECTORY } )
calamares_add_branding ( ${ SUBDIRECTORY } DIRECTORY ${ SUBDIRECTORY } SUBDIRECTORIES ${ _CABS_SUBDIRECTORIES } )
if ( IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/lang" )
calamares_add_branding_translations ( NAME ${ SUBDIRECTORY } SUB DIRECTORY ${ SUBDIRECTORY } )
calamares_add_branding_translations ( ${ SUBDIRECTORY } DIRECTORY ${ SUBDIRECTORY } )
endif ( )
else ( )
message ( "-- ${BoldYellow}Warning:${ColorReset} tried to add branding component subdirectory ${BoldRed}${SUBDIRECTORY}${ColorReset} which has no branding.desc." )