Skip to content
Snippets Groups Projects
Commit 00606837 authored by Mike Hommey's avatar Mike Hommey
Browse files

Bug 1059090 - Don't require SOURCES to be set for CPP_UNIT_TESTS and SIMPLE_PROGRAMS. r=mshal

parent ed70c5f3
No related branches found
No related tags found
No related merge requests found
Showing
with 27 additions and 61 deletions
......@@ -148,15 +148,24 @@ directory, in which case we can use the ``SimplePrograms`` template
'SecondProgram',
])
The corresponding ``SOURCES`` must match:
Contrary to ``Program``, which requires corresponding ``SOURCES``, when using
``SimplePrograms``, the corresponding ``SOURCES`` are implied. If the
corresponding ``sources`` have an extension different from ``.cpp``, it is
possible to specify the proper extension:
SOURCES += [
'FirstProgram.cpp',
'SecondProgram.c',
]
SimplePrograms([
'ThirdProgram',
'FourthProgram',
], ext='.c')
Please note this construct was added for compatibility with what already lives
in the mozilla tree ; it is recommended not to add new simple programs with
sources with a different extension than ``.cpp``.
Similar to ``SimplePrograms``, is the ``CppUnitTests`` template, which defines,
with the same rules, C++ unit tests programs.
with the same rules, C++ unit tests programs. Like ``SimplePrograms``, it takes
an ``ext`` argument to specify the extension for the corresponding ``SOURCES``,
if it's different from ``.cpp``.
Linking with system libraries
......
......@@ -11,21 +11,23 @@ def Program(name):
@template
def SimplePrograms(names):
def SimplePrograms(names, ext='.cpp'):
'''Template for simple program executables.
Those have a single source with the same base name as the executable.
'''
SIMPLE_PROGRAMS += names
SOURCES += ['%s%s' % (name, ext) for name in names]
@template
def CppUnitTests(names):
def CppUnitTests(names, ext='.cpp'):
'''Template for C++ unit tests.
Those have a single source with the same base name as the executable.
'''
CPP_UNIT_TESTS += names
SOURCES += ['%s%s' % (name, ext) for name in names]
@template
......@@ -41,12 +43,14 @@ def HostProgram(name):
@template
def HostSimplePrograms(names):
def HostSimplePrograms(names, ext='.cpp'):
'''Template for simple build tools executables.
Those have a single source with the same base name as the executable.
'''
HOST_SIMPLE_PROGRAMS += names
HOST_SOURCES += ['%s%s' % (name.replace('host_', ''), ext)
for name in names]
@template
......
......@@ -17,8 +17,6 @@ CppUnitTests([
'TestPlainTextSerializer',
])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
MOCHITEST_MANIFESTS += [
'chrome/mochitest.ini',
'csp/mochitest.ini',
......
......@@ -9,8 +9,6 @@ CppUnitTests([
'TestAudioMixer'
])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
FAIL_ON_WARNINGS = True
LOCAL_INCLUDES += [
......
......@@ -8,8 +8,6 @@ CppUnitTests([
'TestAudioEventTimeline',
])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
FAIL_ON_WARNINGS = True
LOCAL_INCLUDES += [
......
......@@ -8,8 +8,6 @@ CppUnitTests([
'TestAudioChannelService',
])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
if CONFIG['OS_ARCH'] == 'WINNT':
DEFINES['NOMINMAX'] = True
......
......@@ -8,8 +8,6 @@ CppUnitTests([
'TestWebGLElementArrayCache',
])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
FAIL_ON_WARNINGS = True
LOCAL_INCLUDES += [
......
......@@ -8,8 +8,6 @@ CppUnitTests([
'TestTXMgr',
])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
FAIL_ON_WARNINGS = True
USE_LIBS += [
......
......@@ -8,8 +8,6 @@ CppUnitTests([
'TestLineBreak',
])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
USE_LIBS += [
'mozalloc',
'nspr',
......
......@@ -6,8 +6,4 @@
SimplePrograms([
'umaptable',
])
SOURCES += [
'%s.c' % s for s in SIMPLE_PROGRAMS
]
], ext='.c')
......@@ -6,13 +6,9 @@
XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
SOURCES += [
'NormalizationTest.cpp',
'UnicharSelfTest.cpp',
]
SimplePrograms([
"%s" % (fyl[0:-4]) for fyl in SOURCES
'NormalizationTest',
'UnicharSelfTest',
])
USE_STATIC_LIBS = True
......
......@@ -423,12 +423,8 @@ else:
if CONFIG['_MSC_VER'] != '1600':
MSVC_ENABLE_PGO = True
HOST_SOURCES += [
'jskwgen.cpp',
]
HostSimplePrograms([
'host_%s' % f.replace('.cpp', '') for f in HOST_SOURCES
'host_jskwgen',
])
# JavaScript must be built shared, even for static builds, as it is used by
......
......@@ -4,12 +4,8 @@
# 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/.
HOST_SOURCES += [
'ListCSSProperties.cpp',
]
HostSimplePrograms([
'host_%s' % f.replace('.cpp', '') for f in HOST_SOURCES
'host_ListCSSProperties',
])
MOCHITEST_MANIFESTS += [
......
......@@ -15,8 +15,6 @@ if CONFIG['OS_TARGET'] != 'Android':
'test_sanity'
])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
LOCAL_INCLUDES += [
'../include'
]
......
......@@ -23,8 +23,6 @@ if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
'sctp_unittest',
])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
FAIL_ON_WARNINGS = True
for var in ('HAVE_STRDUP', 'NR_SOCKET_IS_VOID_PTR', 'SCTP_DEBUG', 'INET'):
......
......@@ -12,8 +12,6 @@ if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
'signaling_unittests',
])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
include('/ipc/chromium/chromium-config.mozbuild')
if CONFIG['OS_TARGET'] in ('Darwin', 'Android'):
......
......@@ -8,8 +8,6 @@ CppUnitTests([
'TestVolatileBuffer',
])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
USE_LIBS += [
'mozalloc',
'nspr',
......
......@@ -37,8 +37,6 @@ if not CONFIG['MOZ_ASAN']:
'TestPoisonArea',
])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
# Since we link directly with MFBT object files, define IMPL_MFBT
DEFINES['IMPL_MFBT'] = True
......
......@@ -6,9 +6,6 @@
NO_DIST_INSTALL = True
SOURCES += [
'TestZip.cpp',
]
SimplePrograms([
'TestZip',
])
......
......@@ -6,10 +6,6 @@
DISABLE_STL_WRAPPING = True
SOURCES += [
'ShowSSEConfig.cpp',
]
CppUnitTests([
'ShowSSEConfig',
])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment