Skip to main content

Handy tools for the WAF meta build environment

Project description

Summary

This package contains a collection of tools for the waf build environment intended for both native- as well cross compilation of C/C++ based projects.

Description

The waf framework provides a meta build system allowing users to create concrete build systems. Out of the box it provides support for building and installation of programs for a myriad of programming languages (C, C++, Java, Python, Fortran, Lua, …), when needed new functions (e.g. source code checking) can be added to a concrete build solution using waf tools which can be imported and used in wscript build files. See the wafbook for a detailed description of the waf meta build system structure and usage.

The waftools package provides a collection of C/C++ tools which, once installed, can be imported and used from any wscript build file on your system. Following provides a non-exhausting list of functions provided by this package:

  • Cross compile using several C/C++ cross compiler toolchains

  • C/C++ export to makefiles (e.g. make, cmake)

  • C/C++ export to IDE’s (e.g. Code::Blocks, Eclipse, Visual Studio)

  • C/C++ source code checking using cppcheck (including html reports)

  • Clean and format C/C++ source code using GNU indent

  • Create installers using NSIS

  • Create C/C++ documentation using DoxyGen

  • List dependencies between build tasks

  • Use ‘unity’ and ‘batched_cc’ tools when available (waf-1.8.x)

Installation

The package can be installed using pip:

pip install -I waftools

or by cloning the repository and using distutils:

cd ~
git clone https://bitbucket.org/Moo7/waftools.git waftools
cd waftools
python setup.py sdist install

Contained within the waftools package is a special install script which can be used to install the waf build system itself:

wafinstall [--version=version] [--tools=unity,batched_cc]

Usage

The code snippet below provides an example of how a complete build environment can be created allowing you to build, not only for the host system, but also for one or more target platforms using a C/C++ cross compiler:

#!/usr/bin/env python
# -*- encoding: utf-8 -*-

import os, waftools
from waftools import ccross

top = '.'
out = 'build'
prefix = 'output'
ccrossini = os.path.abspath('ccross.ini').replace('\\', '/')

VERSION = '0.0.1'
APPNAME = 'cross-test'

def options(opt):
        opt.add_option('--prefix', dest='prefix', default=prefix,
                help='installation prefix [default: %r]' % prefix)
        opt.load('ccross', tooldir=waftools.location)

def configure(conf):
        conf.load('ccross')

def build(bld):
        ccross.build(bld, trees=['components'])

for var in ccross.variants(ccrossini):
        for ctx in ccross.contexts():
                name = ctx.__name__.replace('Context','').lower()
                class _t(ctx):
                        __doc__ = "%ss '%s'" % (name, var)
                        cmd = name + '_' + var
                        variant = var

When loading and configuring the ccross tool, as shown in the example above, all required C/C++ tools for each build environment variant (i.e. native or cross- compile) will be loaded and configured as well; e.g. compilers, makefile-, cmake-, eclipse-, codeblocks- and msdev exporters, cppcheck source code checking, doxygen documentation creation will be available for each build variant. Cross compile build environments can be specified in a seperate .INI file (named ccross.ini in the example above) using following syntax:

[arm]
prefix = arm-linux-gnueabihf

The section name, arm in the example above, specifies the name of the cross-compile build environment variant. The prefix will be in used to create the concrete names of the cross compile toolchain binaries:

AR      = arm-linux-gnueabihf-ar
CC      = arm-linux-gnueabihf-gcc
CXX     = arm-linux-gnueabihf-g++

Concrete build scripts (i.e. wscript files) for components can be placed somewhere within the components sub-directory. Any top level wscript file of a tree (being components in this example) will be detected and incorporated within the build environment. Any wscript files below those top level script files will have to be included using the bld.recurse(‘../somepath’) command from the top level script of that tree.

Support

Defects and/or feature requests can be reported at::

https://bitbucket.org/Moo7/waftools/issues

History

Following lists the changes per released version.

v0.4.2, 2014-11-30:

  • issue12; makefile, treat bld.objects() as stlib.

  • makefile; improved detection and handling of nested libraries.

  • issue11; cmake, treat bld.objects() as stlib.

v0.4.1, 2014-11-23:

  • ccross; added support for msvc

  • ccross; use gcc as default host compiler, use –cchost to use default platform compiler

  • ccross; added option for specifying compiler postfix in ccross.ini file

  • cppcheck; reimplemented using JinJa2

v0.4.0, 2014-11-17:

  • waftools; moved get_deps() and get_targets() to module deps

v0.3.9, 2014-11-16:

  • waftools; return unique list of deps in waftools.get_deps()

  • eclipse; [bug fix] use general compiler flags and includes

  • eclipse; [bug fix] export bld.objects() as static library

  • cmake; [bug fix] export bld.objects() as static library

