Quantcast

Multiple Package Generators and add_package command

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Multiple Package Generators and add_package command

Orcun Gokbulut

I'm trying to find out a way to generate multiple packages from a big project. There are some patches and hack available but I'm not experienced cmake user and I can not figure out how to use them.

IMHO, an add_package command can be usefull instead of configuring cpack variables and including cpack module.

 

For example;

I have created a library and I want to distribute it. But there is two type of distribution that I have to create. In the first distributions I include libraries, sample programs, runtime executives and documentation. In the other distribution, in addition to the components in the first distribution, I also want to include source files.

So a script like;

add_package(LibraryDistro COMPONENTS/GROUPS/TARGETS LibA LibB Runtime SampleA SampleB)

add_package(FullDistro COMPONENTS/GROUPS/TARGETS LibA LibB Runtime SampleA SampleB SourceFiles)

#then we can use

set (LibraryDistro_PACKAGE_NAME "A Library")

set (LibraryDistro_PACKAGE_VENDOR "Me")

 

set (FullDistro_PACKAGE_NAME "A Library + Source")

set (FullDistro_PACKAGE_VENDOR "Me")

 

I think this can be very easy to use and maintain. This is just an sample there can be other types of commands something like  add_target_to_package, add_component_to_package or add_component_group_to_package and etc with many different options.

 

 Multiple package generation can same time and effort when maintaining and deploying multiple configurations of a big project.

 

Best regards,

Orçun


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Multiple Package Generators and add_package command

Eric Noulard
2011/2/26 Orcun Gokbulut <[hidden email]>:
> I'm trying to find out a way to generate multiple packages from a big
> project. There are some patches and hack available but I'm not experienced
> cmake user and I can not figure out how to use them.
>
> IMHO, an add_package command can be usefull instead of configuring cpack
> variables and including cpack module.

Did you have a look at:
http://www.vtk.org/Wiki/CMake:Component_Install_With_CPack

In fact the features you want are "almost" already there but somehow not so well
known (and documented). There exists 3 macros (+1 another let's about those 3):

cpack_add_component
     Describes a CPack installation component named by the COMPONENT
     argument to a CMake INSTALL command.

cpack_add_component_group
     Describes a group of related CPack installation components.

cpack_add_install_type
     Add a new installation type containing a set of predefined
component selections
     to the graphical installer.

#
#     cpack_add_component(compname
#                         [DISPLAY_NAME name]
#                         [DESCRIPTION description]
#                         [HIDDEN | REQUIRED | DISABLED ]
#                         [GROUP group]
#                         [DEPENDS comp1 comp2 ... ]
#                         [INSTALL_TYPES type1 type2 ... ]
#                         [DOWNLOADED]
#                         [ARCHIVE_FILE filename])

#
#     cpack_add_component_group(groupname
#                              [DISPLAY_NAME name]
#                              [DESCRIPTION description]
#                              [PARENT_GROUP parent]
#                              [EXPANDED]
#                              [BOLD_TITLE])

#
#     cpack_add_install_type(typename
#                            [DISPLAY_NAME name])


> For example;
>
> I have created a library and I want to distribute it. But there is two type
> of distribution that I have to create. In the first distributions I include
> libraries, sample programs, runtime executives and documentation. In the
> other distribution, in addition to the components in the first distribution,
> I also want to include source files.

The procedure for doing what you want is to:

1) Use COMPONENT argument in you install statement

2) include(CPack)  *** THIS ONE MUST COME THE NEXT :-] ***

3) Define your component setup using
      cpack_add_component
      cpack_add_component_group
      cpack_add_install_type

The order of usage shouldn't matter even if cpack_add_component uses
group and install_type the "cpack_add_component_group" and
"cpack_add_install_type" do not define them but just "describe"
what has already been defined by "cpack_add_component".

Currently this is awkward because CPack users are used to
1) define a lot of CPACK_xxx vars
2) include(CPack)

use cpack -G or make package.

But the fact is the "cpack_add_*" macros do APPEND the file generated
by CPack when using "include(CPack), so you can use them afterwards
so neat [and clumsy] :-)

[...]

> I think this can be very easy to use and maintain. This is just an sample
> there can be other types of commands something like
>  add_target_to_package, add_component_to_package or
> add_component_group_to_package and etc with many different options.

Your idea is different from the current "CPack" component handling because
with CPack you currently do not specify what you want in A "package file"
but what you want in THE package file.
Basically CPack was designed to generate "a SINGLE package".

Now with COMPONENTized install, some generators (ZIP, TGZ, etc... and RPM)
now (since 2.8.4) do generate several package files.
But I think that's not exactly what you asked....

>  Multiple package generation can same time and effort when maintaining and
> deploying multiple configurations of a big project.

However, the need of being able to produce several package is
coming up again and again.
Last ones:
  http://public.kitware.com/Bug/view.php?id=11808
  http://public.kitware.com/Bug/view.php?id=10751

My opinion is the following:

We shall build on top of current COMPONENT installation.
A COMPONENT is the basic "grouping" kind.

Component Group has been designed for grouping component.
(But a component CANNOT belong to several groups).

Install Types may be used to do what YOU want:
listing a set of components.
And in this case the same components may belongs to
different install types.

So using Install Types we may teach CPack generators to build
one package per install type (with some CPACK_xxx options).

What do you think?

Interested people may monitor/contribute the CPack-ModularizeCPack
branch on stage I'll try to get a more modular CPack there with
hopefully multi-package support.

--
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Loading...