Skip to content

Commit a5af114

Browse files
authored
Use a separate build directory for each port (#23961)
This allows building them simultaneously with Ninja. Split out from #23924
1 parent ca0d691 commit a5af114

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Diff for: tools/ports/__init__.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import logging
77
import hashlib
88
import os
9+
from pathlib import Path
910
import shutil
1011
import glob
1112
import importlib.util
@@ -176,7 +177,10 @@ def install_headers(src_dir, pattern='*.h', target=None):
176177

177178
@staticmethod
178179
def build_port(src_dir, output_path, port_name, includes=[], flags=[], cxxflags=[], exclude_files=[], exclude_dirs=[], srcs=[]): # noqa
179-
build_dir = os.path.join(Ports.get_build_dir(), port_name)
180+
mangled_name = str(Path(output_path).relative_to(Path(cache.get_sysroot(True)) / 'lib'))
181+
mangled_name = mangled_name.replace(os.sep, '_').replace('.a', '').replace('-emscripten', '')
182+
build_dir = os.path.join(Ports.get_build_dir(), port_name, mangled_name)
183+
logger.debug(f'build_port: {port_name} {output_path} in {build_dir}')
180184
if srcs:
181185
srcs = [os.path.join(src_dir, s) for s in srcs]
182186
else:
@@ -356,6 +360,7 @@ def clear_project_build(name):
356360
port = ports_by_name[name]
357361
port.clear(Ports, settings, shared)
358362
build_dir = os.path.join(Ports.get_build_dir(), name)
363+
logger.debug(f'clearing port build: {name} {build_dir}')
359364
utils.delete_dir(build_dir)
360365
return build_dir
361366

Diff for: tools/ports/sdl2_mixer.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ def create(final):
7373
if settings.PTHREADS:
7474
flags.append('-pthread')
7575

76-
build_dir = ports.clear_project_build('sdl2_mixer')
7776
include_path = os.path.join(source_path, 'include')
7877
includes = [
7978
include_path,
@@ -83,7 +82,7 @@ def create(final):
8382
ports.build_port(
8483
source_path,
8584
final,
86-
build_dir,
85+
'sdl2_mixer',
8786
flags=flags,
8887
exclude_files=[
8988
'playmus.c',

0 commit comments

Comments
 (0)