aedi: update flags environment variable with one call

This commit is contained in:
alexey.lysiuk 2022-12-30 12:55:36 +02:00
parent 6d0e5e6c75
commit 5f7fb2bfb3
2 changed files with 7 additions and 17 deletions

View file

@ -212,15 +212,13 @@ class BuildState:
return (self.source / path).exists() return (self.source / path).exists()
def update_environment(self, name: str, value: str): def update_environment(self, name: str, value: str):
env = self.environment
env[name] = env[name] + ' ' + value if name in env else value
def set_sdk(self, var_name: str):
sdk_path = self.sdk_path() sdk_path = self.sdk_path()
if sdk_path: if sdk_path:
self.update_environment(var_name, f'-isysroot {sdk_path}') value += f' -isysroot {sdk_path}'
def set_os_version(self, var_name: str):
os_version = self.os_version() os_version = self.os_version()
if os_version: if os_version:
self.update_environment(var_name, f'-mmacosx-version-min={os_version}') value += f' -mmacosx-version-min={os_version}'
env = self.environment
env[name] = env[name] + ' ' + value if name in env else value

View file

@ -115,17 +115,9 @@ class BuildTarget(Target):
env['CXX'] = str(cxx_compiler) env['CXX'] = str(cxx_compiler)
for prefix in ('AR', 'C', 'CPP', 'CXX', 'OBJC', 'OBJCXX'): for prefix in ('AR', 'C', 'CPP', 'CXX', 'OBJC', 'OBJCXX'):
var_name = f'{prefix}FLAGS' state.update_environment(f'{prefix}FLAGS', f'-I{state.include_path}')
state.update_environment(var_name, f'-I{state.include_path}') state.update_environment('LDFLAGS', f'-L{state.lib_path}')
state.set_sdk(var_name)
state.set_os_version(var_name)
ldflags = 'LDFLAGS'
state.update_environment(ldflags, f'-L{state.lib_path}')
state.set_sdk(ldflags)
state.set_os_version(ldflags)
def install(self, state: BuildState, options: CommandLineOptions = None, tool: str = 'gmake'): def install(self, state: BuildState, options: CommandLineOptions = None, tool: str = 'gmake'):
if state.xcode: if state.xcode: