multiple component in a single package

Hi,

I am running ros-diamondback-orocos-toolchain-ros
(0.4.0-s1308766814~lucid)

I have two components in a package and I use

In CartesianGenerator.cpp (.cpp file implementing the first component)
ORO_LIST_COMPONENT_TYPE(trajectory_generator::CartesianGenerator );

In TrajectoryGenerator.cpp (.cpp file implementing the second component)
ORO_CREATE_COMPONENT_TYPE()
ORO_LIST_COMPONENT_TYPE(trajectory_generator::TrajectoryGenerator);

In this case how should my CMakeList.txt should look like ?

orocos_component(${PROJECT_NAME} src/TrajectoryGenerator.cpp)
orocos_component(${PROJECT_NAME} src/CartesianGenerator.cpp)

or

orocos_component(${PROJECT_NAME} src/TrajectoryGenerator.cpp
src/CartesianGenerator.cpp)

Also can you please let me know where should I look for the
[orocos_component] cmake macro implementation to know more about it.

Best,
Gajan

multiple component in a single package

2011/7/15 Gajamohan Mohanarajah <gajamohan [dot] m [..] ...>:
> Hi,
>
> I am running ros-diamondback-orocos-toolchain-ros
> (0.4.0-s1308766814~lucid)
>
> I have two components in a package and I use
>
> In CartesianGenerator.cpp  (.cpp file implementing the first component)
> ORO_LIST_COMPONENT_TYPE(trajectory_generator::CartesianGenerator );
>
> In TrajectoryGenerator.cpp (.cpp file implementing the second component)
> ORO_CREATE_COMPONENT_TYPE()
> ORO_LIST_COMPONENT_TYPE(trajectory_generator::TrajectoryGenerator);
>
>
> In this case how should my CMakeList.txt should look like ?
>
> orocos_component(${PROJECT_NAME} src/TrajectoryGenerator.cpp)
> orocos_component(${PROJECT_NAME} src/CartesianGenerator.cpp)

This will create two seperate libraries, each containing one component

>
> or
>
> orocos_component(${PROJECT_NAME} src/TrajectoryGenerator.cpp
> src/CartesianGenerator.cpp)

This will create one library containing the two components. As this is
what you want (considering the macro's you've put in your code), try
this option.

>
> Also can you please let me know where should I look for the
> [orocos_component] cmake macro implementation to know more about it.

It's defined in 'UseOROCOS-RTT.cmake', in the top-level rtt directory.

Steven

>
> Best,
> Gajan
> --
> Orocos-Users mailing list
> Orocos-Users [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>

multiple component in a single package

On Friday 15 July 2011 13:02:51 Steven Bellens wrote:
> 2011/7/15 Gajamohan Mohanarajah <gajamohan [dot] m [..] ...>:
> > Hi,
> >
> > I am running ros-diamondback-orocos-toolchain-ros
> > (0.4.0-s1308766814~lucid)
> >
> > I have two components in a package and I use
> >
> > In CartesianGenerator.cpp (.cpp file implementing the first component)
> > ORO_LIST_COMPONENT_TYPE(trajectory_generator::CartesianGenerator );
> >
> > In TrajectoryGenerator.cpp (.cpp file implementing the second component)
> > ORO_CREATE_COMPONENT_TYPE()
> > ORO_LIST_COMPONENT_TYPE(trajectory_generator::TrajectoryGenerator);
> >
> >
> > In this case how should my CMakeList.txt should look like ?
> >
> > orocos_component(${PROJECT_NAME} src/TrajectoryGenerator.cpp)
> > orocos_component(${PROJECT_NAME} src/CartesianGenerator.cpp)
>
> This will create two seperate libraries, each containing one component

No it won't. The latter will replace the former, since you redefine a component
library. So only one lib with CartesianGenerator.cpp in it.

Peter

multiple component in a single package

2011/7/15 Peter Soetens <peter [..] ...>:
> On Friday 15 July 2011 13:02:51 Steven Bellens wrote:
>> 2011/7/15 Gajamohan Mohanarajah <gajamohan [dot] m [..] ...>:
>> > Hi,
>> >
>> > I am running ros-diamondback-orocos-toolchain-ros
>> > (0.4.0-s1308766814~lucid)
>> >
>> > I have two components in a package and I use
>> >
>> > In CartesianGenerator.cpp  (.cpp file implementing the first component)
>> > ORO_LIST_COMPONENT_TYPE(trajectory_generator::CartesianGenerator );
>> >
>> > In TrajectoryGenerator.cpp (.cpp file implementing the second component)
>> > ORO_CREATE_COMPONENT_TYPE()
>> > ORO_LIST_COMPONENT_TYPE(trajectory_generator::TrajectoryGenerator);
>> >
>> >
>> > In this case how should my CMakeList.txt should look like ?
>> >
>> > orocos_component(${PROJECT_NAME} src/TrajectoryGenerator.cpp)
>> > orocos_component(${PROJECT_NAME} src/CartesianGenerator.cpp)
>>
>> This will create two seperate libraries, each containing one component
>
> No it won't. The latter will replace the former, since you redefine a component
> library. So only one lib with CartesianGenerator.cpp in it.

I didn't know about this overriding behaviour.

>From the template code:

# Creates a component library lib@pkgname@-<target>.so
# and installs in the directory lib/orocos/@pkgname@/
#
orocos_component(@pkgname@ @pkgname [..] ...
@pkgname [..] ...) # ...you may add multiple source files
#
# You may add multiple orocos_component statements.

So then at least the documentation is wrong here :)

