[skip test]
This commit is contained in:
alexey.lysiuk 2023-03-25 12:01:41 +02:00
parent fa9c5c8786
commit 910c442fd4

View file

@ -514,42 +514,69 @@ class SingleExeCTarget(MakeTarget):
class MesonTarget(BuildTarget): class MesonTarget(BuildTarget):
def __init__(self, name=None): def __init__(self, name=None):
super().__init__(name) super().__init__(name)
self.configure_prefix = True
def configure(self, state: BuildState): def configure(self, state: BuildState):
super().configure(state) super().configure(state)
cross_file_path = Path()
if not state.xcode:
cross_file_path = state.build_path / (state.architecture() + '.txt')
self._write_cross_file(cross_file_path, state)
args = [ args = [
state.bin_path / 'meson', 'setup',
f'--prefix={state.install_path}',
'--buildtype=release', '--buildtype=release',
'--default-library=static', '--default-library=static',
] ]
if self.configure_prefix:
args.append(f'--prefix={state.install_path}')
if state.xcode: if state.xcode:
args.append('--backend') args.append(f'--backend=xcode')
args.append('xcode')
else: else:
cross_file_path = state.build_path / (state.architecture() + '.txt')
self._write_cross_file(cross_file_path, state)
args.append(f'--cross-file={cross_file_path}') args.append(f'--cross-file={cross_file_path}')
args.append(state.build_path)
args.append(state.source) args.append(state.source)
subprocess.run(args, check=True, cwd=state.build_path, env=state.environment)
# subprocess.run(args, check=True, cwd=state.build_path, env=state.environment)
self._run_meson(args, state)
def build(self, state: BuildState): def build(self, state: BuildState):
args = ['ninja'] if state.xcode:
args = ('open', f'{self.name}.xcodeproj')
subprocess.run(args, check=True, cwd=state.build_path, env=state.environment)
# args = ['ninja']
#
# if state.verbose:
# args.append('--verbose')
#
# subprocess.run(args, check=True, cwd=state.build_path, env=state.environment)
args = [
'compile',
f'-C={state.build_path}',
]
if state.verbose: if state.verbose:
args.append('--verbose') args.append('--verbose')
subprocess.run(args, check=True, cwd=state.build_path, env=state.environment) self._run_meson(args, state)
def post_build(self, state: BuildState): def post_build(self, state: BuildState):
self.install(state, tool='ninja') if state.xcode:
return
# self.install(state, tool='ninja')
args = [
'install',
f'-C={state.build_path}'
]
if not self.configure_prefix:
args.append(f'--destdir={state.install_path}')
self._run_meson(args, state)
@staticmethod @staticmethod
def _write_cross_file(path: Path, state: BuildState): def _write_cross_file(path: Path, state: BuildState):
@ -578,3 +605,10 @@ cpu_family = '{cpu_family}'
cpu = '{cpu}' cpu = '{cpu}'
endian = 'little' endian = 'little'
''') ''')
@staticmethod
def _run_meson(_args: typing.Sequence[typing.Union[str, Path]], state: BuildState):
args = [state.bin_path / 'meson']
args.extend(_args)
subprocess.run(args, check=True, cwd=state.build_path, env=state.environment)