You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Paul Richards <pa...@gmail.com> on 2008/05/29 10:51:05 UTC

Re: Setting path to MSVC compiler with cctask

I'm afraid I was only evaluating ant+cpptask (as well as other tools)
in order to find the best tool for my project.  Unfortunately
ant+cpptask didn't win, and so I didn't spend any more time on it.



2008/5/29  <ri...@ite.com.au>:
> Hi Paul,
>
> I'm in the same boat and was only able to solve it through wrapping ant in a cmd script. Since I'm invoking Ant indirectly through a JAVA app it makes it hard to debug unless I use remote debugging (which is slightly painful). Have you been able to find a solution since your post?
>
>
> -regards
> Richard
>
> Paul Richards-2 wrote:
>>
>> Hi,
>> I'm trying to use cpptasks-1.0b5 with Ant 1.7.0 on a C++ a project
>> that must be built with MSVC in both 32-bit and 64-bit flavours.  With
>> MSVC this means we must build the project with two different versions
>> of "cl.exe".
>>
>> I can't put both on my PATH, and so I'd like to specify in my Ant
>> build script the correct version of the cl.exe compiler for cctask to
>> use each time.
>>
>>
>> Attempt #1 (failure):
>>
>> From what I can tell I can't set the environment on the fly in Ant.
>> For example I tried the following code before my cc task, and this
>> didn't work.
>>     <property environment="env"/>
>>     <property name="env.Path" value="${env.Path};C:\Program Files
>> (x86)\Microsoft Visual Studio 8\VC\bin"/>
>> The cc task fails to find cl.exe if I try this.
>>
>>
>> Attempt #2 (success):
>>
>> My next option is to set the PATH using Ant's exec task in a recursive
>> call to "ant".  This works but doesn't seem very elegant:
>>     <property environment="env"/>
>>     <target name="compile-1">
>>         <exec executable="cmd">
>>             <arg line="/c ant.bat compile-2"/>
>>             <env key="Path" value="${env.Path};C:\Program Files
>> (x86)\Microsoft Visual Studio 8\VC\bin"/>
>>         </exec>
>>     </target>
>>     <target name="compile-2">
>>         <cc ...>...</cc>
>>     </target>
>> As my build.xml grows larger I'm sure this will cause pain when debugging.
>>
>>
>> So my question is how to specify the path to cl.exe neatly?  Can the
>> path to cl.exe be specified manually to cctask?  Does Ant support
>> calling itself in a neater way that doesn't require spawning a new
>> shell?
>>
>>
>>
>> --
>> Paul Richards
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>>
> Quoted from:
> http://www.nabble.com/Setting-path-to-MSVC-compiler-with-cctask-tp16853547p16853547.html
>
>



-- 
Paul Richards

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Setting path to MSVC compiler with cctask

Posted by Dominique Devienne <dd...@gmail.com>.
On Thu, May 29, 2008 at 3:51 AM, Paul Richards <pa...@gmail.com> wrote:
> I'm afraid I was only evaluating ant+cpptask (as well as other tools)
> in order to find the best tool for my project.  Unfortunately
> ant+cpptask didn't win, and so I didn't spend any more time on it.

Care to share a bit more info?

Choice of tools is indeed very dependent on the project. For me at one
point, since I was building lots of Java projects with Ant, it was
natural to invest time into CppTasks to build the associated JNI
native libs, rather than use another build tool (and then I used it
for large C++ projects too, since I had it going). But I agree that
CppTasks is (a) hard to get started with, and (b) doesn't allow you to
easily control the path to find an executable, (c) doesn't have a
community nor much dev activity.

But a great advantage of CppTasks is that it provides you with very
reliable *incremental* builds, because it does automatic dependency
management, tracks build options, etc... In my experience, this is
*very* useful (especially for large projects), and *quite rare* in
build tools. That's why I think Ant+CppTasks has more "depth" than
many other build tools ;-) What can I say, I was a fan of it! :)))

--DD

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org