2014-08-23 17:11:05 -07:00
|
|
|
# -*- 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/.
|
|
|
|
|
2014-09-03 17:05:12 -07:00
|
|
|
@template
|
2014-10-28 21:29:42 -07:00
|
|
|
def Binary():
|
|
|
|
'''Generic template for target binaries. Meant to be used by other
|
|
|
|
templates.'''
|
2014-09-03 17:05:12 -07:00
|
|
|
|
|
|
|
if CONFIG['MOZ_LIBSTDCXX_TARGET_VERSION']:
|
|
|
|
USE_LIBS += ['stdc++compat']
|
|
|
|
|
2014-10-28 21:29:42 -07:00
|
|
|
# Ideally, we'd support not adding this to the LIB_IS_C_ONLY case,
|
|
|
|
# but that variable is actually only set in db/sqlite/src, which
|
|
|
|
# doesn't build a shared library on the relevant platforms anyways.
|
|
|
|
# Eventually, though, we should detect LIB_IS_C_ONLY based on the
|
|
|
|
# associated SOURCES (and there might actually be places where we
|
|
|
|
# haven't set it but should have).
|
|
|
|
if CONFIG['STLPORT_LIBS']:
|
|
|
|
OS_LIBS += [CONFIG['STLPORT_LIBS']]
|
|
|
|
elif CONFIG['OS_TARGET'] == 'Android':
|
|
|
|
USE_LIBS += ['stlport']
|
|
|
|
|
2014-09-03 17:05:12 -07:00
|
|
|
|
2014-09-02 22:10:54 -07:00
|
|
|
@template
|
|
|
|
def Program(name):
|
|
|
|
'''Template for program executables.'''
|
|
|
|
PROGRAM = name
|
|
|
|
|
2014-10-28 21:29:42 -07:00
|
|
|
Binary()
|
2014-09-03 17:05:12 -07:00
|
|
|
|
2014-09-02 22:10:54 -07:00
|
|
|
|
|
|
|
@template
|
2014-09-02 22:16:37 -07:00
|
|
|
def SimplePrograms(names, ext='.cpp'):
|
2014-09-02 22:10:54 -07:00
|
|
|
'''Template for simple program executables.
|
|
|
|
|
|
|
|
Those have a single source with the same base name as the executable.
|
|
|
|
'''
|
|
|
|
SIMPLE_PROGRAMS += names
|
2014-09-02 22:16:37 -07:00
|
|
|
SOURCES += ['%s%s' % (name, ext) for name in names]
|
2014-09-02 22:10:54 -07:00
|
|
|
|
2014-10-28 21:29:42 -07:00
|
|
|
Binary()
|
2014-09-03 17:05:12 -07:00
|
|
|
|
2014-09-02 22:10:54 -07:00
|
|
|
|
|
|
|
@template
|
2014-09-02 22:16:37 -07:00
|
|
|
def CppUnitTests(names, ext='.cpp'):
|
2014-09-02 22:10:54 -07:00
|
|
|
'''Template for C++ unit tests.
|
|
|
|
|
|
|
|
Those have a single source with the same base name as the executable.
|
|
|
|
'''
|
|
|
|
CPP_UNIT_TESTS += names
|
2014-09-02 22:16:37 -07:00
|
|
|
SOURCES += ['%s%s' % (name, ext) for name in names]
|
2014-09-02 22:10:54 -07:00
|
|
|
|
2014-10-28 21:29:42 -07:00
|
|
|
Binary()
|
2014-09-03 17:05:12 -07:00
|
|
|
|
2014-09-02 22:10:54 -07:00
|
|
|
|
|
|
|
@template
|
|
|
|
def Library(name):
|
|
|
|
'''Template for libraries.'''
|
|
|
|
LIBRARY_NAME = name
|
|
|
|
|
|
|
|
|
2014-09-03 17:04:45 -07:00
|
|
|
@template
|
|
|
|
def SharedLibrary(name):
|
|
|
|
'''Template for shared libraries.'''
|
|
|
|
Library(name)
|
|
|
|
|
|
|
|
FORCE_SHARED_LIB = True
|
|
|
|
|
2014-10-28 21:29:42 -07:00
|
|
|
Binary()
|
2014-09-03 17:05:12 -07:00
|
|
|
|
2014-09-03 17:04:45 -07:00
|
|
|
|
|
|
|
@template
|
|
|
|
def Framework(name):
|
|
|
|
'''Template for OSX Frameworks.'''
|
2014-09-03 17:05:12 -07:00
|
|
|
SharedLibrary(name)
|
2014-09-03 17:04:45 -07:00
|
|
|
|
|
|
|
IS_FRAMEWORK = True
|
|
|
|
|
|
|
|
|
2014-09-03 17:05:12 -07:00
|
|
|
@template
|
|
|
|
def HostStdCppCompat():
|
|
|
|
'''Template for libstdc++ compatibility for host binaries.'''
|
|
|
|
|
|
|
|
if CONFIG['MOZ_LIBSTDCXX_HOST_VERSION']:
|
|
|
|
HOST_USE_LIBS += ['host_stdc++compat']
|
|
|
|
|
|
|
|
|
2014-09-02 22:10:54 -07:00
|
|
|
@template
|
|
|
|
def HostProgram(name):
|
|
|
|
'''Template for build tools executables.'''
|
|
|
|
HOST_PROGRAM = name
|
|
|
|
|
2014-09-03 17:05:12 -07:00
|
|
|
HostStdCppCompat()
|
|
|
|
|
2014-09-02 22:10:54 -07:00
|
|
|
|
|
|
|
@template
|
2014-09-02 22:16:37 -07:00
|
|
|
def HostSimplePrograms(names, ext='.cpp'):
|
2014-09-02 22:10:54 -07:00
|
|
|
'''Template for simple build tools executables.
|
|
|
|
|
|
|
|
Those have a single source with the same base name as the executable.
|
|
|
|
'''
|
|
|
|
HOST_SIMPLE_PROGRAMS += names
|
2014-09-02 22:16:37 -07:00
|
|
|
HOST_SOURCES += ['%s%s' % (name.replace('host_', ''), ext)
|
|
|
|
for name in names]
|
2014-09-02 22:10:54 -07:00
|
|
|
|
2014-09-03 17:05:12 -07:00
|
|
|
HostStdCppCompat()
|
|
|
|
|
2014-09-02 22:10:54 -07:00
|
|
|
|
|
|
|
@template
|
|
|
|
def HostLibrary(name):
|
|
|
|
'''Template for build tools libraries.'''
|
|
|
|
HOST_LIBRARY_NAME = name
|
|
|
|
|
|
|
|
|
2014-10-29 21:06:12 -07:00
|
|
|
include('gecko_templates.mozbuild')
|