mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
GH-114809: Add support for macOS multi-arch builds with the JIT enabled (#131751)
Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com> Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
This commit is contained in:
parent
2b67db7ce3
commit
26c0248b54
7 changed files with 152 additions and 102 deletions
|
@ -11,7 +11,10 @@ if __name__ == "__main__":
|
|||
comment = f"$ {shlex.join([pathlib.Path(sys.executable).name] + sys.argv)}"
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument(
|
||||
"target", type=_targets.get_target, help="a PEP 11 target triple to compile for"
|
||||
"target",
|
||||
nargs="+",
|
||||
type=_targets.get_target,
|
||||
help="a PEP 11 target triple to compile for",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-d", "--debug", action="store_true", help="compile for a debug build of Python"
|
||||
|
@ -23,6 +26,22 @@ if __name__ == "__main__":
|
|||
"-v", "--verbose", action="store_true", help="echo commands as they are run"
|
||||
)
|
||||
args = parser.parse_args()
|
||||
args.target.debug = args.debug
|
||||
args.target.verbose = args.verbose
|
||||
args.target.build(pathlib.Path.cwd(), comment=comment, force=args.force)
|
||||
for target in args.target:
|
||||
target.debug = args.debug
|
||||
target.force = args.force
|
||||
target.verbose = args.verbose
|
||||
target.build(
|
||||
pathlib.Path.cwd(),
|
||||
comment=comment,
|
||||
stencils_h=f"jit_stencils-{target.triple}.h",
|
||||
force=args.force,
|
||||
)
|
||||
|
||||
with open("jit_stencils.h", "w") as fp:
|
||||
for idx, target in enumerate(args.target):
|
||||
fp.write(f"#{'if' if idx == 0 else 'elif'} {target.condition}\n")
|
||||
fp.write(f'#include "jit_stencils-{target.triple}.h"\n')
|
||||
|
||||
fp.write("#else\n")
|
||||
fp.write('#error "unexpected target"\n')
|
||||
fp.write("#endif\n")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue