aedi: ability to avoid prefix addition to search paths

prefix directory may not be added to search path via -I ... and -L ... command line options
this helps to upgrade dependencies, so they won't use old header or library files
This commit is contained in:
alexey.lysiuk 2021-03-30 15:11:18 +03:00
parent f2ba924a14
commit 36da3fe963

View file

@ -66,6 +66,7 @@ class BuildTarget(Target):
self.environment = os.environ.copy()
self.options = CommandLineOptions()
self.multi_platform = True
self.search_prefix = True
def configure(self, state: BuildState):
os.makedirs(state.build_path, exist_ok=True)
@ -75,21 +76,28 @@ class BuildTarget(Target):
+ os.pathsep + '/Applications/CMake.app/Contents/bin' \
+ os.pathsep + state.bin_path
if not state.xcode:
env['CC'] = state.c_compiler()
env['CXX'] = state.cxx_compiler()
if state.xcode:
return
for prefix in ('CPP', 'C', 'CXX', 'OBJC', 'OBJCXX'):
varname = f'{prefix}FLAGS'
env['CC'] = state.c_compiler()
env['CXX'] = state.cxx_compiler()
for prefix in ('CPP', 'C', 'CXX', 'OBJC', 'OBJCXX'):
varname = f'{prefix}FLAGS'
if self.search_prefix:
self._update_env(varname, f'-I{state.include_path}')
self._set_sdk(state, varname)
self._set_os_version(state, varname)
ldflags = 'LDFLAGS'
self._set_sdk(state, varname)
self._set_os_version(state, varname)
ldflags = 'LDFLAGS'
if self.search_prefix:
self._update_env(ldflags, f'-L{state.lib_path}')
self._set_sdk(state, ldflags)
self._set_os_version(state, ldflags)
self._set_sdk(state, ldflags)
self._set_os_version(state, ldflags)
def _update_env(self, name: str, value: str):
env = self.environment