build/templates.mozbuild
author Mike Hommey <mh+mozilla@glandium.org>
Wed, 03 Sep 2014 14:10:54 +0900
changeset 203471 01a0e2c9c595e983605cb0aa5c12c9eceeb8ae7f
parent 201311 62b9f6d4328bb3609e731c694aabf9ad2ba9406d
child 203472 17bee965226aac3bfc80ac19b513467ae61c8609
permissions -rw-r--r--
Bug 1041941 - Use templates for programs, simple programs, libraries and C++ unit tests. r=gps

# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

@template
def Program(name):
    '''Template for program executables.'''
    PROGRAM = name


@template
def SimplePrograms(names):
    '''Template for simple program executables.

    Those have a single source with the same base name as the executable.
    '''
    SIMPLE_PROGRAMS += names


@template
def CppUnitTests(names):
    '''Template for C++ unit tests.

    Those have a single source with the same base name as the executable.
    '''
    CPP_UNIT_TESTS += names


@template
def Library(name):
    '''Template for libraries.'''
    LIBRARY_NAME = name


@template
def HostProgram(name):
    '''Template for build tools executables.'''
    HOST_PROGRAM = name


@template
def HostSimplePrograms(names):
    '''Template for simple build tools executables.

    Those have a single source with the same base name as the executable.
    '''
    HOST_SIMPLE_PROGRAMS += names


@template
def HostLibrary(name):
    '''Template for build tools libraries.'''
    HOST_LIBRARY_NAME = name


@template
def GeckoBinary():
    '''Template for binaries using Gecko.

    This template is meant to be used in other templates.
    '''
    USE_LIBS += [
        'mozalloc',
        'nspr',
        'xpcomglue_s',
        'xul',
    ]


@template
def XPCOMBinaryComponent(name):
    '''Template defining an XPCOM binary component for Gecko.

    name is the name of the component.
    '''
    LIBRARY_NAME = name

    GeckoBinary()

    IS_COMPONENT = True