ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: ANT with MSDev
Date Mon, 03 Mar 2003 15:22:49 GMT
Several things to check:

1) Make sure you have VC6 SP3+. Using /USEENV with less than SP3 is buggy.
2) Make sure you don't have some Include or include env. var. on the system.
For some reason, if you have them, and define you INCLUDE thru exec, thus
confuses msdev.exe. Don't ask me why, but it's true. I now have a wrapper
script for Ant as follows:

set LIB=
set Lib=
set lib=

set INCLUDE=
set Include=
set include=

%ANT_HOME%\bin\ant ^
-logger org.apache.tools.ant.NoBannerLogger ^
-emacs ^
%*

The same applies to the Path and LIB variables.

Here's my helper XML to compile Visual Studio projects:

Hope that helps. --DD

PS: <cc> is quite nice to build JNI dlls, but for complex VC workspaces with
lots of custom build instructions, converting can be a pain.

<!--
==========================================================================
     XML Fragment designed to be entity-included from an Ant build.xml file.
     It allows to build from the command line, thanks to Ant, Visual Studio
     workspaces, and more specifically MSDev workspaces for Acme Plugins.

     The Ant project name (shown as 'PluginName' below) should correspond to
     the name of the Visual Studio workspace file (PluginName.dsw), and the
     build file should be in the same directory as that workspace file,
which
     should be the root directory of the Plugin in question. It should also
     correspond to the main project of that workspace (the top-level project
     which depends directly or not on all the others).

     If neither is the case, then simply redefine the 'workspace' and
     'main-project' Ant properties to point to the correct name.

     Below is an example on how this XML fragment file is to be used:

<?xml version="1.0"?>

<!DOCTYPE project [
  <!ENTITY MSdev SYSTEM "file:../../MSDev.xml">
]>

<project name="PluginName" default="build">

  &MSdev;

  <target name="-init">
    Additional Plugin-specific properties to override default properties...
  </target>

  <target name="-set-paths">
    Additional Plugin-specific paths...
  </target>

  Additional Plugin-specific targets...

</project>

     Dominique Devienne - <ddevienne@lgc.com>
     August 2002 - Copyright (c) 2002,  Landmark Graphics Corp.
 
============================================================================
==
  -->

  <!-- ========================== -->
  <target name="clean"
          description="Cleans the current Plugin">

    <antcall target="-msdev">
      <param name="action" value="/CLEAN" />
    </antcall>

  </target><!-- clean -->

  <!-- ========================== -->
  <target name="build"
          description="Builds the current Plugin">

    <antcall target="-msdev">
      <param name="action" value="" />
    </antcall>

  </target><!-- build -->

  <!-- ========================== -->
  <target name="rebuild"
          description="Rebuilds the current Plugin">

    <antcall target="-msdev">
      <param name="action" value="/REBUILD" />
    </antcall>

  </target><!-- rebuild -->

  <!-- ============== -->
  <target name="-default-init"
          depends="-init,
                   -set-config"
          unless="skip.default.init">

    <!-- Define default properties. -->
    <property name="workspace"     value="${ant.project.name}.dsw" />
    <property name="main-project"  value="${ant.project.name}" />
    <property name="project"       value="${main-project}" />
    <property name="configuration" value="Win32 Release" />
    <property name="action"        value="/REBUILD /NORECURSE" />

  </target>

  <!-- ============== -->
  <target name="-set-default-paths">

    <path id="default-Path">
      <pathelement location="${msdev.home}/Common/MSDev98/Bin" />
      <pathelement location="${msdev.home}/Common/Tools" />
      <pathelement location="${msdev.home}/VC98/bin" />
      <pathelement location="${env.SystemRoot}/System32" />
      <pathelement location="${env.SystemRoot}" />
    </path>

    <path id="default-LIB">
      <pathelement location="${msdev.home}/VC98/mfc/lib" />
      <pathelement location="${msdev.home}/VC98/lib" />
    </path>

    <path id="default-INCLUDE">
      <pathelement location="${msdev.home}/VC98/include" />
      <pathelement location="${msdev.home}/VC98/mfc/include" />
      <pathelement location="${msdev.home}/VC98/atl/include" />
    </path>

    <path id="default-GOCADPATH">
      <pathelement location="." />
    </path>

  </target><!-- test -->

  <!-- ============== -->
  <target name="-msdev"
          depends="-default-init,
                   -set-default-paths,
                   -set-paths"
          unless="skip.msdev">

    <!-- Convert paths into properties. -->
    <property name="Path"      refid="Path" />
    <property name="LIB"       refid="LIB" />
    <property name="INCLUDE"   refid="INCLUDE" />

    <property name="msdev.exe"
              value="${msdev.home}/Common/MSDev98/Bin/msdev.exe" />

    <condition property="cfg" value="/BUILD">
      <equals arg1="${action}" arg2="" />
    </condition>
    <property name="cfg" value="${action}" />

    <echo message="--------------------Workspace: ${workspace} (${cfg})" />
    <echo message="--------------------Main Project: ${project}" />
    <exec executable="${msdev.exe}"
          dir="${basedir}"
          vmlauncher="false"
          failonerror="true">

      <arg value="/USEENV" />
      <arg value="${workspace}" />
      <arg value="/MAKE" />
      <arg value="${project} - ${configuration}" />
      <arg  line="${action}" />

      <!--
      <arg value="/OUT" />
      <arg value="${project}.log" />
        -->

      <env key="Path"    path="${Path}" />
      <env key="LIB"     path="${LIB}" />
      <env key="INCLUDE" path="${INCLUDE}" />
    </exec>

  </target><!-- ~msdev -->

-----Original Message-----
From: Kevin Brown [mailto:hybrid@twcny.rr.com] 
Sent: Sunday, March 02, 2003 1:38 PM
To: user@ant.apache.org
Subject: ANT with MSDev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


I'm trying to replace my horrible NT batch scripts with ANT.  I'm failing 
miserably and would greatly appreciate some assistance.

Very briefly, I've got a bunch of VC++ projects that I currently compile
with 
the msdev command, pointing to the workspace files and using the /USEENV 
flag.  The /USEENV flag lets me specify the INCLUDE and LIB paths in my
batch 
script.

In my ANT build.xml file, I'm using the "exec" task to launch "msdev", and
I'm 
using "arg" to pass in the workspace and parameters.  This works fine if I 
don't use the /USEENV parameter.  As soon as I do, MSDev complains that it 
can't find some AFX header files, which I would expect.

I put the following:

<env key="INCLUDE" path="<whatever the path is to the afx header files>"/>

as a nested element of my "exec" task (right beneath the arguments), but it 
doesn't help any.

Looking at the verbose output, it tells me that it sets INCLUDE to what I 
want, but I still get errors from the compiler telling me it can't find the 
header files.

Any suggestions?  I'm not terribly interested in the cpptask stuff, because
I 
do want to make use of the existing workspace files that we have (to keep it

simple I suppose).

Thanks in advance,
Kevin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+Yl2yn8LJsdIuubMRAtg6AJ9luvyzUSmF03d0hHnHo1WUmQqqoQCeNt++
kashiT+ZM4ASLc5YQ0lc/O0=
=jXx5
-----END PGP SIGNATURE-----


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

Mime
View raw message