v0.3.8, 2014-11-13:

  • issue9; add -pthread option by default in gnucc and use it for export(eclipse, makefiles, codeblocks)

  • eclipse; [bug fix] added shared system libs

  • eclipse; added eclipse_skipme task generator option

  • codeblocks; added codeblocks_skipme task generator option

  • cmake; added cmake_skipme task generator option

  • msdev; added msdev_skipme task generator option

  • codeblocks, cmake; only export projects for selected targets (e.g. –targets=a,b,)

v0.3.7, 2014-11-12:

  • general; added package dependency to chardet

  • ccross; fix when using multiple cross compilers

  • cppcheck; detect character encoding when parsing on source failed.

v0.3.6, 2014-11-10:

  • waftools; added generic waftools.recurse(ctx,trees=[]) function

  • issue8; check if options (e.g. env) exist in cross.ini file

  • ccross; use normal compiler, linker and archvier if no prefix has been specified in ccross.ini

  • eclipse; added generation of launchers

v0.3.5, 2014-11-09:

  • ccross; specify configuration file (cross.ini) using command line argument

  • ccross; added support for defining environment variables in ‘cross.ini’

  • wafinstall; allways create ‘extras’ directory (required for ‘compiler_c’ tool)

v0.3.4, 2014-11-06:

  • msdev, makefile; only export projects for selected targets (e.g. –targets=a,b,)

  • wafinstall; by default do not install files from waflib/Tools/extras (i.e. –tools=None), add missing __init__.py file to waflib/Tools/extras.

v0.3.3, 2014-11-04:

  • wafinstall; corrected detection of compression of the waf archive (gz or bz2)

  • makefile; several fixes and improvements:

    • handle cflags in task generator being specified as string

    • added support for read_shlib()

    • only build C/C++ tasks

    • use correct makefile, build directory and libpaths for variants (cross-compile)

  • eclipse; several fixes and improvements:

    • added support for library task generators exporting headers only (i.e. no source)

    • added missing external libraries in project; use ‘lib’ from task generator, added support for read_shlib(), a.k.a. fake_lib

v0.3.2, 2014-11-03:

  • issue5; fixed detection of (cross)compilers in ccross module when using waf-1.8.x

v0.3.1, 2014-10-30:

  • issue4; added missing package files (‘msdev.sln’ and ‘doxy.config’)

  • wafinstall; improved/revised waf install script (beta)

v0.3.0, 2014-10-23:

  • wafinstall; added install script, can be used to install the waf build system

v0.2.0, 2014-10-15:

  • general; added support for waf-1.8.x, several fixes for environment variables being changed to type(list)

  • ccross; use new unity and batched_cc tools from waf-1.8.x when available

v0.1.8, 2014-10-11:

  • general; updated package trove classifiers in setup.py

  • indent; new module uses GNU indent in order to clean-up and format C/C++ source code

  • documentation; improved detailed description of modules

v0.1.7, 2014-10-06:

  • makefile, codeblocks, eclipse; added support for multiple build environments (cross-compile)

  • codeblocks; added support for multiple build environments (cross-compile)

  • eclipse; changed export, now only export settings defined within the environment

v0.1.6, 2014-09-03:

  • makefile; corrected creation of relative source paths and fixed a problem when using underscores in directory or task names

  • cppcheck; fixed broken hyperlinks when using firefox web browser

v0.1.5, 2014-08-24:

  • general; corrected download url in setup.py

  • general; always use tgz format for released packages

  • gnucc; new module containing GNU C/C++ compiler specific configuration settings

  • examples; updated build scripts in ‘playground’

v0.1.4, 2014-08-18:

  • depends, tree; renamed depends module into tree

  • documenation; added tree to package description

  • waftools; added ‘location’ variable (i.e. ‘waftools.location’)

  • msdev, eclipse, cmake, codeblocks, make; improved export speed

  • issue2, issue3; improved installation path of package data files (e.g. msdev.sln)

  • msdev, cmake, codeblocks; fixed export on Windows

v0.1.3, 2014-07-21:

  • license; changed license to MIT

  • documentation; updated and improved detailed description of modules

  • msdev, eclipse, cmake, codeblocks, make; improved export function

  • eclipse; improved export when using MinGW on Windows

v0.1.2, 2014-07-01:

  • eclipse; improved export when includes and use tgen arguments are specified as string intead of list

  • codeblocks; use LIBPATH and INCLUDES dependencies, added pthread linker option

  • depend; new module that allows users to get an overview of dependencies between tasks

  • doxygen; new module that allows users to create C/C++ source documentation

v0.1.1, 2014-05-10:

  • codeblocks; added extra check when parsing dependencies (use)

  • msdev; added extra check when parsing dependencies (use)

  • eclipse; added extra check when parsing dependencies (use)

  • cppcheck; added extra check on C/C++ sources containing non human readable characters

v0.1.0, 2014-04-08:

  • msdev; added export function of C/C++ tasks to Visual Studio projects.

v0.0.9, 2014-04-01:

  • initial release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

waftools-0.4.2.tar.gz (85.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page