ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: Using Microsoft VC++ compiler for compiling C and C++ project s?
Date Wed, 28 Jan 2004 19:10:05 GMT
Well, I don't do much of private support. These are quite busy times for
me...

I did post in the past example of how I used both msdev and <cc>.
It's somewhere in the archive, and I try to answer to the Ant-related
lists as much as I can.

Anyways, here's something that might help with msdev. <cc> is
documented, so it should be easier to get it going. --DD

PS: Note that what's below works with the /USEENV switch to msdev
    that works only with VS 6.0 SP5. I don't know about VS 7.x.

<!--
==========================================================================
     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 ... 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 common     SYSTEM "file:../../acme/common.xml">
  <!ENTITY AcmeMSdev SYSTEM "file:../../acme/AcmeMSDev.xml">
]>

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

  &common;
  &AcmeMSdev;

  <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="test"
          description="Tests the current Plugin">

    <echo message="NO TESTS!!!" />

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

  <!-- ============== -->
  <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="baseconfig"    value="shared" />
    <property name="config"        value="win32-i86-msvc.${baseconfig}" />
    <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>

  </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: barry@goodconsultants.com [mailto:barry@goodconsultants.com]
> Thank you for your information and may i send you email directly with some
> Ant/C related questions?

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


Mime
View raw message