@ -38,6 +38,7 @@
# R E S O U R C E S r e s o u r c e - f i l e
# [ N O _ I N S T A L L ]
# [ S H A R E D _ L I B ]
# [ E M E R G E N C Y ]
# )
include ( CMakeParseArguments )
@ -47,7 +48,7 @@ include( CMakeColors )
function ( calamares_add_plugin )
# p a r s e arguments ( name needs to be saved before passing ARGN into the macro )
set ( NAME ${ ARGV0 } )
set ( options NO_INSTALL SHARED_LIB )
set ( options NO_INSTALL SHARED_LIB EMERGENCY )
set ( oneValueArgs NAME TYPE EXPORT_MACRO RESOURCES )
set ( multiValueArgs SOURCES UI LINK_LIBRARIES LINK_PRIVATE_LIBRARIES COMPILE_DEFINITIONS )
cmake_parse_arguments ( PLUGIN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ ARGN } )
@ -71,7 +72,7 @@ function( calamares_add_plugin )
# message ( " ${Green}NO_INSTALL:${ColorReset} ${PLUGIN_NO_INSTALL}" )
message ( " ${Green}PLUGIN_DESTINATION:${ColorReset} ${PLUGIN_DESTINATION}" )
if ( PLUGIN_CONFIG_FILES )
if ( INSTALL_CONFIG )
if ( INSTALL_CONFIG AND NOT PLUGIN_NO_INSTALL )
message ( " ${Green}CONFIGURATION_FILES:${ColorReset} ${PLUGIN_CONFIG_FILES} => ${PLUGIN_DATA_DESTINATION}" )
else ( )
message ( " ${Green}CONFIGURATION_FILES:${ColorReset} ${PLUGIN_CONFIG_FILES} => [Skipping installation]" )
@ -92,7 +93,7 @@ function( calamares_add_plugin )
set ( target_type "SHARED" )
endif ( )
li st( APPEND calamares_add_library_args
se t( calamares_add_library_args
" $ { t a r g e t } "
" E X P O R T _ M A C R O " " $ { P L U G I N _ E X P O R T _ M A C R O } "
" T A R G E T _ T Y P E " " $ { t a r g e t _ t y p e } "
@ -115,9 +116,14 @@ function( calamares_add_plugin )
list ( APPEND calamares_add_library_args "COMPILE_DEFINITIONS" ${ PLUGIN_COMPILE_DEFINITIONS } )
endif ( )
list ( APPEND calamares_add_library_args "NO_VERSION" )
if ( PLUGIN_NO_INSTALL )
list ( APPEND calamares_add_library_args "NO_INSTALL" )
endif ( )
list ( APPEND calamares_add_library_args "INSTALL_BINDIR" "${PLUGIN_DESTINATION}" )
list ( APPEND calamares_add_library_args
" N O _ V E R S I O N "
" I N S T A L L _ B I N D I R " " $ { P L U G I N _ D E S T I N A T I O N } "
)
if ( PLUGIN_RESOURCES )
list ( APPEND calamares_add_library_args "RESOURCES" "${PLUGIN_RESOURCES}" )
@ -132,16 +138,21 @@ function( calamares_add_plugin )
set ( _type ${ PLUGIN_TYPE } )
file ( WRITE ${ _file } "# AUTO-GENERATED metadata file\n# Syntax is YAML 1.2\n---\n" )
file ( APPEND ${ _file } "type: \" ${ _type } \"\nname: \"${PLUGIN_NAME}\"\ninterface: \"qtplugin\"\nload: \"lib${target}.so\"\n" )
if ( PLUGIN_EMERGENCY )
file ( APPEND ${ _file } "emergency: true\n" )
endif ( )
endif ( )
install ( FILES ${ CMAKE_CURRENT_BINARY_DIR } / ${ PLUGIN_DESC_FILE }
D E S T I N A T I O N $ { P L U G I N _ D E S T I N A T I O N } )
if ( NOT PLUGIN_NO_INSTALL )
install ( FILES ${ CMAKE_CURRENT_BINARY_DIR } / ${ PLUGIN_DESC_FILE }
D E S T I N A T I O N $ { P L U G I N _ D E S T I N A T I O N } )
if ( INSTALL_CONFIG )
foreach ( PLUGIN_CONFIG_FILE ${ PLUGIN_CONFIG_FILES } )
configure_file ( ${ PLUGIN_CONFIG_FILE } ${ PLUGIN_CONFIG_FILE } COPYONLY )
install ( FILES ${ CMAKE_CURRENT_BINARY_DIR } / ${ PLUGIN_CONFIG_FILE }
D E S T I N A T I O N $ { P L U G I N _ D A T A _ D E S T I N A T I O N } )
endforeach ( )
if ( INSTALL_CONFIG )
foreach ( PLUGIN_CONFIG_FILE ${ PLUGIN_CONFIG_FILES } )
configure_file ( ${ PLUGIN_CONFIG_FILE } ${ PLUGIN_CONFIG_FILE } COPYONLY )
install ( FILES ${ CMAKE_CURRENT_BINARY_DIR } / ${ PLUGIN_CONFIG_FILE }
D E S T I N A T I O N $ { P L U G I N _ D A T A _ D E S T I N A T I O N } )
endforeach ( )
endif ( )
endif ( )
endfunction ( )