Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vala: Fix global arguments for valac #954

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions mesonbuild/backend/ninjabackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -1056,10 +1056,15 @@ def generate_vala_compile(self, target, outfile):
vala_c_src.append(vala_c_file)
valac_outputs.append(vala_c_file)

# TODO: Use self.generate_basic_compiler_args to get something more
# consistent Until then, we should be careful to preserve the
# precedence of arguments if it changes upstream.
args = []
args += self.build.get_global_args(valac)
args += self.build.get_project_args(valac, target.subproject)
args += valac.get_buildtype_args(self.get_option_for_target('buildtype', target))
args += self.build.get_project_args(valac, target.subproject)
args += self.build.get_global_args(valac)
args += self.environment.coredata.external_args[valac.get_language()]

# Tell Valac to output everything in our private directory. Sadly this
# means it will also preserve the directory components of Vala sources
# found inside the build tree (generated sources).
Expand Down
10 changes: 6 additions & 4 deletions mesonbuild/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,16 +792,18 @@ def log_var(var, val):
if hasattr(compiler, 'get_linker_exelist'):
compiler_is_linker = (compiler.get_exelist() == compiler.get_linker_exelist())

if lang not in ('c', 'cpp', 'objc', 'objcpp', 'fortran', 'd'):
return [], [], []

# Compile flags
cflags_mapping = {'c': 'CFLAGS',
'cpp': 'CXXFLAGS',
'objc': 'OBJCFLAGS',
'objcpp': 'OBJCXXFLAGS',
'fortran': 'FFLAGS',
'd': 'DFLAGS'}
'd': 'DFLAGS',
'vala': 'VALAFLAGS'}

if lang not in cflags_mapping.keys():
return [], [], []

compile_flags = os.environ.get(cflags_mapping[lang], '')
log_var(cflags_mapping[lang], compile_flags)
compile_flags = shlex.split(compile_flags)
Expand Down