Steven

>
> Peter
>

multiple component in a single package

On Fri, Jul 15, 2011 at 2:06 PM, Steven Bellens
<steven [dot] bellens [..] ...> wrote:
> 2011/7/15 Peter Soetens <peter [..] ...>:
>> On Friday 15 July 2011 13:02:51 Steven Bellens wrote:
>>> 2011/7/15 Gajamohan Mohanarajah <gajamohan [dot] m [..] ...>:
>>> > Hi,
>>> >
>>> > I am running ros-diamondback-orocos-toolchain-ros
>>> > (0.4.0-s1308766814~lucid)
>>> >
>>> > I have two components in a package and I use
>>> >
>>> > In CartesianGenerator.cpp  (.cpp file implementing the first component)
>>> > ORO_LIST_COMPONENT_TYPE(trajectory_generator::CartesianGenerator );
>>> >
>>> > In TrajectoryGenerator.cpp (.cpp file implementing the second component)
>>> > ORO_CREATE_COMPONENT_TYPE()
>>> > ORO_LIST_COMPONENT_TYPE(trajectory_generator::TrajectoryGenerator);
>>> >
>>> >
>>> > In this case how should my CMakeList.txt should look like ?
>>> >
>>> > orocos_component(${PROJECT_NAME} src/TrajectoryGenerator.cpp)
>>> > orocos_component(${PROJECT_NAME} src/CartesianGenerator.cpp)
>>>
>>> This will create two seperate libraries, each containing one component
>>
>> No it won't. The latter will replace the former, since you redefine a component
>> library. So only one lib with CartesianGenerator.cpp in it.
>
> I didn't know about this overriding behaviour.
>
> From the template code:
>
>  # Creates a component library lib@pkgname@-<target>.so
>  # and installs in the directory lib/orocos/@pkgname@/
>  #
>  orocos_component(@pkgname@ @pkgname [..] ...
> @pkgname [..] ...) # ...you may add multiple source files
>  #
>  # You may add multiple orocos_component statements.
>
> So then at least the documentation is wrong here :)

"You may add multiple orocos_component statements in a package, but
with different library names"

I even wonder if cmake would allow twice orocos_component with same
target name since it calls add_library...

Peter
--
Orocos-Users mailing list
Orocos-Users [..] ...
http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users

multiple component in a single package

On Fri, 2011-07-15 at 14:06 +0200, Steven Bellens wrote:
> 2011/7/15 Peter Soetens <peter [..] ...>:
> > On Friday 15 July 2011 13:02:51 Steven Bellens wrote:
> >> 2011/7/15 Gajamohan Mohanarajah <gajamohan [dot] m [..] ...>:
> >> > Hi,
> >> >
> >> > I am running ros-diamondback-orocos-toolchain-ros
> >> > (0.4.0-s1308766814~lucid)
> >> >
> >> > I have two components in a package and I use
> >> >
> >> > In CartesianGenerator.cpp (.cpp file implementing the first component)
> >> > ORO_LIST_COMPONENT_TYPE(trajectory_generator::CartesianGenerator );
> >> >
> >> > In TrajectoryGenerator.cpp (.cpp file implementing the second component)
> >> > ORO_CREATE_COMPONENT_TYPE()
> >> > ORO_LIST_COMPONENT_TYPE(trajectory_generator::TrajectoryGenerator);
> >> >
> >> >
> >> > In this case how should my CMakeList.txt should look like ?
> >> >
> >> > orocos_component(${PROJECT_NAME} src/TrajectoryGenerator.cpp)
> >> > orocos_component(${PROJECT_NAME} src/CartesianGenerator.cpp)
> >>
> >> This will create two seperate libraries, each containing one component
> >
> > No it won't. The latter will replace the former, since you redefine a component
> > library. So only one lib with CartesianGenerator.cpp in it.

We use this to create multiple libraries:

orocos_component(TrajectoryGenerator src/TrajectoryGenerator.cpp)
orocos_component(CartesianGenerator src/CartesianGenerator.cpp)

Nothing will be overwritten and two libraries are created.

Tim

>
> I didn't know about this overriding behaviour.
>
> >From the template code:
>
> # Creates a component library lib@pkgname@-<target>.so
> # and installs in the directory lib/orocos/@pkgname@/
> #
> orocos_component(@pkgname@ @pkgname [..] ...
> @pkgname [..] ...) # ...you may add multiple source files
> #
> # You may add multiple orocos_component statements.
>
> So then at least the documentation is wrong here :)
>
> Steven
>
>
> >
> > Peter
> >