34 行
1.4 KiB
Python
34 行
1.4 KiB
Python
#!/usr/bin/env python3
|
|
"""Build the versioned AIR arithmetic and Dayu's authored Metal boundary."""
|
|
from pathlib import Path
|
|
import argparse
|
|
import subprocess
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument('--output', required=True, type=Path)
|
|
parser.add_argument('--intermediates', required=True, type=Path)
|
|
args = parser.parse_args()
|
|
root = Path(__file__).resolve().parent.parent
|
|
work = args.intermediates.resolve()
|
|
work.mkdir(parents=True, exist_ok=True)
|
|
args.output.parent.mkdir(parents=True, exist_ok=True)
|
|
objects = []
|
|
for name in ('DYGradeKernel', 'DYStatisticsKernel', 'DYLUTExportKernel', 'CSTKernel', 'BasisKernel'):
|
|
target = work / (name + '.air')
|
|
subprocess.run(['xcrun', 'metal-opt', str(root / 'tools/kernels' / (name + '.ll')),
|
|
'-o', str(target)], check=True)
|
|
objects.append(str(target))
|
|
wrapper = work / 'DYGradeWrapper.air'
|
|
subprocess.run(['xcrun', '-sdk', 'macosx', 'metal', '-std=metal3.1',
|
|
'-mmacosx-version-min=14.6', '-c',
|
|
str(root / '大鱼调色/Plugin/DYGrade.metal'), '-o', str(wrapper)], check=True)
|
|
subprocess.run(['xcrun', '-sdk', 'macosx', 'metallib', str(wrapper), *objects,
|
|
'-o', str(args.output)], check=True)
|
|
print(args.output)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|