Added module metadata file to CalamaresAddPlugin macro.

Also improved output.
This commit is contained in:
Teo Mrnjavac 2014-06-23 17:14:08 +02:00
parent 19da31baa4
commit 125b7914d5
4 changed files with 49 additions and 9 deletions

View File

@ -0,0 +1,19 @@
if(NOT WIN32)
string(ASCII 27 Esc)
set(ColorReset "${Esc}[m")
set(ColorBold "${Esc}[1m")
set(Red "${Esc}[31m")
set(Green "${Esc}[32m")
set(Yellow "${Esc}[33m")
set(Blue "${Esc}[34m")
set(Magenta "${Esc}[35m")
set(Cyan "${Esc}[36m")
set(White "${Esc}[37m")
set(BoldRed "${Esc}[1;31m")
set(BoldGreen "${Esc}[1;32m")
set(BoldYellow "${Esc}[1;33m")
set(BoldBlue "${Esc}[1;34m")
set(BoldMagenta "${Esc}[1;35m")
set(BoldCyan "${Esc}[1;36m")
set(BoldWhite "${Esc}[1;37m")
endif()

View File

@ -5,18 +5,22 @@ function(calamares_add_plugin)
# parse arguments (name needs to be saved before passing ARGN into the macro)
set(NAME ${ARGV0})
set(options NO_INSTALL SHARED_LIB)
set(oneValueArgs NAME TYPE EXPORT_MACRO)
set(oneValueArgs NAME TYPE EXPORT_MACRO CONFIG_FILE)
set(multiValueArgs SOURCES UI LINK_LIBRARIES COMPILE_DEFINITIONS)
cmake_parse_arguments(PLUGIN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(PLUGIN_NAME ${NAME})
set(PLUGIN_DESTINATION ${CMAKE_INSTALL_LIBDIR}/calamares/modules/${PLUGIN_NAME})
message("*** Arguments for ${PLUGIN_NAME}")
message("Sources: ${PLUGIN_SOURCES}")
message("Link libraries: ${PLUGIN_LINK_LIBRARIES}")
message("UI: ${PLUGIN_UI}")
message("TYPE: ${PLUGIN_TYPE}")
message("EXPORT_MACRO: ${PLUGIN_EXPORT_MACRO}")
message("NO_INSTALL: ${PLUGIN_NO_INSTALL}")
include(CMakeColors)
message("${BoldYellow}*** Found ${CALAMARES_APPLICATION_NAME} module: ${BoldRed}${PLUGIN_NAME}${ColorReset}${BoldYellow} ***${ColorReset}")
message(" ${Green}SOURCES:${ColorReset} ${PLUGIN_SOURCES}")
message(" ${Green}LINK_LIBRARIES:${ColorReset} ${PLUGIN_LINK_LIBRARIES}")
message(" ${Green}UI:${ColorReset} ${PLUGIN_UI}")
message(" ${Green}TYPE:${ColorReset} ${PLUGIN_TYPE}")
message(" ${Green}EXPORT_MACRO:${ColorReset} ${PLUGIN_EXPORT_MACRO}")
message(" ${Green}NO_INSTALL:${ColorReset} ${PLUGIN_NO_INSTALL}")
message(" ${Green}CONFIG_FILE:${ColorReset} ${PLUGIN_CONFIG_FILE}")
message(" ${Green}PLUGIN_DESTINATION:${ColorReset} ${PLUGIN_DESTINATION}")
# create target name once for convenience
set(target "calamares_${PLUGIN_TYPE}_${PLUGIN_NAME}")
@ -49,7 +53,14 @@ function(calamares_add_plugin)
list(APPEND calamares_add_library_args "NO_VERSION")
list(APPEND calamares_add_library_args "INSTALL_BINDIR" "${CMAKE_INSTALL_LIBDIR}")
list(APPEND calamares_add_library_args "INSTALL_BINDIR" "${PLUGIN_DESTINATION}")
#message(" ${Green}CalamaresAddLibrary arguments:${ColorReset} ${calamares_add_library_args}")
message("")
calamares_add_library(${calamares_add_library_args})
configure_file(${PLUGIN_CONFIG_FILE} ${PLUGIN_CONFIG_FILE} COPYONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PLUGIN_CONFIG_FILE}
DESTINATION ${PLUGIN_DESTINATION})
endfunction()

View File

@ -2,6 +2,7 @@ include_directories( ${PROJECT_BINARY_DIR}/src/calamares )
calamares_add_plugin( greeting
TYPE pageplugin
EXPORT_MACRO PLUGINDLLEXPORT_PRO
CONFIG_FILE module.conf
SOURCES
GreetingPagePlugin.cpp
GreetingPage.cpp

View File

@ -0,0 +1,9 @@
# Module metadata file for dummy plugin
# Syntax is YAML 1.2
---
type: "view" #core or view
name: "greeting" #the module name. must be unique and same as the parent directory
interface: "qtplugin" #can be: qtplugin, python, process, ...
requires: [] #list of module names that must also be loaded. only applies to
#binary plugins! these are actual link-time dependencies, not
#conceptual dependencies for the setup procedure