Difference between revisions of "AMBuild Tutorial"

From AlliedModders Wiki
Jump to: navigation, search
(Created page with "Writing project files with AMBuild is fairly easy. This tutorial will guide you through making simple AMBuild scripts to compile and package a C++ project. =Simple Project= T...")
 
Line 1: Line 1:
 
Writing project files with AMBuild is fairly easy. This tutorial will guide you through making simple AMBuild scripts to compile and package a C++ project.
 
Writing project files with AMBuild is fairly easy. This tutorial will guide you through making simple AMBuild scripts to compile and package a C++ project.
  
=Simple Project=
+
==Simple Project==
 
To begin, let's say we have a sample project with the following files:
 
To begin, let's say we have a sample project with the following files:
  
Line 7: Line 7:
 
$ ls
 
$ ls
 
goodbye.cpp  helpers.cpp  README.txt
 
goodbye.cpp  helpers.cpp  README.txt
 +
</pre>
 +
 +
To start, we need to generate a default AMBuild configure script. This is the script that will perform the "configure" step for your build. You can generate one with the following command:
 +
 +
<pre>
 +
$ ambuild --gen-configure
 +
$ ls
 +
configure.py  goodbye.cpp  helpers.cpp  README.txt
 +
</pre>
 +
 +
The configure script simply invokes AMBuild. It can be modified (as we'll see later) to take extra command line options.
 +
<pre>
 +
$ cat configure.py
 +
# vim: set ts=2 sw=2 tw=99 noet:
 +
import sys, ambuild2.run
 +
 +
prep = run.PrepareBuild(sys.path[0])
 +
prep.Configure()
 
</pre>
 
</pre>

Revision as of 17:03, 15 October 2013

Writing project files with AMBuild is fairly easy. This tutorial will guide you through making simple AMBuild scripts to compile and package a C++ project.

Simple Project

To begin, let's say we have a sample project with the following files:

$ ls
goodbye.cpp  helpers.cpp  README.txt

To start, we need to generate a default AMBuild configure script. This is the script that will perform the "configure" step for your build. You can generate one with the following command:

$ ambuild --gen-configure
$ ls
configure.py  goodbye.cpp  helpers.cpp  README.txt

The configure script simply invokes AMBuild. It can be modified (as we'll see later) to take extra command line options.

$ cat configure.py
# vim: set ts=2 sw=2 tw=99 noet:
import sys, ambuild2.run

prep = run.PrepareBuild(sys.path[0])
prep.Configure()