Warning, /office/kexi/cmake/modules/CalligraProductSetMacros.cmake is written in an unsupported language. File is not indexed.

0001 # Copyright (c) 2013-2014 Friedrich W. H. Kossebau <kossebau@kde.org>
0002 #
0003 # Redistribution and use is allowed according to the terms of the BSD license.
0004 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
0005 
0006 # Global variables
0007 # CALLIGRA_SHOULD_BUILD_PRODUCTS - list of requested products by the user
0008 # CALLIGRA_NEEDED_PRODUCTS - list of internal needed products
0009 # CALLIGRA_WANTED_PRODUCTS - list of internal wanted products
0010 # CALLIGRA_STAGING_PRODUCTS - list of products only in staging mode
0011 # temporary during qt5 port, remove after:
0012 # CALLIGRA_UNPORTED_PRODUCTS - list of products not yet ported
0013 # SHOULD_BUILD_${product_id} - boolean if product should be build
0014 
0015 
0016 macro(calligra_disable_product _product_id _reason)
0017   if (NOT DEFINED SHOULD_BUILD_${_product_id})
0018     message(FATAL_ERROR "Unknown product: ${_product_id}")
0019   endif (NOT DEFINED SHOULD_BUILD_${_product_id})
0020 
0021   set(SHOULD_BUILD_${_product_id} FALSE)
0022   if (DEFINED BUILD_${_product_id}_DISABLE_REASON)
0023     set(BUILD_${_product_id}_DISABLE_REASON "${BUILD_${_product_id}_DISABLE_REASON} / ")
0024   endif (DEFINED BUILD_${_product_id}_DISABLE_REASON)
0025   set(BUILD_${_product_id}_DISABLE_REASON "${BUILD_${_product_id}_DISABLE_REASON}${_reason}")
0026 endmacro()
0027 
0028 # Usage:
0029 #   calligra_drop_product_on_bad_condition(<product_id>
0030 #         NAME_OF_BOOL_VAR1 REASON_TEXT_FOR_DROPPING_ON_FALSE1
0031 #         NAME_OF_BOOL_VAR2 REASON_TEXT_FOR_DROPPING_ON_FALSE2
0032 #         ...
0033 #       )
0034 macro(calligra_drop_product_on_bad_condition _product_id)
0035   if (NOT DEFINED SHOULD_BUILD_${_product_id})
0036     message(FATAL_ERROR "Unknown product: ${_product_id}")
0037   endif (NOT DEFINED SHOULD_BUILD_${_product_id})
0038 
0039   set(_current_flag)
0040   foreach(_arg ${ARGN})
0041     if(DEFINED _current_flag)
0042       if(NOT ${_current_flag})
0043         calligra_disable_product(${_product_id} ${_arg})
0044       endif()
0045       set(_current_flag)
0046     else()
0047       set(_current_flag ${_arg})
0048     endif()
0049   endforeach(_arg)
0050     if(DEFINED _current_flag)
0051     message(FATAL_ERROR "Bad number of arguments for calligra_drop_product_on_bad_condition(${_product_id} ...)")
0052   endif()
0053 endmacro()
0054 
0055 macro(calligra_set_shouldbuild_dependentproduct _product_id _dep_product_id)
0056   # if not already enabled, enable
0057   if (NOT SHOULD_BUILD_${_dep_product_id})
0058     list(APPEND CALLIGRA_NEEDED_PRODUCTS ${_dep_product_id})
0059     set(SHOULD_BUILD_${_dep_product_id} TRUE)
0060     if (DEFINED CALLIGRA_PRODUCT_${_dep_product_id}_needed_dependencies OR
0061         DEFINED CALLIGRA_PRODUCT_${_dep_product_id}_wanted_dependencies)
0062         calligra_set_shouldbuild_productdependencies(${_dep_product_id}
0063             "${CALLIGRA_PRODUCT_${_dep_product_id}_needed_dependencies}"
0064             "${CALLIGRA_PRODUCT_${_dep_product_id}_wanted_dependencies}")
0065     endif (DEFINED CALLIGRA_PRODUCT_${_dep_product_id}_needed_dependencies OR
0066            DEFINED CALLIGRA_PRODUCT_${_dep_product_id}_wanted_dependencies)
0067   endif (NOT SHOULD_BUILD_${_dep_product_id})
0068 endmacro()
0069 
0070 
0071 macro(calligra_set_shouldbuild_productdependencies _product_id _productset_id_needed_dependencies  _productset_id_wanted_dependencies)
0072   # activate all needed products and note the dependency
0073   foreach(_dep_product_id ${_productset_id_needed_dependencies})
0074     list(APPEND CALLIGRA_PRODUCT_${_dep_product_id}_dependents ${_product_id})
0075     calligra_set_shouldbuild_dependentproduct(${_product_id} ${_dep_product_id})
0076   endforeach(_dep_product_id)
0077 
0078   # activate all wanted products
0079   foreach(_dep_product_id ${_productset_id_wanted_dependencies})
0080     calligra_set_shouldbuild_dependentproduct(${_product_id} ${_dep_product_id})
0081   endforeach(_dep_product_id)
0082 endmacro()
0083 
0084 
0085 macro(calligra_drop_unbuildable_products)
0086   # temporary during qt5 port, remove after
0087   if(NOT BUILD_UNPORTED)
0088     foreach(_product_id ${CALLIGRA_UNPORTED_PRODUCTS})
0089       calligra_disable_product(${_product_id} "Not yet ported to Qt5/KF5")
0090     endforeach(_product_id)
0091   endif(NOT BUILD_UNPORTED)
0092 
0093   # first drop all staging products if not enabled
0094   if(NOT CALLIGRA_SHOULD_BUILD_STAGING)
0095     foreach(_product_id ${CALLIGRA_STAGING_PRODUCTS})
0096       calligra_disable_product(${_product_id} "Not ready for release")
0097     endforeach(_product_id)
0098   endif(NOT CALLIGRA_SHOULD_BUILD_STAGING)
0099 
0100   # can assume calligra_all_products has products in down-up order
0101   # 1. check all wanted products and see if they will be built,
0102   #    if not then drop their required products
0103   # TODO!
0104   # 2. check all products if they can be built, if not disable build of depending
0105   foreach(_product_id ${CALLIGRA_ALL_PRODUCTS})
0106     if(NOT SHOULD_BUILD_${_product_id})
0107       if(DEFINED CALLIGRA_PRODUCT_${_product_id}_dependents)
0108         foreach(_dependent_product_id ${CALLIGRA_PRODUCT_${_product_id}_dependents})
0109           calligra_disable_product(${_dependent_product_id} "Required internal dependency missing: ${_product_id}")
0110         endforeach(_dependent_product_id ${CALLIGRA_PRODUCT_${_dep_product_id}_dependents})
0111       endif(DEFINED CALLIGRA_PRODUCT_${_product_id}_dependents)
0112     endif(NOT SHOULD_BUILD_${_product_id})
0113   endforeach(_product_id)
0114 endmacro()
0115 
0116 # backward compatibility: BUILD_app as option or passed as cmake parameter can overwrite product set
0117 # and disable a product if set to FALSE (TRUE was ignored)
0118 macro(calligra_drop_products_on_old_flag _build_id)
0119   string(TOLOWER "${_build_id}" lowercase_build_id)
0120   if (DEFINED BUILD_${lowercase_build_id} AND NOT BUILD_${lowercase_build_id})
0121     foreach(_product_id ${ARGN})
0122       if (NOT DEFINED SHOULD_BUILD_${_product_id})
0123         message(FATAL_ERROR "Unknown product: ${_product_id}")
0124       endif (NOT DEFINED SHOULD_BUILD_${_product_id})
0125       calligra_disable_product(${_product_id} "Disabled by cmake parameter")
0126     endforeach(_product_id)
0127   endif (DEFINED BUILD_${lowercase_build_id} AND NOT BUILD_${lowercase_build_id})
0128 endmacro()
0129 
0130 macro(calligra_set_productset _productset_string)
0131   set(CALLIGRA_SHOULD_BUILD_PRODUCTS "")
0132   # turn into list, _productset_string is not yet one
0133   set(_productset_ids ${_productset_string})
0134   separate_arguments(_productset_ids)
0135   set(_productset_list "")
0136   # _product_id could be a product, feature or product set (predefined or from file)
0137   foreach(_product_id ${_productset_ids})
0138     # be gracefull and compare the productset id case insensitive
0139     string(TOUPPER "${_product_id}" _uppercase_product_id)
0140 
0141     if(_uppercase_product_id STREQUAL "ALL")
0142       list( APPEND CALLIGRA_SHOULD_BUILD_PRODUCTS ${CALLIGRA_ALL_PRODUCTS})
0143     elseif(DEFINED SHOULD_BUILD_${_uppercase_product_id})
0144       list( APPEND CALLIGRA_SHOULD_BUILD_PRODUCTS ${_uppercase_product_id})
0145     else()
0146       # also expects a productset definition filename in all lowercase
0147       string(TOLOWER "${_product_id}" _lowercase_productset_id)
0148       set(_productset_filename "${CMAKE_SOURCE_DIR}/cmake/productsets/${_lowercase_productset_id}.cmake")
0149 
0150       if (NOT EXISTS "${_productset_filename}")
0151         message(FATAL_ERROR "Unknown product, feature or product set: ${_product_id}")
0152       endif (NOT EXISTS "${_productset_filename}")
0153 
0154       # include the productset definition
0155       include(${_productset_filename})
0156       if(NOT CALLIGRA_PRODUCTSET_${_uppercase_product_id})
0157         message(FATAL_ERROR "Product set file \"${_productset_filename}\" did not define a productset named \"${_uppercase_product_id}\".")
0158       endif()
0159 
0160       list( APPEND CALLIGRA_SHOULD_BUILD_PRODUCTS ${_uppercase_product_id})
0161     endif()
0162     list( APPEND _productset_list ${_uppercase_product_id})
0163   endforeach(_product_id)
0164 
0165   string(REPLACE ";" " " _productset_list "${_productset_list}")
0166   set(CALLIGRA_NEEDED_PRODUCTS "")
0167 
0168   message(STATUS "-------------------------------------------------------------------" )
0169   message(STATUS "Configured with product set \"${_productset_list}\"")
0170   message(STATUS "-------------------------------------------------------------------" )
0171 
0172   # backward compatibility: BUILD_app as option or passed as cmake parameter can overwrite product set
0173   # and disable a product if set to FALSE (TRUE was ignored)
0174   foreach(_product_id ${CALLIGRA_ALL_PRODUCTS})
0175     string(TOLOWER "${_product_id}" lowercase_product_id)
0176     if (DEFINED BUILD_${lowercase_product_id})
0177       if(NOT BUILD_${lowercase_product_id})
0178         list(FIND CALLIGRA_SHOULD_BUILD_PRODUCTS ${_product_id} _index)
0179         # remove from product set, if part
0180         if(NOT _index EQUAL -1)
0181           list(REMOVE_AT CALLIGRA_SHOULD_BUILD_PRODUCTS ${_index})
0182         endif(NOT _index EQUAL -1)
0183       endif(NOT BUILD_${lowercase_product_id})
0184     endif (DEFINED BUILD_${lowercase_product_id})
0185   endforeach(_product_id ${CALLIGRA_ALL_PRODUCTS})
0186 
0187   # mark all products of the set as SHOULD_BUILD
0188   foreach(_product_id ${CALLIGRA_SHOULD_BUILD_PRODUCTS})
0189     # check that this product is actually existing
0190     if (NOT DEFINED SHOULD_BUILD_${_product_id})
0191       message(FATAL_ERROR "Unknown product: ${_product_id}")
0192     endif (NOT DEFINED SHOULD_BUILD_${_product_id})
0193 
0194     # mark product as should build, also all dependencies
0195     set(SHOULD_BUILD_${_product_id} TRUE)
0196     if (DEFINED CALLIGRA_PRODUCT_${_product_id}_needed_dependencies OR
0197         DEFINED CALLIGRA_PRODUCT_${_product_id}_wanted_dependencies)
0198         calligra_set_shouldbuild_productdependencies(${_product_id}
0199             "${CALLIGRA_PRODUCT_${_product_id}_needed_dependencies}"
0200             "${CALLIGRA_PRODUCT_${_product_id}_wanted_dependencies}")
0201     endif (DEFINED CALLIGRA_PRODUCT_${_product_id}_needed_dependencies OR
0202            DEFINED CALLIGRA_PRODUCT_${_product_id}_wanted_dependencies)
0203   endforeach(_product_id)
0204 endmacro()
0205 
0206 
0207 # Usage:
0208 #   calligra_define_product(<product_id>
0209 #         [NAME] <product_name>
0210 #         [STAGING]
0211 #         [REQUIRES <product_id1> <feature_id1> ...]
0212 #       )
0213 macro(calligra_define_product _product_id)
0214   # default product name to id, empty deps
0215   set(_product_name "${_product_id}")
0216   set(_needed_dep_product_ids)
0217 
0218   if(DEFINED SHOULD_BUILD_${_product_id})
0219     message(FATAL_ERROR "Product \"${_product_id}\" already defined, as \"${CALLIGRA_PRODUCT_${_product_id}_name}\".")
0220   endif(DEFINED SHOULD_BUILD_${_product_id})
0221 
0222   # parse arguments: two states, "name" or "requires"
0223   set(_current_arg_type "name")
0224   foreach(_arg ${ARGN})
0225     if(${_arg} STREQUAL "NAME")
0226       set(_current_arg_type "name")
0227     elseif(${_arg} STREQUAL "REQUIRES")
0228       set(_current_arg_type "requires")
0229     else(${_arg} STREQUAL "NAME")
0230       if(${_current_arg_type} STREQUAL "name")
0231         if(${_arg} STREQUAL "STAGING")
0232           list(APPEND CALLIGRA_STAGING_PRODUCTS ${_product_id})
0233         elseif(${_arg} STREQUAL "UNPORTED")
0234           # temporary during qt5 port, remove after
0235           list(APPEND CALLIGRA_UNPORTED_PRODUCTS ${_product_id})
0236         else(${_arg} STREQUAL "STAGING")
0237           set(_product_name "${_arg}")
0238         endif(${_arg} STREQUAL "STAGING")
0239       elseif(${_current_arg_type} STREQUAL "requires")
0240         # check that the dependency is actually existing
0241         if(NOT DEFINED SHOULD_BUILD_${_arg})
0242           message(FATAL_ERROR "Unknown product/feature listed as dependency for \"${_product_id}\": \"${_arg}\"")
0243         elseif(CALLIGRA_PRODUCTSET_${_arg})
0244           message(FATAL_ERROR "Productset cannot be a dependency for \"${_product_id}\": \"${_arg}\"")
0245         endif()
0246         list(APPEND _needed_dep_product_ids "${_arg}")
0247       endif(${_current_arg_type} STREQUAL "name")
0248     endif(${_arg} STREQUAL "NAME")
0249   endforeach(_arg)
0250 
0251   # set product vars
0252   set(SHOULD_BUILD_${_product_id} FALSE)
0253   set(CALLIGRA_PRODUCT_${_product_id}_name "${_product_name}")
0254   set(CALLIGRA_PRODUCT_${_product_id}_needed_dependencies ${_needed_dep_product_ids})
0255   list(APPEND CALLIGRA_ALL_PRODUCTS ${_product_id})
0256 endmacro(calligra_define_product)
0257 
0258 
0259 # Usage:
0260 #   calligra_define_feature(<feature_id>
0261 #         [NAME] <feature_name>
0262 #         [STAGING]
0263 #         [REQUIRES <product_id1> <feature_id1> ...]
0264 #       )
0265 macro(calligra_define_feature _product_id)
0266   # default product name to id, empty deps
0267   set(_product_name "${_product_id}")
0268   set(_needed_dep_product_ids)
0269 
0270   if(DEFINED SHOULD_BUILD_${_product_id})
0271     message(FATAL_ERROR "Feature \"${_product_id}\" already defined, as \"${CALLIGRA_PRODUCT_${_product_id}_name}\".")
0272   endif(DEFINED SHOULD_BUILD_${_product_id})
0273 
0274   # parse arguments: two states, "name" or "requires"
0275   set(_current_arg_type "name")
0276   foreach(_arg ${ARGN})
0277     if(${_arg} STREQUAL "NAME")
0278       set(_current_arg_type "name")
0279     elseif(${_arg} STREQUAL "REQUIRES")
0280       set(_current_arg_type "requires")
0281     else(${_arg} STREQUAL "NAME")
0282       if(${_current_arg_type} STREQUAL "name")
0283         if(${_arg} STREQUAL "STAGING")
0284           list(APPEND CALLIGRA_STAGING_PRODUCTS ${_product_id})
0285         elseif(${_arg} STREQUAL "UNPORTED")
0286           # temporary during qt5 port, remove after
0287           list(APPEND CALLIGRA_UNPORTED_PRODUCTS ${_product_id})
0288         else(${_arg} STREQUAL "STAGING")
0289           set(_product_name "${_arg}")
0290         endif(${_arg} STREQUAL "STAGING")
0291       elseif(${_current_arg_type} STREQUAL "requires")
0292         # check that the dependency is actually existing
0293         if(NOT DEFINED SHOULD_BUILD_${_arg})
0294           message(FATAL_ERROR "Unknown product/feature listed as dependency for \"${_product_id}\": \"${_arg}\"")
0295         elseif(CALLIGRA_PRODUCTSET_${_arg})
0296           message(FATAL_ERROR "Productset cannot be a dependency for \"${_product_id}\": \"${_arg}\"")
0297         endif()
0298         list(APPEND _needed_dep_product_ids "${_arg}")
0299       endif(${_current_arg_type} STREQUAL "name")
0300     endif(${_arg} STREQUAL "NAME")
0301   endforeach(_arg)
0302 
0303   # set product vars
0304   set(SHOULD_BUILD_${_product_id} FALSE)
0305   set(CALLIGRA_PRODUCT_${_product_id}_name "${_product_name}")
0306   set(CALLIGRA_PRODUCT_${_product_id}_needed_dependencies ${_needed_dep_product_ids})
0307   list(APPEND CALLIGRA_ALL_PRODUCTS ${_product_id})
0308 endmacro(calligra_define_feature)
0309 
0310 
0311 # Usage:
0312 #   calligra_define_productset(<productset_id>
0313 #         [NAME] <productset_name>
0314 #         [REQUIRES <product_id1> ... <productset_id1> ...]
0315 #         [OPTIONAL <product_id2> ... <productset_id2> ...]
0316 #       )
0317 macro(calligra_define_productset _product_id)
0318   # default product name to id, empty deps
0319   set(_product_name "${_product_id}")
0320   set(_needed_dep_product_ids)
0321   set(_wanted_dep_product_ids)
0322 
0323   if(DEFINED SHOULD_BUILD_${_product_id})
0324     message(FATAL_ERROR "Productset \"${_product_id}\" already defined, as \"${CALLIGRA_PRODUCT_${_product_id}_name}\".")
0325   endif(DEFINED SHOULD_BUILD_${_product_id})
0326 
0327   # parse arguments: three states, "name", "requires" or "optional"
0328   set(_current_arg_type "name")
0329   foreach(_arg ${ARGN})
0330     if(${_arg} STREQUAL "NAME")
0331       set(_current_arg_type "name")
0332     elseif(${_arg} STREQUAL "REQUIRES")
0333       set(_current_arg_type "requires")
0334     elseif(${_arg} STREQUAL "OPTIONAL")
0335       set(_current_arg_type "optional")
0336     else(${_arg} STREQUAL "NAME")
0337       if(${_current_arg_type} STREQUAL "name")
0338         set(_product_name "${_arg}")
0339       elseif(${_current_arg_type} STREQUAL "requires")
0340         # check that the dependency is actually existing
0341         if(NOT DEFINED SHOULD_BUILD_${_arg})
0342           message(FATAL_ERROR "Unknown product(set)/feature listed as dependency for \"${_product_id}\": \"${_arg}\"")
0343         endif(NOT DEFINED SHOULD_BUILD_${_arg})
0344         list(APPEND _needed_dep_product_ids "${_arg}")
0345       elseif(${_current_arg_type} STREQUAL "optional")
0346         # check that the dependency is actually existing
0347         if(NOT DEFINED SHOULD_BUILD_${_arg})
0348           message(FATAL_ERROR "Unknown product(set)/feature listed as dependency for \"${_product_id}\": \"${_arg}\"")
0349         endif(NOT DEFINED SHOULD_BUILD_${_arg})
0350         list(APPEND _wanted_dep_product_ids "${_arg}")
0351       endif(${_current_arg_type} STREQUAL "name")
0352     endif(${_arg} STREQUAL "NAME")
0353   endforeach(_arg)
0354 
0355   # set product(set) vars
0356   set(SHOULD_BUILD_${_product_id} FALSE)
0357   set(CALLIGRA_PRODUCT_${_product_id}_name "${_product_name}")
0358   set(CALLIGRA_PRODUCTSET_${_product_id} TRUE)
0359   set(CALLIGRA_PRODUCT_${_product_id}_needed_dependencies ${_needed_dep_product_ids})
0360   set(CALLIGRA_PRODUCT_${_product_id}_wanted_dependencies ${_wanted_dep_product_ids})
0361   list(APPEND CALLIGRA_ALL_PRODUCTS ${_product_id})
0362 endmacro(calligra_define_productset)
0363 
0364 
0365 macro(calligra_log_should_build)
0366   # find what products will be built and which not
0367   set(_built_product_ids "")
0368   set(_not_built_product_ids "")
0369   set(_built_dependency_product_ids "")
0370   set(_not_built_dependency_product_ids "")
0371 
0372   foreach(_product_id ${CALLIGRA_ALL_PRODUCTS})
0373     list(FIND CALLIGRA_SHOULD_BUILD_PRODUCTS ${_product_id} _index)
0374     if(NOT _index EQUAL -1)
0375       if(SHOULD_BUILD_${_product_id})
0376         list(APPEND _built_product_ids ${_product_id})
0377       else(SHOULD_BUILD_${_product_id})
0378         list(APPEND _not_built_product_ids ${_product_id})
0379       endif(SHOULD_BUILD_${_product_id})
0380     else(NOT _index EQUAL -1)
0381       if(SHOULD_BUILD_${_product_id})
0382         list(APPEND _built_dependency_product_ids ${_product_id})
0383       else(SHOULD_BUILD_${_product_id})
0384         list(FIND CALLIGRA_NEEDED_PRODUCTS ${_product_id} _index2)
0385         if(NOT _index2 EQUAL -1)
0386           list(APPEND _not_built_dependency_product_ids ${_product_id})
0387         endif(NOT _index2 EQUAL -1)
0388       endif(SHOULD_BUILD_${_product_id})
0389     endif(NOT _index EQUAL -1)
0390   endforeach(_product_id)
0391 
0392   if(NOT _built_dependency_product_ids STREQUAL "")
0393     message(STATUS "------ The following required product(set)s/features will be built -------")
0394     foreach(_product_id ${_built_dependency_product_ids})
0395       if (DEFINED CALLIGRA_PRODUCT_${_product_id}_dependents)
0396         set(dependents "   [[needed by: ${CALLIGRA_PRODUCT_${_product_id}_dependents}]]")
0397       else (DEFINED CALLIGRA_PRODUCT_${_product_id}_dependents)
0398         set(dependents "")
0399       endif (DEFINED CALLIGRA_PRODUCT_${_product_id}_dependents)
0400 
0401       message(STATUS "${_product_id}:  ${CALLIGRA_PRODUCT_${_product_id}_name}${dependents}" )
0402     endforeach(_product_id)
0403     message(STATUS "")
0404   endif(NOT _built_dependency_product_ids STREQUAL "")
0405   if(NOT _not_built_dependency_product_ids STREQUAL "")
0406     message(STATUS "---- The following required product(set)s/features can NOT be built ------")
0407     foreach(_product_id ${_not_built_dependency_product_ids})
0408       if (DEFINED CALLIGRA_PRODUCT_${_product_id}_dependents)
0409         set(dependents "   [[needed by: ${CALLIGRA_PRODUCT_${_product_id}_dependents}]]")
0410       else (DEFINED CALLIGRA_PRODUCT_${_product_id}_dependents)
0411         set(dependents "")
0412       endif (DEFINED CALLIGRA_PRODUCT_${_product_id}_dependents)
0413 
0414       message(STATUS "${_product_id}:  ${CALLIGRA_PRODUCT_${_product_id}_name}${dependents}  |  ${BUILD_${_product_id}_DISABLE_REASON}" )
0415     endforeach(_product_id)
0416     message(STATUS "")
0417   endif(NOT _not_built_dependency_product_ids STREQUAL "")
0418   message(STATUS "------ The following product(set)s/features will be built ---------")
0419   foreach(_product_id ${_built_product_ids})
0420       message(STATUS "${_product_id}:  ${CALLIGRA_PRODUCT_${_product_id}_name}" )
0421   endforeach(_product_id)
0422   if(NOT _not_built_product_ids STREQUAL "")
0423     message(STATUS "\n------ The following product(set)s/features can NOT be built ------")
0424     foreach(_product_id ${_not_built_product_ids})
0425         message(STATUS "${_product_id}:  ${CALLIGRA_PRODUCT_${_product_id}_name}  |  ${BUILD_${_product_id}_DISABLE_REASON}" )
0426     endforeach(_product_id)
0427   endif(NOT _not_built_product_ids STREQUAL "")
0428   message(STATUS "-------------------------------------------------------------------" )
0429 endmacro(calligra_log_should_build)
0430 
0431 
0432 macro(calligra_product_deps_report_stylebybuild _output _product_id)
0433   if(SHOULD_BUILD_${_product_id})
0434     set(${_output} "filled")
0435   else()
0436     set(${_output} "solid")
0437   endif()
0438 endmacro(calligra_product_deps_report_stylebybuild)
0439 
0440 # Usage:
0441 #   calligra_product_deps_report(<filename_without_extension>)
0442 macro(calligra_product_deps_report _filename)
0443   set(_dot "${_dot}# This is a graphviz file. It shows the internal product dependencies of Calligra.\n")
0444   set(_dot "${_dot}# dot -Tsvg ${_filename}.dot > ${_filename}.svg\n")
0445   set(_dot "${_dot}# dot -Tpng ${_filename}.dot > ${_filename}.png\n")
0446   set(_dot "${_dot}digraph calligra {\n")
0447   set(_dot "${_dot}node [colorscheme=set312]\;\n") # pastel19, set312 or accent8
0448   set(_dot "${_dot}rankdir=LR\;\n")
0449 
0450   foreach(_product_id ${CALLIGRA_ALL_PRODUCTS})
0451     set(_color 11)
0452     set(_shape "box")
0453     set(_style "")
0454 
0455     if(CALLIGRA_PRODUCTSET_${_product_id})
0456       set(_color 1)
0457       set(_shape "folder")
0458     elseif(_product_id MATCHES "^LIB_")
0459       set(_color 2)
0460       set(_shape "box")
0461     elseif(_product_id MATCHES "^FILTER_")
0462       set(_color 3)
0463       set(_shape "component")
0464     elseif(_product_id MATCHES "^PLUGIN_")
0465       set(_color 4)
0466       set(_shape "component")
0467     elseif(_product_id MATCHES "^PART_")
0468       set(_color 5)
0469       set(_shape "component")
0470     elseif(_product_id MATCHES "^APP_")
0471       set(_color 6)
0472       set(_shape "box")
0473       set(_style "rounded,")
0474     elseif(_product_id MATCHES "^BUILDUTIL_")
0475       set(_color 7)
0476       set(_shape "diamond")
0477       set(_style "rounded,")
0478     elseif(_product_id MATCHES "^FEATURE_")
0479       set(_color 8)
0480     elseif(_product_id MATCHES "^OKULAR_")
0481       set(_color 9)
0482       set(_shape "component")
0483     elseif(_product_id MATCHES "^FILEMANAGER_")
0484       set(_color 10)
0485       set(_shape "box")
0486     endif()
0487 
0488     calligra_product_deps_report_stylebybuild(_stylebybuild ${_product_id})
0489 
0490     set(_dot "${_dot}\"${_product_id}\" [fillcolor=${_color}, shape=${_shape}, style=\"${_style}${_stylebybuild}\"];\n")
0491 
0492     foreach(_dependent_product_id ${CALLIGRA_PRODUCT_${_product_id}_needed_dependencies})
0493       set(_edges "${_edges}\"${_product_id}\" -> \"${_dependent_product_id}\"\;\n")
0494     endforeach(_dependent_product_id)
0495     foreach(_dependent_product_id ${CALLIGRA_PRODUCT_${_product_id}_wanted_dependencies})
0496       set(_edges "${_edges}\"${_product_id}\" -> \"${_dependent_product_id}\" [style=dashed]\;\n")
0497     endforeach(_dependent_product_id)
0498   endforeach(_product_id)
0499 
0500   set(_dot "${_dot}${_edges}")
0501   set(_dot "${_dot}}\n")
0502   file(WRITE ${CMAKE_BINARY_DIR}/${_filename}.dot ${_dot})
0503 endmacro(calligra_product_deps_report)