Some cmake help needed: forcing two (or more) files to NEVER be compiled in parallel

The problem
-----------
The RealTimeTypekitTypes* files require a lot of memory to compile. It
has become quite common at my lab that people complain about the RTT not
compiling at all, or dramatically slowing down their machine (think
"swap"). I'm not even talking about our robot which has "only" 2G of memory.

The idea of the solution
------------------------
optionally tell cmake to never compile the two files in parallel

The technical idea
------------------
I though that I could add a dependency between one of the two files and
the object of the other. I.e. on linux add the following dependency:

RealTimeTypekitTypes2.cpp => RealTimeTypekitTypes.o

Unfortunately, I don't how to get the object file name from the source
file in a robust, cross-platform way. CMake only provides the name of
the extension, but does not tell (as far as I can get) if the new
extension replaces the source file extension or is added to it ...

Any insights ?

Ruben Smits's picture

Some cmake help needed: forcing two (or more) files to NEVER be

On 24 Mar 2011, at 10:42, Sylvain Joyeux wrote:

> The problem
> -----------
> The RealTimeTypekitTypes* files require a lot of memory to compile. It
> has become quite common at my lab that people complain about the RTT not
> compiling at all, or dramatically slowing down their machine (think
> "swap"). I'm not even talking about our robot which has "only" 2G of memory.
>
> The idea of the solution
> ------------------------
> optionally tell cmake to never compile the two files in parallel
>
> The technical idea
> ------------------
> I though that I could add a dependency between one of the two files and
> the object of the other. I.e. on linux add the following dependency:
>
> RealTimeTypekitTypes2.cpp => RealTimeTypekitTypes.o
>
> Unfortunately, I don't how to get the object file name from the source
> file in a robust, cross-platform way. CMake only provides the name of
> the extension, but does not tell (as far as I can get) if the new
> extension replaces the source file extension or is added to it ...
>
> Any insights ?

You probably already tried the set_source_files_properties with OBJECT_DEPEND ?

-- Ruben

Some cmake help needed: forcing two (or more) files to NEVER be

On 03/24/2011 11:34 AM, Ruben Smits wrote:
> You probably already tried the set_source_files_properties with OBJECT_DEPEND ?
Ah ... missed your answer.

The problem is that, for OBJECT_DEPENDS to work, I need to add the
*object file* to it. I.e. I need to add

RealTimeTypekitTypes.o

to the OBJECT_DEPENDS of

RealTimeTypekitTypes2.cpp

Which is my main problem right now: I don't know how to get the object
name from the source name in a cross-platform way :(

Sylvain

Some cmake help needed: forcing two (or more) files to NEVER be

On Thu, Mar 24, 2011 at 11:34 AM, Ruben Smits
<Ruben [dot] Smits [..] ...> wrote:
>
> On 24 Mar 2011, at 10:42, Sylvain Joyeux wrote:
>
>> The problem
>> -----------
>> The RealTimeTypekitTypes* files require a lot of memory to compile. It
>> has become quite common at my lab that people complain about the RTT not
>> compiling at all, or dramatically slowing down their machine (think
>> "swap"). I'm not even talking about our robot which has "only" 2G of memory.
>>
>> The idea of the solution
>> ------------------------
>> optionally tell cmake to never compile the two files in parallel
>>
>> The technical idea
>> ------------------
>> I though that I could add a dependency between one of the two files and
>> the object of the other. I.e. on linux add the following dependency:
>>
>>    RealTimeTypekitTypes2.cpp => RealTimeTypekitTypes.o
>>
>> Unfortunately, I don't how to get the object file name from the source
>> file in a robust, cross-platform way. CMake only provides the name of
>> the extension, but does not tell (as far as I can get) if the new
>> extension replaces the source file extension or is added to it ...
>>
>> Any insights ?
>
> You probably already tried the set_source_files_properties with OBJECT_DEPEND ?

Sylvain, did you have a solution for this yet ? We're running into
this problem too...

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

Some cmake help needed: forcing two (or more) files to NEVER be

On 04/04/2011 01:23 PM, Peter Soetens wrote:
>>> The technical idea
>>> ------------------
>>> I though that I could add a dependency between one of the two files and
>>> the object of the other. I.e. on linux add the following dependency:
>>>
>>> RealTimeTypekitTypes2.cpp => RealTimeTypekitTypes.o
>>>
>>> Unfortunately, I don't how to get the object file name from the source
>>> file in a robust, cross-platform way. CMake only provides the name of
>>> the extension, but does not tell (as far as I can get) if the new
>>> extension replaces the source file extension or is added to it ...
>>>
>>> Any insights ?
>>
>> You probably already tried the set_source_files_properties with OBJECT_DEPEND ?
>
> Sylvain, did you have a solution for this yet ? We're running into
> this problem too...
Nope. See the answer to Ruben I just sent (I missed his answer when he
sent it ...)

Sylvain