2016-07-14 19:16:42 +03:00
|
|
|
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
2014-08-24 04:11:05 +04:00
|
|
|
# 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-04 04:05:12 +04:00
|
|
|
@template
|
2014-10-29 07:29:42 +03:00
|
|
|
def Binary():
|
|
|
|
'''Generic template for target binaries. Meant to be used by other
|
|
|
|
templates.'''
|
2014-09-04 04:05:12 +04:00
|
|
|
|
|
|
|
if CONFIG['MOZ_LIBSTDCXX_TARGET_VERSION']:
|
|
|
|
USE_LIBS += ['stdc++compat']
|
|
|
|
|
2014-10-29 07:29:42 +03: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']]
|
|
|
|
|
2017-07-05 16:32:30 +03:00
|
|
|
# Add -llog by default, since we use it all over the place.
|
|
|
|
if CONFIG['OS_TARGET'] == 'Android':
|
|
|
|
OS_LIBS += ['log']
|
|
|
|
|
2014-09-04 04:05:12 +04:00
|
|
|
|
2014-09-03 09:10:54 +04:00
|
|
|
@template
|
|
|
|
def Program(name):
|
|
|
|
'''Template for program executables.'''
|
|
|
|
PROGRAM = name
|
|
|
|
|
2014-10-29 07:29:42 +03:00
|
|
|
Binary()
|
2014-09-04 04:05:12 +04:00
|
|
|
|
2014-09-03 09:10:54 +04:00
|
|
|
|
|
|
|
@template
|
2014-09-03 09:16:37 +04:00
|
|
|
def SimplePrograms(names, ext='.cpp'):
|
2014-09-03 09:10:54 +04:00
|
|
|
'''Template for simple program executables.
|
|
|
|
|
|
|
|
Those have a single source with the same base name as the executable.
|
|
|
|
'''
|
|
|
|
SIMPLE_PROGRAMS += names
|
2014-09-03 09:16:37 +04:00
|
|
|
SOURCES += ['%s%s' % (name, ext) for name in names]
|
2014-09-03 09:10:54 +04:00
|
|
|
|
2014-10-29 07:29:42 +03:00
|
|
|
Binary()
|
2014-09-04 04:05:12 +04:00
|
|
|
|
2014-09-03 09:10:54 +04:00
|
|
|
|
|
|
|
@template
|
2014-09-03 09:16:37 +04:00
|
|
|
def CppUnitTests(names, ext='.cpp'):
|
2014-09-03 09:10:54 +04:00
|
|
|
'''Template for C++ unit tests.
|
|
|
|
|
|
|
|
Those have a single source with the same base name as the executable.
|
|
|
|
'''
|
2017-09-20 22:43:24 +03:00
|
|
|
COMPILE_FLAGS['EXTRA_INCLUDES'] = ['-I%s/dist/include' % TOPOBJDIR,
|
|
|
|
'-I%s/dist/include/testing' % TOPOBJDIR]
|
2014-09-03 09:10:54 +04:00
|
|
|
CPP_UNIT_TESTS += names
|
2014-09-03 09:16:37 +04:00
|
|
|
SOURCES += ['%s%s' % (name, ext) for name in names]
|
2014-09-03 09:10:54 +04:00
|
|
|
|
2014-10-29 07:29:42 +03:00
|
|
|
Binary()
|
2014-09-04 04:05:12 +04:00
|
|
|
|
2014-09-03 09:10:54 +04:00
|
|
|
|
|
|
|
@template
|
|
|
|
def Library(name):
|
|
|
|
'''Template for libraries.'''
|
|
|
|
LIBRARY_NAME = name
|
|
|
|
|
|
|
|
|
2016-08-06 07:49:26 +03:00
|
|
|
@template
|
2017-02-23 18:35:07 +03:00
|
|
|
def RustLibrary(name, features=None, target_dir=None):
|
2016-08-06 07:49:26 +03:00
|
|
|
'''Template for Rust libraries.'''
|
|
|
|
Library(name)
|
|
|
|
|
|
|
|
IS_RUST_LIBRARY = True
|
2016-12-02 19:56:43 +03:00
|
|
|
|
|
|
|
if features:
|
|
|
|
RUST_LIBRARY_FEATURES = features
|
2016-08-06 07:49:26 +03:00
|
|
|
|
2017-02-23 18:35:07 +03:00
|
|
|
if target_dir:
|
|
|
|
RUST_LIBRARY_TARGET_DIR = target_dir
|
|
|
|
|
2016-08-06 07:49:26 +03:00
|
|
|
|
2014-09-04 04:04:45 +04:00
|
|
|
@template
|
|
|
|
def SharedLibrary(name):
|
|
|
|
'''Template for shared libraries.'''
|
|
|
|
Library(name)
|
|
|
|
|
|
|
|
FORCE_SHARED_LIB = True
|
|
|
|
|
2014-10-29 07:29:42 +03:00
|
|
|
Binary()
|
2014-09-04 04:05:12 +04:00
|
|
|
|
2014-09-04 04:04:45 +04:00
|
|
|
|
|
|
|
@template
|
|
|
|
def Framework(name):
|
|
|
|
'''Template for OSX Frameworks.'''
|
2014-09-04 04:05:12 +04:00
|
|
|
SharedLibrary(name)
|
2014-09-04 04:04:45 +04:00
|
|
|
|
|
|
|
IS_FRAMEWORK = True
|
|
|
|
|
|
|
|
|
2014-09-04 04:05:12 +04: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-03 09:10:54 +04:00
|
|
|
@template
|
2016-02-18 03:03:01 +03:00
|
|
|
def HostProgram(name, c_only=False):
|
2014-09-03 09:10:54 +04:00
|
|
|
'''Template for build tools executables.'''
|
|
|
|
HOST_PROGRAM = name
|
|
|
|
|
2016-02-18 03:03:01 +03:00
|
|
|
# With context-based templates, this won't be needed anymore, and will
|
|
|
|
# work better than relying on the caller setting it, but at the moment,
|
|
|
|
# this is the best we have. And it doesn't matter /that/ much, so there's
|
|
|
|
# really only one place using this, where it does matter to avoid the
|
|
|
|
# extra dependency (because it creates a circular one).
|
|
|
|
if not c_only:
|
|
|
|
HostStdCppCompat()
|
2014-09-04 04:05:12 +04:00
|
|
|
|
2014-09-03 09:10:54 +04:00
|
|
|
|
|
|
|
@template
|
2014-09-03 09:16:37 +04:00
|
|
|
def HostSimplePrograms(names, ext='.cpp'):
|
2014-09-03 09:10:54 +04: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-03 09:16:37 +04:00
|
|
|
HOST_SOURCES += ['%s%s' % (name.replace('host_', ''), ext)
|
|
|
|
for name in names]
|
2014-09-03 09:10:54 +04:00
|
|
|
|
2014-09-04 04:05:12 +04:00
|
|
|
HostStdCppCompat()
|
|
|
|
|
2014-09-03 09:10:54 +04:00
|
|
|
|
|
|
|
@template
|
|
|
|
def HostLibrary(name):
|
|
|
|
'''Template for build tools libraries.'''
|
|
|
|
HOST_LIBRARY_NAME = name
|
|
|
|
|
2017-01-20 01:58:10 +03:00
|
|
|
@template
|
|
|
|
def HostRustLibrary(name, features=None):
|
|
|
|
'''Template for host Rust libraries.'''
|
|
|
|
HostLibrary(name)
|
|
|
|
|
|
|
|
IS_RUST_LIBRARY = True
|
|
|
|
|
|
|
|
if features:
|
|
|
|
HOST_RUST_LIBRARY_FEATURES = features
|
|
|
|
|
2017-04-29 02:35:19 +03:00
|
|
|
@template
|
|
|
|
def DisableStlWrapping():
|
|
|
|
COMPILE_FLAGS['STL'] = []
|
|
|
|
|
2017-09-11 21:36:31 +03:00
|
|
|
@template
|
|
|
|
def NoVisibilityFlags():
|
|
|
|
COMPILE_FLAGS['VISIBILITY'] = []
|
|
|
|
|
2014-09-03 09:10:54 +04:00
|
|
|
|
2017-10-02 16:21:22 +03:00
|
|
|
@template
|
|
|
|
def RustTest(name, features=None):
|
|
|
|
RUST_TEST = name
|
|
|
|
|
|
|
|
if features:
|
|
|
|
RUST_TEST_FEATURES = features
|
|
|
|
|
2014-10-30 07:06:12 +03:00
|
|
|
include('gecko_templates.mozbuild')
|
2015-12-14 22:50:56 +03:00
|
|
|
include('test_templates.mozbuild')
|