Generate Wayland protocol definitions in parallel as well

This commit is contained in:
Kovid Goyal
2019-07-05 20:57:56 +05:30
parent 39f6071c68
commit 67f23664c9
2 changed files with 10 additions and 5 deletions

View File

@@ -84,7 +84,8 @@ def init_env(env, pkg_config, at_least_version, test_compile, module='x11'):
return ans return ans
def build_wayland_protocols(env, run_tool, emphasis, newer, dest_dir): def build_wayland_protocols(env, Command, parallel_run, emphasis, newer, dest_dir):
items = []
for protocol in env.wayland_protocols: for protocol in env.wayland_protocols:
src = os.path.join(env.wayland_packagedir, protocol) src = os.path.join(env.wayland_packagedir, protocol)
if not os.path.exists(src): if not os.path.exists(src):
@@ -94,8 +95,12 @@ def build_wayland_protocols(env, run_tool, emphasis, newer, dest_dir):
dest = os.path.join(dest_dir, dest) dest = os.path.join(dest_dir, dest)
if newer(dest, src): if newer(dest, src):
q = 'client-header' if ext == 'h' else env.wayland_scanner_code q = 'client-header' if ext == 'h' else env.wayland_scanner_code
run_tool([env.wayland_scanner, q, src, dest], items.append(Command(
desc='Generating {} ...'.format(emphasis(os.path.basename(dest)))) 'Generating {} ...'.format(emphasis(os.path.basename(dest))),
[env.wayland_scanner, q, src, dest],
lambda: True, None, None, None))
if items:
parallel_run(items)
class Arg: class Arg:

View File

@@ -403,7 +403,7 @@ def parallel_run(items):
while len(workers): while len(workers):
wait() wait()
if not verbose: if not verbose:
print() print(' done')
if failed: if failed:
print(failed.desc) print(failed.desc)
run_tool(failed.cmd) run_tool(failed.cmd)
@@ -552,7 +552,7 @@ def compile_glfw(compilation_database):
all_headers = [os.path.join('glfw', x) for x in genv.all_headers] all_headers = [os.path.join('glfw', x) for x in genv.all_headers]
if module == 'wayland': if module == 'wayland':
try: try:
glfw.build_wayland_protocols(genv, run_tool, emphasis, newer, os.path.join(base, 'glfw')) glfw.build_wayland_protocols(genv, Command, parallel_run, emphasis, newer, os.path.join(base, 'glfw'))
except SystemExit as err: except SystemExit as err:
print(err, file=sys.stderr) print(err, file=sys.stderr)
print(error('Disabling building of wayland backend'), file=sys.stderr) print(error('Disabling building of wayland backend'), file=sys.stderr)