Allow multiple components to be installed
Allowing multiple components to be installed makes it possible to build and install the core and experimental modules at the same time.
This commit is contained in:
parent
3eb25df676
commit
052072a198
@ -87,6 +87,7 @@ _NAME_=_VALUE_ format (e.g. `-DBUILD_TESTS=Y`).
|
||||
|BUILD_TESTS|Build tests|
|
||||
|WITH_SCRIPTS|Install systemd and init.d scripts|
|
||||
|PACKAGE|Enable building of packages|
|
||||
|TARGET_COMPONENT|Which component to install, default is the 'core' package. Other targets are 'experimental', which installs experimental packages, 'devel' which installs development headers and 'all' which installs all components.|
|
||||
|
||||
**Note**: You can look into [defaults.cmake](../../cmake/defaults.cmake) for a
|
||||
list of the CMake variables.
|
||||
@ -163,7 +164,7 @@ make
|
||||
LD_LIBRARY_PATH=$PWD/server/core/ make package
|
||||
```
|
||||
|
||||
## Installing and packaging optional components
|
||||
## Installing optional components
|
||||
|
||||
MaxScale is split into multiple components. The main component is the core MaxScale
|
||||
package which contains MaxScale and all the modules. This is the default component
|
||||
@ -174,23 +175,28 @@ quality modules. The latter of the optional components, _devel_, contains the
|
||||
development files required for MaxScale module development.
|
||||
|
||||
The component which is build is controlled by the TARGET_COMPONENT CMake variable.
|
||||
The default value for this is _core_ which build the core MaxScale package.
|
||||
The default value for this is _core_ which builds the core MaxScale package.
|
||||
|
||||
To build the experimental modules, you will need to set value of the TARGET_COMPONENT
|
||||
To build other components, you will need to set value of the TARGET_COMPONENT
|
||||
CMake variable to the component name you wish to install or package.
|
||||
|
||||
For example, to package the experimental module component, invoke CMake with
|
||||
### Install experimental modules
|
||||
|
||||
To install the experimental modules, invoke CMake with
|
||||
_-DTARGET_COMPONENT=experimental_:
|
||||
|
||||
```
|
||||
cmake ../MaxScale -DPACKAGE=Y DTARGET_COMPONENT=experimental
|
||||
make package
|
||||
cmake ../MaxScale -DTARGET_COMPONENT=experimental
|
||||
make
|
||||
make install
|
||||
```
|
||||
|
||||
If you wish to create a monolithic package with all the components, set the value to an
|
||||
empty string and build the package:
|
||||
### Creating a monolithic package
|
||||
|
||||
To create a monolithic package with all the components, set the
|
||||
value of _TARGET_COMPONENT_ to 'all', _PACKAGE_ to Y and build the package:
|
||||
|
||||
```
|
||||
cmake ../MaxScale -DPACKAGE=Y DTARGET_COMPONENT=""
|
||||
cmake ../MaxScale -DPACKAGE=Y -DTARGET_COMPONENT=all
|
||||
make package
|
||||
```
|
||||
|
@ -61,4 +61,4 @@ set(INSTALL_EXPERIMENTAL TRUE CACHE BOOL "Install experimental modules")
|
||||
set(PACKAGE_NAME "maxscale" CACHE STRING "Name of the generated package")
|
||||
|
||||
# Which component to build (core, experimental, devel)
|
||||
set(TARGET_COMPONENT "core" CACHE STRING "Which component to build (core, experimental, devel)")
|
||||
set(TARGET_COMPONENT "core" CACHE STRING "Which component to build (core, experimental, devel, all)")
|
||||
|
@ -10,6 +10,12 @@ set(MAXSCALE_DOCDIR ${CMAKE_INSTALL_DOCDIR}/maxscale CACHE PATH "Documentation i
|
||||
set(MAXSCALE_VARDIR /var CACHE PATH "Data file path (usually /var/)")
|
||||
set(MAXSCALE_CONFDIR /etc CACHE PATH "Configuration file installation path (/etc/)")
|
||||
|
||||
# Massage TARGET_COMPONENT into a list
|
||||
if (TARGET_COMPONENT)
|
||||
string(REPLACE "," ";" TARGET_COMPONENT ${TARGET_COMPONENT})
|
||||
list(FIND TARGET_COMPONENT "all" BUILD_ALL)
|
||||
endif()
|
||||
|
||||
#
|
||||
# Installation functions for MaxScale
|
||||
#
|
||||
@ -25,9 +31,12 @@ set(MAXSCALE_CONFDIR /etc CACHE PATH "Configuration file installation path (/etc
|
||||
# @param Name of the CMake target
|
||||
# @param Component where this executable should be included
|
||||
function(install_executable target component)
|
||||
if(NOT TARGET_COMPONENT OR "${component}" STREQUAL "${TARGET_COMPONENT}")
|
||||
list(FIND TARGET_COMPONENT ${component} BUILD_COMPONENT)
|
||||
|
||||
if(BUILD_COMPONENT GREATER -1 OR BUILD_ALL GREATER -1)
|
||||
install(TARGETS ${target} DESTINATION ${MAXSCALE_BINDIR} COMPONENT "${component}")
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
# Installation function for modules
|
||||
@ -36,14 +45,17 @@ endfunction()
|
||||
# @param Component where this module should be included
|
||||
function(install_module target component)
|
||||
get_target_property(TGT_VERSION ${target} VERSION)
|
||||
|
||||
if (${TGT_VERSION} MATCHES "NOTFOUND")
|
||||
message(AUTHOR_WARNING "Module '${target}' is missing the VERSION parameter!")
|
||||
endif()
|
||||
|
||||
# If TARGET_COMPONENT is defined, only parts of that component are installed
|
||||
if(NOT TARGET_COMPONENT OR "${component}" STREQUAL "${TARGET_COMPONENT}")
|
||||
list(FIND TARGET_COMPONENT ${component} BUILD_COMPONENT)
|
||||
|
||||
if(BUILD_COMPONENT GREATER -1 OR BUILD_ALL GREATER -1)
|
||||
install(TARGETS ${target} DESTINATION ${MAXSCALE_LIBDIR} COMPONENT "${component}")
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
# Installation functions for interpreted scripts.
|
||||
@ -52,10 +64,12 @@ endfunction()
|
||||
# @param Component where this script should be included
|
||||
function(install_script target component)
|
||||
|
||||
# If TARGET_COMPONENT is defined, only parts of that component are installed
|
||||
if(NOT TARGET_COMPONENT OR "${component}" STREQUAL "${TARGET_COMPONENT}")
|
||||
list(FIND TARGET_COMPONENT ${component} BUILD_COMPONENT)
|
||||
|
||||
if(BUILD_COMPONENT GREATER -1 OR BUILD_ALL GREATER -1)
|
||||
install(PROGRAMS ${target} DESTINATION ${MAXSCALE_BINDIR} COMPONENT "${component}")
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
# Installation functions for files and programs. These all go to the share directory
|
||||
@ -65,18 +79,20 @@ endfunction()
|
||||
# @param Component where this file should be included
|
||||
function(install_file file component)
|
||||
|
||||
# If TARGET_COMPONENT is defined, only parts of that component are installed
|
||||
if(NOT TARGET_COMPONENT OR "${component}" STREQUAL "${TARGET_COMPONENT}")
|
||||
list(FIND TARGET_COMPONENT ${component} BUILD_COMPONENT)
|
||||
if(BUILD_COMPONENT GREATER -1 OR BUILD_ALL GREATER -1)
|
||||
install(FILES ${file} DESTINATION ${MAXSCALE_SHAREDIR} COMPONENT "${component}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(install_program file component)
|
||||
|
||||
# If TARGET_COMPONENT is defined, only parts of that component are installed
|
||||
if(NOT TARGET_COMPONENT OR "${component}" STREQUAL "${TARGET_COMPONENT}")
|
||||
list(FIND TARGET_COMPONENT ${component} BUILD_COMPONENT)
|
||||
|
||||
if(BUILD_COMPONENT GREATER -1 OR BUILD_ALL GREATER -1)
|
||||
install(PROGRAMS ${file} DESTINATION ${MAXSCALE_SHAREDIR} COMPONENT "${component}")
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
# Install man pages
|
||||
@ -86,10 +102,12 @@ endfunction()
|
||||
# @param Component where this manual should be included
|
||||
function(install_manual file page component)
|
||||
|
||||
# If TARGET_COMPONENT is defined, only parts of that component are installed
|
||||
if(NOT TARGET_COMPONENT OR "${component}" STREQUAL "${TARGET_COMPONENT}")
|
||||
list(FIND TARGET_COMPONENT ${component} BUILD_COMPONENT)
|
||||
|
||||
if(BUILD_COMPONENT GREATER -1 OR BUILD_ALL GREATER -1)
|
||||
install(PROGRAMS ${file} DESTINATION ${CMAKE_INSTALL_DATADIR}/man/man${page} COMPONENT "${component}")
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
# Install headers
|
||||
@ -98,10 +116,12 @@ endfunction()
|
||||
# @param Component where this header should be included
|
||||
function(install_header header component)
|
||||
|
||||
# If TARGET_COMPONENT is defined, only parts of that component are installed
|
||||
if(NOT TARGET_COMPONENT OR "${component}" STREQUAL "${TARGET_COMPONENT}")
|
||||
list(FIND TARGET_COMPONENT ${component} BUILD_COMPONENT)
|
||||
|
||||
if(BUILD_COMPONENT GREATER -1 OR BUILD_ALL GREATER -1)
|
||||
install(FILES ${header} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/maxscale COMPONENT "${component}")
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
|
||||
@ -112,8 +132,10 @@ endfunction()
|
||||
# @param Component where this file should be included
|
||||
function(install_custom_file file dest component)
|
||||
|
||||
# If TARGET_COMPONENT is defined, only parts of that component are installed
|
||||
if(NOT TARGET_COMPONENT OR "${component}" STREQUAL "${TARGET_COMPONENT}")
|
||||
list(FIND TARGET_COMPONENT ${component} BUILD_COMPONENT)
|
||||
|
||||
if(BUILD_COMPONENT GREATER -1 OR BUILD_ALL GREATER -1)
|
||||
install(FILES ${file} DESTINATION ${dest} COMPONENT "${component}")
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
Loading…
x
Reference in New Issue
Block a user