2010 - User Guide - Waf

2010 - User Guide - Waf - Waf user’s guide Carlos Rafael...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Waf user’s guide Carlos Rafael Giani Contents 1 Getting started 1 2 The waf building process 2 2.1 Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2.2 Custom command-line options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2.2.1 Tool options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.2.2 Sub options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.3 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.3.1 Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.3.2 Uselib variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.3.3 Global uselib variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2.3.4 Configurators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.3.5 Sub configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.3.6 Configure header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.4 Building . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.5 Shutdown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3 Additional waf features 9 3.1 Waf tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3.2 Unit tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1 Getting started In order to understand the basics of waf, let’s create a simple hello world project. It has only one source file, main.cpp: int main() { std::cout << "Hello world"; return 0; } Listing 1: the main.cpp hello world code To build this, we need a waf build script, called a wscript . Here is the wscript for the hello world program: srcdir = ’.’ blddir = ’build ’ def configure(conf): conf.check_tool(’g++’) def build(bld): obj = bld.create_obj(’cpp ’, ’program ’) obj.source = ’main.cpp ’ obj.target = ’hello ’ Listing 2: The hello world wscript Let’s go line by line through it: srcdir : the root directory for all source files. The project’s entire source code is in this directory (or in a subdirectory). blddir : where to put the build results. Waf separates build output from source. configure(conf) : this function gets invoked when ”waf configure” is called. It handles the necessary configuration steps, such as autodetection. In this script, configure calls conf.check tool(’g++’) , which autodetects the programs cpp , g++ , ar , and ranlib (some platforms call the C++ compiler cpp, some g++). This step is necessary for waf to be able to build C++ programs. In Windows, the msvc tool would accomplish the same, but using Visual C, and not gcc....
View Full Document

This note was uploaded on 11/29/2010 for the course DEC 123 taught by Professor Fr during the Spring '10 term at ENS Cachan.

Page1 / 13

2010 - User Guide - Waf - Waf user’s guide Carlos Rafael...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online