Skip to content

Compiling programs

Alex Zimin edited this page Jul 11, 2011 · 2 revisions

Using ncc from command line

Just type

 ncc program.n -out:program.exe

Using NAnt

Nemerle have the support for building programs using NAnt. Standard distribution contains the task library (thanks to Matthijs ter Woord), which is installed to NAnt directory and will be automatically loaded by it.

So, to build your project with nant you must only create the project.build file with

<project default="build">
    <target name="build">
       <ncc target="exe"  output="hello.exe">
         <sources>
           <include name="*.n"/>
         </sources>
       </ncc>
     </target>
</project>

and then type:

 nant

If your nant defaults to mono-2.0 profile and building fails with strange messages, you can try:

 nant -t:mono-1.0

A more involved build example:

<?xml version="1.0"?>
<project name="example" default="all" >
  <target name="all">
    <ncc target="library" output="Nemerle.NAnt.Tasks.dll">
      <sources>
        <include name="*.n" />
      </sources>
      <references>
        <lib>
          <include name="${nant.location}" />
        </lib>
        <include name="NAnt.DotNetTasks.dll" />
        <include name="NAnt.Core.dll" />
      </references>
    </ncc>
  </target>
</project>

Please refer to csc task documentation in your nant distribution -- most options there should be also supported by the ncc task.

Clone this wiki locally