--- a/gfx/angle/targets/angle_common/moz.build
+++ b/gfx/angle/targets/angle_common/moz.build
@@ -42,17 +42,17 @@ DEFINES['_UNICODE'] = True
LOCAL_INCLUDES += [
'../../checkout/',
'../../checkout/include/',
'../../checkout/out/gen/',
'../../checkout/out/gen/angle/',
'../../checkout/src/',
'../../checkout/src/common/third_party/base/',
]
-#
+
#CXXFLAGS += [
# '/bigobj',
# '/d2FastFail',
# '/D__DATE__=',
# '/D__TIME__=',
# '/D__TIMESTAMP__=',
# '/FS',
# '/GF',
@@ -113,27 +113,30 @@ SOURCES += [
'../../checkout/src/common/string_utils.cpp',
'../../checkout/src/common/system_utils.cpp',
'../../checkout/src/common/third_party/base/anglebase/sha1.cc',
'../../checkout/src/common/third_party/smhasher/src/PMurHash.cpp',
'../../checkout/src/common/tls.cpp',
'../../checkout/src/common/uniform_type_info_autogen.cpp',
'../../checkout/src/common/utilities.cpp',
]
+
if CONFIG['OS_ARCH'] == 'Darwin':
SOURCES += [
'../../checkout/src/common/system_utils_mac.cpp',
]
-if CONFIG['OS_ARCH'] == 'Linux':
- SOURCES += [
- '../../checkout/src/common/system_utils_linux.cpp',
- ]
+
if CONFIG['OS_ARCH'] == 'WINNT':
SOURCES += [
'../../checkout/src/common/system_utils_win.cpp',
]
-#
+
+if CONFIG['OS_ARCH'] not in ('Darwin', 'WINNT'):
+ SOURCES += [
+ '../../checkout/src/common/system_utils_linux.cpp',
+ ]
+
#LDFLAGS += [
# '/DEBUG',
# '/WX',
#]
Library('angle_common')
--- a/gfx/angle/targets/angle_gpu_info_util/moz.build
+++ b/gfx/angle/targets/angle_gpu_info_util/moz.build
@@ -42,17 +42,17 @@ DEFINES['_UNICODE'] = True
LOCAL_INCLUDES += [
'../../checkout/',
'../../checkout/include/',
'../../checkout/out/gen/',
'../../checkout/out/gen/angle/',
'../../checkout/src/',
'../../checkout/src/common/third_party/base/',
]
-#
+
#CXXFLAGS += [
# '/bigobj',
# '/d2FastFail',
# '/D__DATE__=',
# '/D__TIME__=',
# '/D__TIMESTAMP__=',
# '/FS',
# '/GF',
@@ -100,31 +100,32 @@ LOCAL_INCLUDES += [
# '/WX',
# '/Zc:sizedDealloc-',
# '/Zi',
#]
SOURCES += [
'../../checkout/src/gpu_info_util/SystemInfo.cpp',
]
+
if CONFIG['OS_ARCH'] == 'WINNT':
SOURCES += [
'../../checkout/src/gpu_info_util/SystemInfo_win.cpp',
]
USE_LIBS += [
'angle_common',
]
DIRS += [
'../angle_common',
]
OS_LIBS += [
'setupapi',
]
-#
+
#LDFLAGS += [
# '/DEBUG',
# '/WX',
#]
Library('angle_gpu_info_util')
--- a/gfx/angle/targets/angle_image_util/moz.build
+++ b/gfx/angle/targets/angle_image_util/moz.build
@@ -41,17 +41,17 @@ DEFINES['_UNICODE'] = True
LOCAL_INCLUDES += [
'../../checkout/',
'../../checkout/include/',
'../../checkout/out/gen/',
'../../checkout/out/gen/angle/',
'../../checkout/src/',
'../../checkout/src/common/third_party/base/',
]
-#
+
#CXXFLAGS += [
# '/bigobj',
# '/d2FastFail',
# '/D__DATE__=',
# '/D__TIME__=',
# '/D__TIMESTAMP__=',
# '/FS',
# '/GF',
@@ -110,15 +110,15 @@ SOURCES += [
USE_LIBS += [
'angle_common',
]
DIRS += [
'../angle_common',
]
-#
+
#LDFLAGS += [
# '/DEBUG',
# '/WX',
#]
Library('angle_image_util')
--- a/gfx/angle/targets/libANGLE/moz.build
+++ b/gfx/angle/targets/libANGLE/moz.build
@@ -47,17 +47,17 @@ DEFINES['_UNICODE'] = True
LOCAL_INCLUDES += [
'../../checkout/',
'../../checkout/include/',
'../../checkout/out/gen/',
'../../checkout/out/gen/angle/',
'../../checkout/src/',
'../../checkout/src/common/third_party/base/',
]
-#
+
#CXXFLAGS += [
# '/bigobj',
# '/d2FastFail',
# '/D__DATE__=',
# '/D__TIME__=',
# '/D__TIMESTAMP__=',
# '/FS',
# '/GF',
@@ -269,15 +269,15 @@ DIRS += [
'../translator',
]
OS_LIBS += [
'd3d9',
'dxguid',
'setupapi',
]
-#
+
#LDFLAGS += [
# '/DEBUG',
# '/WX',
#]
Library('libANGLE')
--- a/gfx/angle/targets/libEGL/moz.build
+++ b/gfx/angle/targets/libEGL/moz.build
@@ -44,17 +44,17 @@ DEFINES['_UNICODE'] = True
LOCAL_INCLUDES += [
'../../checkout/',
'../../checkout/include/',
'../../checkout/out/gen/',
'../../checkout/out/gen/angle/',
'../../checkout/src/',
'../../checkout/src/common/third_party/base/',
]
-#
+
#CXXFLAGS += [
# '/bigobj',
# '/d2FastFail',
# '/D__DATE__=',
# '/D__TIME__=',
# '/D__TIMESTAMP__=',
# '/FS',
# '/GF',
@@ -136,26 +136,26 @@ OS_LIBS += [
'usp10',
'uuid',
'version',
'wininet',
'winmm',
'winspool',
'ws2_32',
]
-#
+
#LDFLAGS += [
# '/DEBUG',
# '/DYNAMICBASE:NO',
# '/fastfail',
# '/FIXED:NO',
# '/ignore:4199',
# '/ignore:4221',
# '/INCREMENTAL',
# '/MACHINE:X64',
# '/NXCOMPAT',
# '/SUBSYSTEM:CONSOLE,5.02',
# '/WX',
#]
+
DEFFILE = SRCDIR + '/../../checkout/src/libEGL/libEGL.def'
RCFILE = '../../checkout/src/libEGL/libEGL.rc'
-
GeckoSharedLibrary('libEGL', linkage=None)
--- a/gfx/angle/targets/libGLESv2/moz.build
+++ b/gfx/angle/targets/libGLESv2/moz.build
@@ -48,17 +48,17 @@ DEFINES['_UNICODE'] = True
LOCAL_INCLUDES += [
'../../checkout/',
'../../checkout/include/',
'../../checkout/out/gen/',
'../../checkout/out/gen/angle/',
'../../checkout/src/',
'../../checkout/src/common/third_party/base/',
]
-#
+
#CXXFLAGS += [
# '/bigobj',
# '/d2FastFail',
# '/D__DATE__=',
# '/D__TIME__=',
# '/D__TIMESTAMP__=',
# '/FS',
# '/GF',
@@ -154,26 +154,26 @@ OS_LIBS += [
'usp10',
'uuid',
'version',
'wininet',
'winmm',
'winspool',
'ws2_32',
]
-#
+
#LDFLAGS += [
# '/DEBUG',
# '/DYNAMICBASE:NO',
# '/fastfail',
# '/FIXED:NO',
# '/ignore:4199',
# '/ignore:4221',
# '/INCREMENTAL',
# '/MACHINE:X64',
# '/NXCOMPAT',
# '/SUBSYSTEM:CONSOLE,5.02',
# '/WX',
#]
+
DEFFILE = SRCDIR + '/../../checkout/src/libGLESv2/libGLESv2.def'
RCFILE = '../../checkout/src/libGLESv2/libGLESv2.rc'
-
GeckoSharedLibrary('libGLESv2', linkage=None)
--- a/gfx/angle/targets/preprocessor/moz.build
+++ b/gfx/angle/targets/preprocessor/moz.build
@@ -41,17 +41,17 @@ DEFINES['_UNICODE'] = True
LOCAL_INCLUDES += [
'../../checkout/',
'../../checkout/include/',
'../../checkout/out/gen/',
'../../checkout/out/gen/angle/',
'../../checkout/src/',
'../../checkout/src/common/third_party/base/',
]
-#
+
#CXXFLAGS += [
# '/bigobj',
# '/d2FastFail',
# '/D__DATE__=',
# '/D__TIME__=',
# '/D__TIMESTAMP__=',
# '/FS',
# '/GF',
@@ -117,15 +117,15 @@ SOURCES += [
USE_LIBS += [
'angle_common',
]
DIRS += [
'../angle_common',
]
-#
+
#LDFLAGS += [
# '/DEBUG',
# '/WX',
#]
Library('preprocessor')
--- a/gfx/angle/targets/translator/moz.build
+++ b/gfx/angle/targets/translator/moz.build
@@ -44,17 +44,17 @@ DEFINES['_UNICODE'] = True
LOCAL_INCLUDES += [
'../../checkout/',
'../../checkout/include/',
'../../checkout/out/gen/',
'../../checkout/out/gen/angle/',
'../../checkout/src/',
'../../checkout/src/common/third_party/base/',
]
-#
+
#CXXFLAGS += [
# '/bigobj',
# '/d2FastFail',
# '/D__DATE__=',
# '/D__TIME__=',
# '/D__TIMESTAMP__=',
# '/FS',
# '/GF',
@@ -223,15 +223,15 @@ USE_LIBS += [
'angle_common',
'preprocessor',
]
DIRS += [
'../angle_common',
'../preprocessor',
]
-#
+
#LDFLAGS += [
# '/DEBUG',
# '/WX',
#]
Library('translator')
--- a/gfx/angle/update-angle.py
+++ b/gfx/angle/update-angle.py
@@ -213,25 +213,25 @@ shutil.rmtree(checkout_dir, True)
targets_dir.mkdir(exist_ok=True)
checkout_dir.mkdir(exist_ok=True)
# Export our targets
def sortedi(x):
return sorted(x, key=str.lower)
-def append_arr(dest, name, vals):
+def append_arr(dest, name, vals, indent=0):
if not vals:
return
- dest.append('')
- dest.append('{} += ['.format(name))
+ dest.append('{}{} += ['.format(' '*4*indent, name))
for x in sortedi(vals):
- dest.append(" '{}',".format(x))
- dest.append(']')
+ dest.append("{}'{}',".format(' '*4*(indent+1), x))
+ dest.append('{}]'.format(' '*4*indent))
+ dest.append('')
return
INCLUDE_REGEX = re.compile('# *include *"(.+)"')
IGNORED_INCLUDES = {
'compiler/translator/TranslatorVulkan.h',
'libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.h',
'libANGLE/renderer/gl/glx/DisplayGLX.h',
@@ -390,55 +390,58 @@ def export_target(root):
total_used_files.update(includable, root['sources']) # With 'sources' to get rc/defs.
# --
target_dir = Path(targets_dir, name)
target_dir.mkdir(exist_ok=True)
lines = COMMON_HEADER[:]
+ lines.append('')
- lines.append('')
for x in sorted(set(accum_desc['defines'])):
try:
(k, v) = x.split('=', 1)
v = "'{}'".format(v)
except ValueError:
(k, v) = (x, 'True')
try:
line = "DEFINES['{}'] = {}".format(k, v)
if REGISTERED_DEFINES[k] == False:
line = '#' + line
lines.append(line)
except KeyError:
print('[{}] Unrecognized define: {}'.format(name, k))
+ lines.append('')
cxxflags = set(accum_desc['cflags'] + accum_desc['cflags_cc'])
def fixup_paths(listt):
for x in set(listt):
assert x.startswith('//'), x
yield '../../checkout/' + x[2:]
- sources = []
- sources_by_os_arch = {}
+ sources_by_config = {}
extras = dict()
for x in fixup_paths(accum_desc['sources']):
(b, e) = x.rsplit('.', 1)
if e in ['h', 'y', 'l', 'inl']:
continue
elif e in ['cpp', 'cc']:
if b.endswith('_win'):
- sources_by_os_arch.setdefault('WINNT', []).append(x)
+ config = "CONFIG['OS_ARCH'] == 'WINNT'"
elif b.endswith('_linux'):
- sources_by_os_arch.setdefault('Linux', []).append(x)
+ # Include these on BSDs too.
+ config = "CONFIG['OS_ARCH'] not in ('Darwin', 'WINNT')"
elif b.endswith('_mac'):
- sources_by_os_arch.setdefault('Darwin', []).append(x)
+ config = "CONFIG['OS_ARCH'] == 'Darwin'"
else:
- sources.append(x)
+ config = '' # None can't compare against str.
+
+ sources_by_config.setdefault(config, []).append(x)
continue
elif e == 'rc':
assert 'RCFILE' not in extras
extras['RCFILE'] = "'{}'".format(x)
continue
elif e == 'def':
assert 'DEFFILE' not in extras
extras['DEFFILE'] = "SRCDIR + '/{}'".format(x)
@@ -447,44 +450,46 @@ def export_target(root):
assert False, x
ldflags = filter(lambda x: not x.startswith('/DEF:'), set(accum_desc['ldflags']))
os_libs = list(map( lambda x: x[:-len('.lib')], set(accum_desc.get('libs', [])) ))
def append_arr_commented(dest, name, src):
lines = []
append_arr(lines, name, src)
- lines = map(lambda x: '#' + x, lines)
+ def comment(x):
+ if x:
+ x = '#' + x
+ return x
+ lines = map(comment, lines)
dest += lines
append_arr(lines, 'LOCAL_INCLUDES', fixup_paths(accum_desc['include_dirs']))
append_arr_commented(lines, 'CXXFLAGS', cxxflags)
- append_arr(lines, 'SOURCES', sources)
- for (os_arch,v) in sorted_items(sources_by_os_arch):
- lines += [
- "if CONFIG['OS_ARCH'] == '{}':".format(os_arch),
- " SOURCES += [",
- ]
- lines += ("{}'{}',".format(' '*8, x) for x in sorted(set(v)))
- lines += [" ]"]
+ for (config,v) in sorted_items(sources_by_config):
+ indent = 0
+ if config:
+ lines.append("if {}:".format(config))
+ indent = 1
+ append_arr(lines, 'SOURCES', v, indent=indent)
append_arr(lines, 'USE_LIBS', use_libs)
append_arr(lines, 'DIRS', ['../' + x for x in use_libs])
append_arr(lines, 'OS_LIBS', os_libs)
append_arr_commented(lines, 'LDFLAGS', ldflags)
for (k,v) in sorted(extras.items()):
lines.append('{} = {}'.format(k, v))
lib_type = root['type']
if lib_type == 'shared_library':
- lines.append("\nGeckoSharedLibrary('{}', linkage=None)".format(name))
+ lines.append("GeckoSharedLibrary('{}', linkage=None)".format(name))
elif lib_type == 'static_library':
- lines.append("\nLibrary('{}')".format(name))
+ lines.append("Library('{}')".format(name))
else:
assert False, lib_type
# Write it out
mozbuild = Path(target_dir, 'moz.build')
print_now(' Writing {}'.format(mozbuild))
with mozbuild.open('w', newline='\n') as f: