如何在Nant中使用自己的编译器?

时间:2022-06-26 07:21:38

Nant seems very compiler-centric - which is guess is because it's considered a .NET development system. But I know it can be done! I've seen it. The platform we're building on has its own compiler and doesn't use 'cl.exe' for c++. We're building a C++ app on a different platform and would like to override with our own compiler. Can anyone point me at a way to do that or at least how to set up a target of my own that will use our target platform's compiler?

Nant似乎非常以编译器为中心 - 这是因为它被认为是.NET开发系统。但我知道可以做到!我已经看到了它。我们正在构建的平台有自己的编译器,并且不使用'cl.exe'用于c ++。我们正在不同的平台上构建一个C ++应用程序,并希望使用我们自己的编译器覆盖。任何人都可以指点我这样做,或至少如何设置我自己的目标,将使用我们的目标平台的编译器?

4 个解决方案

#1


5  

Here is one I did for Delphi. Each 'arg' is a separate param with a value defined elsewhere. The target is called with the params set up before calling it.

这是我为德尔福做的一个。每个'arg'都是一个单独的param,其值在别处定义。在调用目标之前调用目标。

<target name="build.application">
    <exec program="dcc32" basedir="${Delphi.Bin}" workingdir="${Application.Folder}" verbose="true">
        <arg value="${Application.Compiler.Directive}" />
        <arg value="-Q" />
        <arg value="/B" />
        <arg value="/E${Application.Output.Folder}" />
        <arg value="/U${Application.Lib.Folder};${Application.Search.Folder}" />
        <arg value="${Application.Folder}\${Delphi.Project}" />
    </exec>
</target>

#2


3  

You need to write your own task. This is a nice reference.

你需要编写自己的任务。这是一个很好的参考。

#3


1  

Initially, use the <exec> task to run an executable, passing in any required information as parameters and/or environment variables.

最初,使用 任务运行可执行文件,将任何所需信息作为参数和/或环境变量传递。

For future use, you could also investigate writing your own task. I know with standard ant this is done with the <taskdef> task and a java class. I'm not sure of the Nant equivalent unfortunately.

为了将来使用,您还可以调查编写自己的任务。我知道使用标准的ant,这是通过 任务和java类完成的。不幸的是,我不确定Nant的等价物。

#4


0  

You could also use the <exec> task.

您也可以使用 任务。

#1


5  

Here is one I did for Delphi. Each 'arg' is a separate param with a value defined elsewhere. The target is called with the params set up before calling it.

这是我为德尔福做的一个。每个'arg'都是一个单独的param,其值在别处定义。在调用目标之前调用目标。

<target name="build.application">
    <exec program="dcc32" basedir="${Delphi.Bin}" workingdir="${Application.Folder}" verbose="true">
        <arg value="${Application.Compiler.Directive}" />
        <arg value="-Q" />
        <arg value="/B" />
        <arg value="/E${Application.Output.Folder}" />
        <arg value="/U${Application.Lib.Folder};${Application.Search.Folder}" />
        <arg value="${Application.Folder}\${Delphi.Project}" />
    </exec>
</target>

#2


3  

You need to write your own task. This is a nice reference.

你需要编写自己的任务。这是一个很好的参考。

#3


1  

Initially, use the <exec> task to run an executable, passing in any required information as parameters and/or environment variables.

最初,使用 任务运行可执行文件,将任何所需信息作为参数和/或环境变量传递。

For future use, you could also investigate writing your own task. I know with standard ant this is done with the <taskdef> task and a java class. I'm not sure of the Nant equivalent unfortunately.

为了将来使用,您还可以调查编写自己的任务。我知道使用标准的ant,这是通过 任务和java类完成的。不幸的是,我不确定Nant的等价物。

#4


0  

You could also use the <exec> task.

您也可以使用 任务。