Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8539795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:27:06+00:00 2026-06-11T11:27:06+00:00

I am attempting to use an Ant build script to build a project that

  • 0

I am attempting to use an Ant build script to build a project that already has nmake (Visual Studio) build scripts. Rather than redo the entire build script, I would like to have Ant reuse the existing scripts.

So, I have something like this which works for Windows Mobile 6 ARMV4I builds:

<project ...>
  <target name="-BUILD.XML-COMPILE" depends="-init, -pre-compile">
    <exec executable="cmd">
      <arg value="/c"/>
      <arg line='"${g.path.project}\build-wm6-armv4i.bat"'/>
    </exec>
    <antcall target="-post-compile" inheritall="true" inheritrefs="true" />
  </target>
</project>

But I would also like it to work for other platforms like Win32 x86 and Windows CE6 x86.

How can I have the Ant script discriminate which batch file it should execute to perform the build?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T11:27:08+00:00Added an answer on June 11, 2026 at 11:27 am

    The <os> condition may be used to set properties based on the operating system and the hardware architecture. Targets may be conditionally executed using the if and unless attributes.

    <?xml version="1.0" encoding="UTF-8"?>
    <project name="build" basedir="." default="BUILD.XML-COMPILE">
    
      <condition property="Win32-x86">
        <and>
          <os family="windows" />
          <or>
            <os arch="i386" />
            <os arch="x86" />
          </or>
        </and>
      </condition>
    
      <condition property="Win-ARMv4">
        <os family="windows" arch="armv4" />
      </condition>
    
    
      <target name="-BUILD.XML-COMPILE_Win-ARMv4" if="Win-ARMv4" 
          depends="-init, -pre-compile">
        <exec executable="cmd">
          <arg value="/c"/>
          <arg line='"${g.path.project}\build-wm6-armv4i.bat"'/>
        </exec>
        <antcall target="-post-compile" inheritall="true" inheritrefs="true" />
      </target>
    
      <target name="-BUILD.XML-COMPILE_Win32-x86" if="Win32-x86"
          depends="-init, -pre-compile">
        <exec executable="cmd">
          <arg value="/c"/>
          <arg line='"${g.path.project}\build-win32-x86.bat"'/>
        </exec>
        <antcall target="-post-compile" inheritall="true" inheritrefs="true" />
      </target>
    
      <!-- Execute the correct target automatically based on current platform. -->
      <target name="BUILD.XML-COMPILE"
          depends="-BUILD.XML-COMPILE_Win-ARMv4,
                   -BUILD.XML-COMPILE_Win32-x86" />
    </project>
    

    The paths to the batch files are both single and double quoted so that file paths with spaces will not break the script. I have not tested this script on Windows Mobile 6 ARMV4I, so you will want to use the Ant target below to verify the name.

    <target name="echo-os-name-arch-version">
      <echo message="OS Name is:         ${os.name}" />
      <echo message="OS Architecture is: ${os.arch}" />
      <echo message="OS Version is:      ${os.version}" />
    </target> 
    

    Related stack overflow questions:

    • how to detect the windows OS in ANT
    • Using ant to detect os and set property
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In attempting to use std::select1st from <functional> in a VS2008 project I found that
I have an Eclipse project that I'm attempting to set up to build both
While attempting to use the Visual Studio 2010 debugger on an Xbox 360 ADK
When attempting to use the profiler in Visual Studio Ultimate 2010, the IDE throws
Im attempting to use websockets for a project. It needs to use the ipad,
I am attempting to use XMLParse against content that is not valid xhtml. In
Im attempting to use fxCop on a C# Project as kind of basis for
Attempting to use asp.net mvc's Action Result of File. So it would seem that
I'm attempting to use Ninject to inject repositories into controllers of my MVC project.
I am attempting to use a custom workflow activity to auto-increment build numbers based

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.