Add a PRODUCTSET build config parameter, for easy control of build products

PRODUCTSET is a substitute for the old non-exclusive options CREATIVEONLY and
TINY (which then are handled exclusively, eek), with migration support for CREATIVEONLY flag.
Predefined hardcoded productsets are ACTIVE, CREATIVE, DESKTOP, and ALL (default).

Own productsets can be easily added by writing an own productset file,
see cmake/productsets/README

For each product the required internal products can be listed, so they are
automatically built if needed. If required internal products cannot be built,
the depending products will be automatically excluded as well.

REVIEW: 109071

Thanks boud and arjen for review
parent 1fd2d4f3
if (SHOULD_BUILD_PLAN)
macro_optional_add_subdirectory(kdgantt)
endif (SHOULD_BUILD_PLAN)
if (SHOULD_BUILD_LIB_KDGANTT)
add_subdirectory(kdgantt)
endif (SHOULD_BUILD_LIB_KDGANTT)
if (NOT CREATIVEONLY)
if (SHOULD_BUILD_LIB_KDCHART)
add_subdirectory(kdchart)
endif (NOT CREATIVEONLY)
endif (SHOULD_BUILD_LIB_KDCHART)
This diff is collapsed.
# Copyright (c) 2013 Friedrich W. H. Kossebau <kossebau@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
# Global variables
# CALLIGRA_SHOULD_BUILD_PRODUCTS - list of requested products
# CALLIGRA_NEEDED_PRODUCTS - list of internal needed products
# SHOULD_BUILD_${product_id} - boolean if product should be build
macro(calligra_set_shouldbuild_productdependencies _productset_id_dependencies _product_id)
foreach(_dep_product_id ${_productset_id_dependencies})
list(APPEND CALLIGRA_PRODUCT_${_dep_product_id}_dependents ${_product_id})
# if not already enabled, enable
if (NOT SHOULD_BUILD_${_dep_product_id})
list(APPEND CALLIGRA_NEEDED_PRODUCTS ${_dep_product_id})
set(SHOULD_BUILD_${_dep_product_id} TRUE)
if (DEFINED CALLIGRA_PRODUCT_${_dep_product_id}_dependencies)
calligra_set_shouldbuild_productdependencies("${CALLIGRA_PRODUCT_${_dep_product_id}_dependencies}" ${_dep_product_id})
endif (DEFINED CALLIGRA_PRODUCT_${_dep_product_id}_dependencies)
endif (NOT SHOULD_BUILD_${_dep_product_id})
endforeach(_dep_product_id)
endmacro()
macro(calligra_drop_unbuildable_products)
# can assume calligra_all_products has products in down-up order
foreach(_product_id ${CALLIGRA_ALL_PRODUCTS})
if(NOT SHOULD_BUILD_${_product_id})
if(DEFINED CALLIGRA_PRODUCT_${_product_id}_dependents)
foreach(_dependent_product_id ${CALLIGRA_PRODUCT_${_product_id}_dependents})
set(SHOULD_BUILD_${_dependent_product_id} FALSE)
endforeach(_dependent_product_id ${CALLIGRA_PRODUCT_${_dep_product_id}_dependents})
endif(DEFINED CALLIGRA_PRODUCT_${_product_id}_dependents)
endif(NOT SHOULD_BUILD_${_product_id})
endforeach(_product_id)
endmacro()
macro(calligra_set_productset _productset_id)
# be gracefull and compare the productset id case insensitive, by lowercasing
# also expects the productset definition filename in all lowercase
string(TOLOWER "${_productset_id}" lowercase_productset_id)
set(productset_filename "${CMAKE_SOURCE_DIR}/cmake/productsets/${lowercase_productset_id}.cmake")
if (NOT EXISTS "${productset_filename}")
message(FATAL_ERROR "Unknown product set: ${_productset_id}")
endif (NOT EXISTS "${productset_filename}")
# include the productset definition
include(${productset_filename})
if (NOT DEFINED CALLIGRA_SHOULD_BUILD_PRODUCTS)
message(FATAL_ERROR "Product set file \"${productset_filename}\" did not define the var CALLIGRA_SHOULD_BUILD_PRODUCTS.")
endif (NOT DEFINED CALLIGRA_SHOULD_BUILD_PRODUCTS)
set(CALLIGRA_NEEDED_PRODUCTS "")
message(STATUS "--------------------------------------------------------------------------" )
message(STATUS "Configured with product set \"${_productset_id}\"")
message(STATUS "--------------------------------------------------------------------------" )
# backward compatibility: BUILD_app as option or passed as cmake parameter can overwrite product set
# and disable a product if set to FALSE (TRUE was ignored)
foreach(_product_id ${CALLIGRA_ALL_PRODUCTS})
string(TOLOWER "${_product_id}" lowercase_product_id)
if (DEFINED BUILD_${lowercase_product_id})
if(NOT BUILD_${lowercase_product_id})
list(FIND CALLIGRA_SHOULD_BUILD_PRODUCTS ${_product_id} _index)
# remove from product set, if part
if(NOT _index EQUAL -1)
list(REMOVE_AT CALLIGRA_SHOULD_BUILD_PRODUCTS ${_index})
endif(NOT _index EQUAL -1)
endif(NOT BUILD_${lowercase_product_id})
endif (DEFINED BUILD_${lowercase_product_id})
endforeach(_product_id ${CALLIGRA_ALL_PRODUCTS})
# mark all products of the set as SHOULD_BUILD
foreach(_product_id ${CALLIGRA_SHOULD_BUILD_PRODUCTS})
# check that this product is actually existing
if (NOT DEFINED SHOULD_BUILD_${_product_id})
message(FATAL_ERROR "Unknown product: ${_product_id}")
endif (NOT DEFINED SHOULD_BUILD_${_product_id})
# mark product as should build, also all dependencies
set(SHOULD_BUILD_${_product_id} TRUE)
if (DEFINED CALLIGRA_PRODUCT_${_product_id}_dependencies)
calligra_set_shouldbuild_productdependencies("${CALLIGRA_PRODUCT_${_product_id}_dependencies}" ${_product_id})
endif (DEFINED CALLIGRA_PRODUCT_${_product_id}_dependencies)
endforeach(_product_id)
endmacro()
# Usage:
# calligra_define_product(<product_id>
# [NAME] <product_name>
# [NEEDS <product_id1> [<product_id2> ...]]
# )
macro(calligra_define_product _product_id)
# default product name to id, empty deps
set(_product_name "${_product_id}")
set(_dep_product_ids)
# parse arguments: two states, either "name" or "needs"
set(_current_arg_type "name")
foreach(_arg ${ARGN})
if(${_arg} STREQUAL "NAME")
set(_current_arg_type "name")
elseif(${_arg} STREQUAL "NEEDS")
set(_current_arg_type "needs")
else(${_arg} STREQUAL "NAME")
if(${_current_arg_type} STREQUAL "name")
set(_product_name "${_arg}")
else(${_current_arg_type} STREQUAL "name")
# check that the dependency is actually existing
if(NOT DEFINED SHOULD_BUILD_${_arg})
message(FATAL_ERROR "Unknown product listed as dependency for ${_product_id}: ${_arg}")
endif(NOT DEFINED SHOULD_BUILD_${_arg})
list(APPEND _dep_product_ids "${_arg}")
endif(${_current_arg_type} STREQUAL "name")
endif(${_arg} STREQUAL "NAME")
endforeach(_arg)
# set product vars
set(SHOULD_BUILD_${_product_id} FALSE)
set(CALLIGRA_PRODUCT_${_product_id}_name "${_product_name}")
set(CALLIGRA_PRODUCT_${_product_id}_dependencies ${_dep_product_ids})
list(APPEND CALLIGRA_ALL_PRODUCTS ${_product_id})
endmacro(calligra_define_product)
macro(calligra_log_should_build)
# find what products will be built and which not
set(_built_product_ids "")
set(_not_built_product_ids "")
set(_built_dependency_product_ids "")
set(_not_built_dependency_product_ids "")
foreach(_product_id ${CALLIGRA_ALL_PRODUCTS})
list(FIND CALLIGRA_SHOULD_BUILD_PRODUCTS ${_product_id} _index)
if(NOT _index EQUAL -1)
if(SHOULD_BUILD_${_product_id})
list(APPEND _built_product_ids ${_product_id})
else(SHOULD_BUILD_${_product_id})
list(APPEND _not_built_product_ids ${_product_id})
endif(SHOULD_BUILD_${_product_id})
else(NOT _index EQUAL -1)
if(SHOULD_BUILD_${_product_id})
list(APPEND _built_dependency_product_ids ${_product_id})
else(SHOULD_BUILD_${_product_id})
list(FIND CALLIGRA_NEEDED_PRODUCTS ${_product_id} _index2)
if(NOT _index2 EQUAL -1)
list(APPEND _not_built_dependency_product_ids ${_product_id})
endif(NOT _index2 EQUAL -1)
endif(SHOULD_BUILD_${_product_id})
endif(NOT _index EQUAL -1)
endforeach(_product_id)
if(NOT _built_dependency_product_ids STREQUAL "")
message(STATUS "---------------- The following required products will be built ---------" )
foreach(_product_id ${_built_dependency_product_ids})
if (DEFINED CALLIGRA_PRODUCT_${_product_id}_dependents)
set(dependents " [[needed by: ${CALLIGRA_PRODUCT_${_product_id}_dependents}]]")
else (DEFINED CALLIGRA_PRODUCT_${_product_id}_dependents)
set(dependents "")
endif (DEFINED CALLIGRA_PRODUCT_${_product_id}_dependents)
message(STATUS "${_product_id}: ${CALLIGRA_PRODUCT_${_product_id}_name}${dependents}" )
endforeach(_product_id)
message(STATUS "")
endif(NOT _built_dependency_product_ids STREQUAL "")
if(NOT _not_built_dependency_product_ids STREQUAL "")
message(STATUS "---------------- The following required products can NOT be built -----" )
foreach(_product_id ${_not_built_dependency_product_ids})
if (DEFINED CALLIGRA_PRODUCT_${_product_id}_dependents)
set(dependents " [[needed by: ${CALLIGRA_PRODUCT_${_product_id}_dependents}]]")
else (DEFINED CALLIGRA_PRODUCT_${_product_id}_dependents)
set(dependents "")
endif (DEFINED CALLIGRA_PRODUCT_${_product_id}_dependents)
message(STATUS "${_product_id}: ${CALLIGRA_PRODUCT_${_product_id}_name}${dependents}" )
endforeach(_product_id)
message(STATUS "")
endif(NOT _not_built_dependency_product_ids STREQUAL "")
message(STATUS "---------------- The following products will be built --------------------" )
foreach(_product_id ${_built_product_ids})
message(STATUS "${_product_id}: ${CALLIGRA_PRODUCT_${_product_id}_name}" )
endforeach(_product_id)
if(NOT _not_built_product_ids STREQUAL "")
message(STATUS "\n---------------- The following products can NOT be built ------------" )
foreach(_product_id ${_not_built_product_ids})
message(STATUS "${_product_id}: ${CALLIGRA_PRODUCT_${_product_id}_name}" )
endforeach(_product_id)
endif(NOT _not_built_product_ids STREQUAL "")
message(STATUS "--------------------------------------------------------------------------" )
endmacro(calligra_log_should_build)
This directory stores the productsets.
You can add your own productset by adding a file in this directory and selecting
that productset when calling cmake:
The file must be named with the name of the productset in lowercase and have
the extension ".cmake". The content should be a cmake command that sets the
variable "CALLIGRA_SHOULD_BUILD_PRODUCTS" to the list of products the productset
should consist of.
For the possible products have a look at the list of product definitions in the
toplevel "CMakeLists.txt" file.
Example:
You want a productset "PUREWORDS". For that you add a file name "purewords.cmake"
into this directory, with the content:
--- 8< ---
set( CALLIGRA_SHOULD_BUILD_PRODUCTS
WORDS
)
--- 8< ---
When calling cmake you use the string "PUREWORDS" as value for the parameter
"PRODUCTSET, like this:
cmake -DPRODUCTSET=PUREWORDS [other parameters]
\ No newline at end of file
#defines the set of products commonly wanted for Calligra Active
set( CALLIGRA_SHOULD_BUILD_PRODUCTS
ACTIVE
EXTRA_PROPERTIES
EXTRA_THUMBNAIL
PLUGIN_DEFAULTTOOLS
PLUGIN_PATHSHAPES
PLUGIN_VARIABLES
PLUGIN_CHARTSHAPE
PLUGIN_PICTURESHAPE
PLUGIN_TEXTSHAPE
PLUGIN_PLUGINSHAPE
PLUGIN_FORMULASHAPE
PLUGIN_VECTORSHAPE
)
#defines the set of products commonly wanted if everything should be build
set( CALLIGRA_SHOULD_BUILD_PRODUCTS
# desktop apps
AUTHOR
BRAINDUMP
FLOW
KARBON
KEXI
KRITA
PLAN
SHEETS
STAGE
WORDS
# PA apps
ACTIVE
# plugins
PLUGIN_COLORENGINES
PLUGIN_MUSICSHAPE
PLUGIN_SPACENAVIGATOR
PLUGIN_ARTISTICTEXTSHAPE
PLUGIN_DOCKERS
PLUGIN_TEXTEDITING
PLUGIN_STAGING
PLUGIN_KEXI
PLUGIN_DEFAULTTOOLS
PLUGIN_PATHSHAPES
PLUGIN_VARIABLES
PLUGIN_CHARTSHAPE
PLUGIN_PICTURESHAPE
PLUGIN_TEXTSHAPE
PLUGIN_PLUGINSHAPE
PLUGIN_FORMULASHAPE
PLUGIN_VECTORSHAPE
PLUGIN_REPORTING
# feature
SCRIPTING
# extras
CALLIGRA
CONVERTER
EXTRA_PROPERTIES
EXTRA_THUMBNAIL
EXTRA_QUICKPRINT
OKULARODPGENERATOR
# developer utils
CSTESTER
DEVTOOLS
)
\ No newline at end of file
#defines the set of products commonly wanted by Creationists ;)
set( CALLIGRA_SHOULD_BUILD_PRODUCTS
KARBON
KRITA
CONVERTER
EXTRA_PROPERTIES
EXTRA_THUMBNAIL
EXTRA_QUICKPRINT
PLUGIN_COLORENGINES
PLUGIN_SPACENAVIGATOR
PLUGIN_ARTISTICTEXTSHAPE
PLUGIN_DOCKERS
PLUGIN_TEXTEDITING
PLUGIN_DEFAULTTOOLS
PLUGIN_PATHSHAPES
PLUGIN_PICTURESHAPE
PLUGIN_TEXTSHAPE
)
#defines the set of products commonly wanted for classic Desktop environment
set( CALLIGRA_SHOULD_BUILD_PRODUCTS
# apps
AUTHOR
BRAINDUMP
FLOW
KARBON
KEXI
KRITA
PLAN
SHEETS
STAGE
WORDS
# plugins
PLUGIN_COLORENGINES
PLUGIN_MUSICSHAPE
PLUGIN_SPACENAVIGATOR
PLUGIN_ARTISTICTEXTSHAPE
PLUGIN_DOCKERS
PLUGIN_TEXTEDITING
PLUGIN_STAGING
PLUGIN_KEXI
PLUGIN_DEFAULTTOOLS
PLUGIN_PATHSHAPES
PLUGIN_VARIABLES
PLUGIN_CHARTSHAPE
PLUGIN_PICTURESHAPE
PLUGIN_TEXTSHAPE
PLUGIN_PLUGINSHAPE
PLUGIN_FORMULASHAPE
PLUGIN_VECTORSHAPE
PLUGIN_REPORTING
# feature
SCRIPTING
# extras
CALLIGRA
CONVERTER
EXTRA_PROPERTIES
EXTRA_THUMBNAIL
EXTRA_QUICKPRINT
OKULARODPGENERATOR
)
......@@ -11,26 +11,26 @@ add_subdirectory( main )
add_subdirectory( kundo2 )
add_subdirectory( vectorimage )
if (SHOULD_BUILD_SCRIPTING AND NOT CREATIVEONLY)
if (SHOULD_BUILD_SCRIPTING)
add_subdirectory( kokross )
endif (SHOULD_BUILD_SCRIPTING AND NOT CREATIVEONLY)
endif (SHOULD_BUILD_SCRIPTING)
if (NOT CREATIVEONLY)
if (SHOULD_BUILD_LIB_KOPAGEAPP)
add_subdirectory( kopageapp )
endif (NOT CREATIVEONLY)
endif (SHOULD_BUILD_LIB_KOPAGEAPP)
if(NOT TINY OR NOT CREATIVEONLY)
if(SHOULD_BUILD_LIB_KOPROPERTY)
add_subdirectory( koproperty ) # TODO move to independent place like kdesupport
endif(NOT TINY OR NOT CREATIVEONLY)
endif(SHOULD_BUILD_LIB_KOPROPERTY)
if (HAVE_ICU AND HAVE_SQLITE AND SHOULD_BUILD_CALLIGRADB)
if (SHOULD_BUILD_LIB_CALLIGRADB)
add_subdirectory( db ) # used by Kexi and Word's Biblio; TODO: remove when Predicate lib arrives
endif ()
endif (SHOULD_BUILD_LIB_CALLIGRADB)
# only build koreport if possible
if (SHOULD_BUILD_KOREPORT)
if (SHOULD_BUILD_LIB_KOREPORT)
add_subdirectory( koreport )
endif (SHOULD_BUILD_KOREPORT)
endif (SHOULD_BUILD_LIB_KOREPORT)
if (Soprano_FOUND)
add_subdirectory( rdf )
......
......@@ -6,57 +6,86 @@ endif(MSVC)
include_directories(
${KOMAIN_INCLUDES}
${KOMAIN_INCLUDES}
)
IF (NOT TINY)
macro_optional_add_subdirectory( colorengines )
if (SHOULD_BUILD_PLUGIN_COLORENGINES)
add_subdirectory( colorengines )
endif (SHOULD_BUILD_PLUGIN_COLORENGINES)
IF (NOT CREATIVEONLY)
macro_optional_add_subdirectory( musicshape )
ENDIF (NOT CREATIVEONLY)
if (SHOULD_BUILD_PLUGIN_MUSICSHAPE)
add_subdirectory( musicshape )
endif (SHOULD_BUILD_PLUGIN_MUSICSHAPE)
if (SHOULD_BUILD_PLUGIN_SPACENAVIGATOR)
macro_optional_find_package(Spnav)
macro_log_feature(SPNAV_FOUND "Spnav" "3Dconnexion device driver and SDK" "http://spacenav.sourceforge.net/" FALSE "" "Required by SpaceNavigator 3D mouse plugin")
IF (SPNAV_FOUND)
macro_optional_add_subdirectory( spacenavigator )
add_subdirectory( spacenavigator )
ENDIF (SPNAV_FOUND)
macro_optional_add_subdirectory( artistictextshape )
macro_optional_add_subdirectory( dockers )
if (SHOULD_BUILD_TEXTSHAPE)
macro_optional_add_subdirectory( textediting )
endif(SHOULD_BUILD_TEXTSHAPE)
IF (NOT CREATIVEONLY)
#macro_optional_add_subdirectory( commentshape )
macro_optional_add_subdirectory( staging )
ENDIF (NOT CREATIVEONLY)
if(SHOULD_BUILD_KEXI)
macro_optional_add_subdirectory( kexi )
endif(SHOULD_BUILD_KEXI)
ENDIF (NOT TINY)
macro_optional_add_subdirectory( defaultTools )
macro_optional_add_subdirectory( pathshapes )
IF (NOT CREATIVEONLY)
macro_optional_add_subdirectory( variables )
macro_optional_add_subdirectory( chartshape )
macro_optional_add_subdirectory( pictureshape )
#macro_optional_add_subdirectory( videoshape )
ENDIF (NOT CREATIVEONLY)
if (SHOULD_BUILD_TEXTSHAPE)
macro_optional_add_subdirectory( textshape )
endif(SHOULD_BUILD_TEXTSHAPE)
IF (NOT CREATIVEONLY)
macro_optional_add_subdirectory( pluginshape )
macro_optional_add_subdirectory( formulashape )
# as the vector shape depends on filters subdir (not really intuitive) lets allow disabling
macro_optional_add_subdirectory( vectorshape )
# only build the reporting plugins if building koreport
if(SHOULD_BUILD_KOREPORT)
macro_optional_add_subdirectory( reporting )
endif(SHOULD_BUILD_KOREPORT)
ENDIF (NOT CREATIVEONLY)
endif (SHOULD_BUILD_PLUGIN_SPACENAVIGATOR)
if (SHOULD_BUILD_PLUGIN_ARTISTICTEXTSHAPE)
add_subdirectory( artistictextshape )
endif (SHOULD_BUILD_PLUGIN_ARTISTICTEXTSHAPE)
if (SHOULD_BUILD_PLUGIN_DOCKERS)
add_subdirectory( dockers )
endif (SHOULD_BUILD_PLUGIN_DOCKERS)
if (SHOULD_BUILD_PLUGIN_TEXTEDITING AND SHOULD_BUILD_TEXTSHAPE)
add_subdirectory( textediting )
endif(SHOULD_BUILD_PLUGIN_TEXTEDITING AND SHOULD_BUILD_TEXTSHAPE)
if (SHOULD_BUILD_PLUGIN_STAGING)
add_subdirectory( staging )
endif (SHOULD_BUILD_PLUGIN_STAGING)
if(SHOULD_BUILD_PLUGIN_KEXI)
add_subdirectory( kexi )
endif(SHOULD_BUILD_PLUGIN_KEXI)
if (SHOULD_BUILD_PLUGIN_DEFAULTTOOLS)
add_subdirectory( defaultTools )
endif (SHOULD_BUILD_PLUGIN_DEFAULTTOOLS)
if (SHOULD_BUILD_PLUGIN_PATHSHAPES)
add_subdirectory( pathshapes )
endif (SHOULD_BUILD_PLUGIN_PATHSHAPES)
if (SHOULD_BUILD_PLUGIN_VARIABLES)
add_subdirectory( variables )
endif (SHOULD_BUILD_PLUGIN_VARIABLES)
if (SHOULD_BUILD_PLUGIN_CHARTSHAPE)
add_subdirectory( chartshape )
endif (SHOULD_BUILD_PLUGIN_CHARTSHAPE)
if (SHOULD_BUILD_PLUGIN_PICTURESHAPE)
add_subdirectory( pictureshape )
endif (SHOULD_BUILD_PLUGIN_PICTURESHAPE)
if (SHOULD_BUILD_PLUGIN_TEXTSHAPE AND SHOULD_BUILD_TEXTSHAPE)
add_subdirectory( textshape )
endif(SHOULD_BUILD_PLUGIN_TEXTSHAPE AND SHOULD_BUILD_TEXTSHAPE)
if (SHOULD_BUILD_PLUGIN_PLUGINSHAPE)
add_subdirectory( pluginshape )
endif (SHOULD_BUILD_PLUGIN_PLUGINSHAPE)
if (SHOULD_BUILD_PLUGIN_FORMULASHAPE)
add_subdirectory( formulashape )
endif (SHOULD_BUILD_PLUGIN_FORMULASHAPE)
if (SHOULD_BUILD_PLUGIN_VECTORSHAPE)
# ??? old comment: as the vector shape depends on filters subdir (not really intuitive) lets allow disabling
add_subdirectory( vectorshape )
endif (SHOULD_BUILD_PLUGIN_VECTORSHAPE)
# only build the reporting plugins if building koreport
if(SHOULD_BUILD_PLUGIN_REPORTING)
add_subdirectory( reporting )
endif(SHOULD_BUILD_PLUGIN_REPORTING)
#add_subdirectory( videoshape )
#add_subdirectory( commentshape )
if (SHOULD_BUILD_SHEETS)
macro_optional_add_subdirectory(spreadsheet)
add_subdirectory(spreadsheet)
endif (SHOULD_BUILD_SHEETS)
......@@ -5,7 +5,7 @@ if(BUILD_chartshape AND NOT WIN32)
endif(BUILD_chartshape AND NOT WIN32)
if(MARBLE_FOUND AND Soprano_FOUND)
macro_optional_add_subdirectory(maps)
add_subdirectory(maps)
endif(MARBLE_FOUND AND Soprano_FOUND)
if(QT_QTWEBKIT_FOUND)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment