Skip to content

Use a separate build directory for each port #23961

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion tools/ports/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import logging
import hashlib
import os
from pathlib import Path
import shutil
import glob
import importlib.util
Expand Down Expand Up @@ -176,7 +177,10 @@ def install_headers(src_dir, pattern='*.h', target=None):

@staticmethod
def build_port(src_dir, output_path, port_name, includes=[], flags=[], cxxflags=[], exclude_files=[], exclude_dirs=[], srcs=[]): # noqa
build_dir = os.path.join(Ports.get_build_dir(), port_name)
mangled_name = str(Path(output_path).relative_to(Path(cache.get_sysroot(True)) / 'lib'))
mangled_name = mangled_name.replace(os.sep, '_').replace('.a', '').replace('-emscripten', '')
build_dir = os.path.join(Ports.get_build_dir(), port_name, mangled_name)
logger.debug(f'build_port: {port_name} {output_path} in {build_dir}')
if srcs:
srcs = [os.path.join(src_dir, s) for s in srcs]
else:
Expand Down Expand Up @@ -356,6 +360,7 @@ def clear_project_build(name):
port = ports_by_name[name]
port.clear(Ports, settings, shared)
build_dir = os.path.join(Ports.get_build_dir(), name)
logger.debug(f'clearing port build: {name} {build_dir}')
utils.delete_dir(build_dir)
return build_dir

Expand Down
3 changes: 1 addition & 2 deletions tools/ports/sdl2_mixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ def create(final):
if settings.PTHREADS:
flags.append('-pthread')

build_dir = ports.clear_project_build('sdl2_mixer')
include_path = os.path.join(source_path, 'include')
includes = [
include_path,
Expand All @@ -83,7 +82,7 @@ def create(final):
ports.build_port(
source_path,
final,
build_dir,
'sdl2_mixer',
flags=flags,
exclude_files=[
'playmus.c',
Expand Down