aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r--mesonbuild/compilers/compilers.py106
-rw-r--r--mesonbuild/compilers/cpp.py2
-rw-r--r--mesonbuild/compilers/d.py12
-rw-r--r--mesonbuild/compilers/mixins/arm.py7
-rw-r--r--mesonbuild/compilers/mixins/clang.py7
-rw-r--r--mesonbuild/compilers/mixins/clike.py7
-rw-r--r--mesonbuild/compilers/mixins/elbrus.py6
-rw-r--r--mesonbuild/compilers/mixins/emscripten.py2
-rw-r--r--mesonbuild/compilers/mixins/gnu.py14
-rw-r--r--mesonbuild/compilers/mixins/intel.py5
-rw-r--r--mesonbuild/compilers/mixins/pgi.py3
-rw-r--r--mesonbuild/compilers/mixins/visualstudio.py2
-rw-r--r--mesonbuild/compilers/rust.py4
-rw-r--r--mesonbuild/compilers/vala.py4
14 files changed, 94 insertions, 87 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index 40bb9e6..234ce06 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -265,36 +265,32 @@ cuda_debug_args = {False: [],
clike_debug_args = {False: [],
True: ['-g']} # type: T.Dict[bool, T.List[str]]
-base_options = {'b_pch': coredata.UserBooleanOption('Use precompiled headers', True),
- 'b_lto': coredata.UserBooleanOption('Use link time optimization', False),
- 'b_sanitize': coredata.UserComboOption('Code sanitizer to use',
- ['none', 'address', 'thread', 'undefined', 'memory', 'address,undefined'],
- 'none'),
- 'b_lundef': coredata.UserBooleanOption('Use -Wl,--no-undefined when linking', True),
- 'b_asneeded': coredata.UserBooleanOption('Use -Wl,--as-needed when linking', True),
- 'b_pgo': coredata.UserComboOption('Use profile guided optimization',
- ['off', 'generate', 'use'],
- 'off'),
- 'b_coverage': coredata.UserBooleanOption('Enable coverage tracking.',
- False),
- 'b_colorout': coredata.UserComboOption('Use colored output',
- ['auto', 'always', 'never'],
- 'always'),
- 'b_ndebug': coredata.UserComboOption('Disable asserts',
- ['true', 'false', 'if-release'], 'false'),
- 'b_staticpic': coredata.UserBooleanOption('Build static libraries as position independent',
- True),
- 'b_pie': coredata.UserBooleanOption('Build executables as position independent',
- False),
- 'b_bitcode': coredata.UserBooleanOption('Generate and embed bitcode (only macOS/iOS/tvOS)',
- False),
- 'b_vscrt': coredata.UserComboOption('VS run-time library type to use.',
- ['none', 'md', 'mdd', 'mt', 'mtd', 'from_buildtype', 'static_from_buildtype'],
- 'from_buildtype'),
- } # type: OptionDictType
-
-def option_enabled(boptions: T.List[str], options: 'OptionDictType',
- option: str) -> bool:
+base_options: 'KeyedOptionDictType' = {
+ OptionKey('b_pch'): coredata.UserBooleanOption('Use precompiled headers', True),
+ OptionKey('b_lto'): coredata.UserBooleanOption('Use link time optimization', False),
+ OptionKey('b_sanitize'): coredata.UserComboOption('Code sanitizer to use',
+ ['none', 'address', 'thread', 'undefined', 'memory', 'address,undefined'],
+ 'none'),
+ OptionKey('b_lundef'): coredata.UserBooleanOption('Use -Wl,--no-undefined when linking', True),
+ OptionKey('b_asneeded'): coredata.UserBooleanOption('Use -Wl,--as-needed when linking', True),
+ OptionKey('b_pgo'): coredata.UserComboOption('Use profile guided optimization',
+ ['off', 'generate', 'use'],
+ 'off'),
+ OptionKey('b_coverage'): coredata.UserBooleanOption('Enable coverage tracking.', False),
+ OptionKey('b_colorout'): coredata.UserComboOption('Use colored output',
+ ['auto', 'always', 'never'],
+ 'always'),
+ OptionKey('b_ndebug'): coredata.UserComboOption('Disable asserts', ['true', 'false', 'if-release'], 'false'),
+ OptionKey('b_staticpic'): coredata.UserBooleanOption('Build static libraries as position independent', True),
+ OptionKey('b_pie'): coredata.UserBooleanOption('Build executables as position independent', False),
+ OptionKey('b_bitcode'): coredata.UserBooleanOption('Generate and embed bitcode (only macOS/iOS/tvOS)', False),
+ OptionKey('b_vscrt'): coredata.UserComboOption('VS run-time library type to use.',
+ ['none', 'md', 'mdd', 'mt', 'mtd', 'from_buildtype', 'static_from_buildtype'],
+ 'from_buildtype'),
+}
+
+def option_enabled(boptions: T.Set[OptionKey], options: 'KeyedOptionDictType',
+ option: OptionKey) -> bool:
try:
if option not in boptions:
return False
@@ -304,23 +300,23 @@ def option_enabled(boptions: T.List[str], options: 'OptionDictType',
except KeyError:
return False
-def get_base_compile_args(options: 'OptionDictType', compiler: 'Compiler') -> T.List[str]:
+def get_base_compile_args(options: 'KeyedOptionDictType', compiler: 'Compiler') -> T.List[str]:
args = [] # type T.List[str]
try:
- if options['b_lto'].value:
+ if options[OptionKey('b_lto')].value:
args.extend(compiler.get_lto_compile_args())
except KeyError:
pass
try:
- args += compiler.get_colorout_args(options['b_colorout'].value)
+ args += compiler.get_colorout_args(options[OptionKey('b_colorout')].value)
except KeyError:
pass
try:
- args += compiler.sanitizer_compile_args(options['b_sanitize'].value)
+ args += compiler.sanitizer_compile_args(options[OptionKey('b_sanitize')].value)
except KeyError:
pass
try:
- pgo_val = options['b_pgo'].value
+ pgo_val = options[OptionKey('b_pgo')].value
if pgo_val == 'generate':
args.extend(compiler.get_profile_generate_args())
elif pgo_val == 'use':
@@ -328,23 +324,23 @@ def get_base_compile_args(options: 'OptionDictType', compiler: 'Compiler') -> T.
except KeyError:
pass
try:
- if options['b_coverage'].value:
+ if options[OptionKey('b_coverage')].value:
args += compiler.get_coverage_args()
except KeyError:
pass
try:
- if (options['b_ndebug'].value == 'true' or
- (options['b_ndebug'].value == 'if-release' and
- options['buildtype'].value in {'release', 'plain'})):
+ if (options[OptionKey('b_ndebug')].value == 'true' or
+ (options[OptionKey('b_ndebug')].value == 'if-release' and
+ options[OptionKey('buildtype')].value in {'release', 'plain'})):
args += compiler.get_disable_assert_args()
except KeyError:
pass
# This does not need a try...except
- if option_enabled(compiler.base_options, options, 'b_bitcode'):
+ if option_enabled(compiler.base_options, options, OptionKey('b_bitcode')):
args.append('-fembed-bitcode')
try:
- crt_val = options['b_vscrt'].value
- buildtype = options['buildtype'].value
+ crt_val = options[OptionKey('b_vscrt')].value
+ buildtype = options[OptionKey('buildtype')].value
try:
args += compiler.get_crt_compile_args(crt_val, buildtype)
except AttributeError:
@@ -353,20 +349,20 @@ def get_base_compile_args(options: 'OptionDictType', compiler: 'Compiler') -> T.
pass
return args
-def get_base_link_args(options: 'OptionDictType', linker: 'Compiler',
+def get_base_link_args(options: 'KeyedOptionDictType', linker: 'Compiler',
is_shared_module: bool) -> T.List[str]:
args = [] # type: T.List[str]
try:
- if options['b_lto'].value:
+ if options[OptionKey('b_lto')].value:
args.extend(linker.get_lto_link_args())
except KeyError:
pass
try:
- args += linker.sanitizer_link_args(options['b_sanitize'].value)
+ args += linker.sanitizer_link_args(options[OptionKey('b_sanitize')].value)
except KeyError:
pass
try:
- pgo_val = options['b_pgo'].value
+ pgo_val = options[OptionKey('b_pgo')].value
if pgo_val == 'generate':
args.extend(linker.get_profile_generate_args())
elif pgo_val == 'use':
@@ -374,13 +370,13 @@ def get_base_link_args(options: 'OptionDictType', linker: 'Compiler',
except KeyError:
pass
try:
- if options['b_coverage'].value:
+ if options[OptionKey('b_coverage')].value:
args += linker.get_coverage_link_args()
except KeyError:
pass
- as_needed = option_enabled(linker.base_options, options, 'b_asneeded')
- bitcode = option_enabled(linker.base_options, options, 'b_bitcode')
+ as_needed = option_enabled(linker.base_options, options, OptionKey('b_asneeded'))
+ bitcode = option_enabled(linker.base_options, options, OptionKey('b_bitcode'))
# Shared modules cannot be built with bitcode_bundle because
# -bitcode_bundle is incompatible with -undefined and -bundle
if bitcode and not is_shared_module:
@@ -394,14 +390,14 @@ def get_base_link_args(options: 'OptionDictType', linker: 'Compiler',
if not bitcode:
args.extend(linker.headerpad_args())
if (not is_shared_module and
- option_enabled(linker.base_options, options, 'b_lundef')):
+ option_enabled(linker.base_options, options, OptionKey('b_lundef'))):
args.extend(linker.no_undefined_link_args())
else:
args.extend(linker.get_allow_undefined_link_args())
try:
- crt_val = options['b_vscrt'].value
- buildtype = options['buildtype'].value
+ crt_val = options[OptionKey('b_vscrt')].value
+ buildtype = options[OptionKey('buildtype')].value
try:
args += linker.get_crt_link_args(crt_val, buildtype)
except AttributeError:
@@ -477,7 +473,7 @@ class Compiler(metaclass=abc.ABCMeta):
self.version = version
self.full_version = full_version
self.for_machine = for_machine
- self.base_options = [] # type: T.List[str]
+ self.base_options: T.Set[OptionKey] = set()
self.linker = linker
self.info = info
self.is_cross = is_cross
@@ -1248,14 +1244,14 @@ def get_global_options(lang: str,
description = 'Extra arguments passed to the {}'.format(lang)
argkey = OptionKey('args', lang=lang, machine=for_machine)
largkey = argkey.evolve('link_args')
- opts = {
+ opts: 'KeyedOptionDictType' = {
argkey: coredata.UserArrayOption(
description + ' compiler',
[], split_args=True, user_input=True, allow_dups=True),
largkey: coredata.UserArrayOption(
description + ' linker',
[], split_args=True, user_input=True, allow_dups=True),
- } # type: OptionDictType
+ }
# Get from env vars.
compile_args, link_args = get_args_from_envvars(
diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py
index b94beb6..2e94e48 100644
--- a/mesonbuild/compilers/cpp.py
+++ b/mesonbuild/compilers/cpp.py
@@ -664,7 +664,7 @@ class VisualStudioCPPCompiler(CPP11AsCPP14Mixin, VisualStudioLikeCPPCompilerMixi
CPPCompiler.__init__(self, exelist, version, for_machine, is_cross,
info, exe_wrapper, linker=linker, full_version=full_version)
MSVCCompiler.__init__(self, target)
- self.base_options = ['b_pch', 'b_vscrt', 'b_ndebug'] # FIXME add lto, pgo and the like
+ self.base_options = {OptionKey(o) for o in ['b_pch', 'b_vscrt', 'b_ndebug']} # FIXME add lto, pgo and the like
self.id = 'msvc'
def get_options(self) -> 'KeyedOptionDictType':
diff --git a/mesonbuild/compilers/d.py b/mesonbuild/compilers/d.py
index ca6de38..eac2aa7 100644
--- a/mesonbuild/compilers/d.py
+++ b/mesonbuild/compilers/d.py
@@ -18,7 +18,7 @@ import subprocess
import typing as T
from ..mesonlib import (
- EnvironmentException, MachineChoice, version_compare,
+ EnvironmentException, MachineChoice, version_compare, OptionKey,
)
from ..arglist import CompilerArgs
@@ -653,8 +653,10 @@ class GnuDCompiler(GnuCompiler, DCompiler):
'1': default_warn_args,
'2': default_warn_args + ['-Wextra'],
'3': default_warn_args + ['-Wextra', '-Wpedantic']}
- self.base_options = ['b_colorout', 'b_sanitize', 'b_staticpic',
- 'b_vscrt', 'b_coverage', 'b_pgo', 'b_ndebug']
+ self.base_options = {
+ OptionKey(o) for o in [
+ 'b_colorout', 'b_sanitize', 'b_staticpic', 'b_vscrt',
+ 'b_coverage', 'b_pgo', 'b_ndebug']}
self._has_color_support = version_compare(self.version, '>=4.9')
# dependencies were implemented before, but broken - support was fixed in GCC 7.1+
@@ -724,7 +726,7 @@ class LLVMDCompiler(DmdLikeCompilerMixin, DCompiler):
full_version=full_version, is_cross=is_cross)
DmdLikeCompilerMixin.__init__(self, dmd_frontend_version=find_ldc_dmd_frontend_version(version_output))
self.id = 'llvm'
- self.base_options = ['b_coverage', 'b_colorout', 'b_vscrt', 'b_ndebug']
+ self.base_options = {OptionKey(o) for o in ['b_coverage', 'b_colorout', 'b_vscrt', 'b_ndebug']}
def get_colorout_args(self, colortype: str) -> T.List[str]:
if colortype == 'always':
@@ -782,7 +784,7 @@ class DmdDCompiler(DmdLikeCompilerMixin, DCompiler):
full_version=full_version, is_cross=is_cross)
DmdLikeCompilerMixin.__init__(self, version)
self.id = 'dmd'
- self.base_options = ['b_coverage', 'b_colorout', 'b_vscrt', 'b_ndebug']
+ self.base_options = {OptionKey(o) for o in ['b_coverage', 'b_colorout', 'b_vscrt', 'b_ndebug']}
def get_colorout_args(self, colortype: str) -> T.List[str]:
if colortype == 'always':
diff --git a/mesonbuild/compilers/mixins/arm.py b/mesonbuild/compilers/mixins/arm.py
index ee7d337..beb5fd5 100644
--- a/mesonbuild/compilers/mixins/arm.py
+++ b/mesonbuild/compilers/mixins/arm.py
@@ -19,6 +19,7 @@ import typing as T
from ... import mesonlib
from ...linkers import ArmClangDynamicLinker
+from ...mesonlib import OptionKey
from ..compilers import clike_debug_args
from .clang import clang_color_args
@@ -145,8 +146,10 @@ class ArmclangCompiler(Compiler):
if not mesonlib.version_compare(self.version, '==' + self.linker.version):
raise mesonlib.EnvironmentException('armlink version does not match with compiler version')
self.id = 'armclang'
- self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize', 'b_coverage',
- 'b_ndebug', 'b_staticpic', 'b_colorout']
+ self.base_options = {
+ OptionKey(o) for o in
+ ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize', 'b_coverage',
+ 'b_ndebug', 'b_staticpic', 'b_colorout']}
# Assembly
self.can_compile_suffixes.add('s')
diff --git a/mesonbuild/compilers/mixins/clang.py b/mesonbuild/compilers/mixins/clang.py
index 2e50577..fcb2225 100644
--- a/mesonbuild/compilers/mixins/clang.py
+++ b/mesonbuild/compilers/mixins/clang.py
@@ -20,6 +20,7 @@ import typing as T
from ... import mesonlib
from ...linkers import AppleDynamicLinker
+from ...mesonlib import OptionKey
from ..compilers import CompileCheckMode
from .gnu import GnuLikeCompiler
@@ -48,11 +49,11 @@ class ClangCompiler(GnuLikeCompiler):
super().__init__()
self.id = 'clang'
self.defines = defines or {}
- self.base_options.append('b_colorout')
+ self.base_options.add(OptionKey('b_colorout'))
# TODO: this really should be part of the linker base_options, but
# linkers don't have base_options.
if isinstance(self.linker, AppleDynamicLinker):
- self.base_options.append('b_bitcode')
+ self.base_options.add(OptionKey('b_bitcode'))
# All Clang backends can also do LLVM IR
self.can_compile_suffixes.add('ll')
@@ -108,7 +109,7 @@ class ClangCompiler(GnuLikeCompiler):
else:
# Shouldn't work, but it'll be checked explicitly in the OpenMP dependency.
return []
-
+
@classmethod
def use_linker_args(cls, linker: str) -> T.List[str]:
# Clang additionally can use a linker specified as a path, which GCC
diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py
index dca09ea..0f30f55 100644
--- a/mesonbuild/compilers/mixins/clike.py
+++ b/mesonbuild/compilers/mixins/clike.py
@@ -35,6 +35,7 @@ from ... import mesonlib
from ... import mlog
from ...linkers import GnuLikeDynamicLinkerMixin, SolarisDynamicLinker, CompCertDynamicLinker
from ...mesonlib import LibType
+from ...coredata import OptionKey
from .. import compilers
from ..compilers import CompileCheckMode
from .visualstudio import VisualStudioLikeCompiler
@@ -393,14 +394,16 @@ class CLikeCompiler(Compiler):
# linking with static libraries since MSVC won't select a CRT for
# us in that case and will error out asking us to pick one.
try:
- crt_val = env.coredata.base_options['b_vscrt'].value
- buildtype = env.coredata.builtins['buildtype'].value
+ crt_val = env.coredata.base_options[OptionKey('b_vscrt')].value
+ buildtype = env.coredata.builtins[OptionKey('buildtype')].value
cargs += self.get_crt_compile_args(crt_val, buildtype)
except (KeyError, AttributeError):
pass
# Add CFLAGS/CXXFLAGS/OBJCFLAGS/OBJCXXFLAGS and CPPFLAGS from the env
sys_args = env.coredata.get_external_args(self.for_machine, self.language)
+ if isinstance(sys_args, str):
+ sys_args = [sys_args]
# Apparently it is a thing to inject linker flags both
# via CFLAGS _and_ LDFLAGS, even though the former are
# also used during linking. These flags can break
diff --git a/mesonbuild/compilers/mixins/elbrus.py b/mesonbuild/compilers/mixins/elbrus.py
index 2ea3599..16f6210 100644
--- a/mesonbuild/compilers/mixins/elbrus.py
+++ b/mesonbuild/compilers/mixins/elbrus.py
@@ -21,7 +21,7 @@ import re
from .gnu import GnuLikeCompiler
from .gnu import gnu_optimization_args
-from ...mesonlib import Popen_safe
+from ...mesonlib import Popen_safe, OptionKey
if T.TYPE_CHECKING:
from ...environment import Environment
@@ -34,9 +34,7 @@ class ElbrusCompiler(GnuLikeCompiler):
def __init__(self) -> None:
super().__init__()
self.id = 'lcc'
- self.base_options = ['b_pgo', 'b_coverage',
- 'b_ndebug', 'b_staticpic',
- 'b_lundef', 'b_asneeded']
+ self.base_options = {OptionKey(o) for o in ['b_pgo', 'b_coverage', 'b_ndebug', 'b_staticpic', 'b_lundef', 'b_asneeded']}
# FIXME: use _build_wrapper to call this so that linker flags from the env
# get applied
diff --git a/mesonbuild/compilers/mixins/emscripten.py b/mesonbuild/compilers/mixins/emscripten.py
index b480de3..537ae92 100644
--- a/mesonbuild/compilers/mixins/emscripten.py
+++ b/mesonbuild/compilers/mixins/emscripten.py
@@ -51,7 +51,7 @@ class EmscriptenMixin(Compiler):
def thread_link_flags(self, env: 'Environment') -> T.List[str]:
args = ['-s', 'USE_PTHREADS=1']
- count: int = env.coredata.compiler_options[OptionKey('thread_count', lang=self.language, machine=self.for_machine)].value # type: ignore
+ count: int = env.coredata.compiler_options[OptionKey('thread_count', lang=self.language, machine=self.for_machine)].value
if count:
args.extend(['-s', 'PTHREAD_POOL_SIZE={}'.format(count)])
return args
diff --git a/mesonbuild/compilers/mixins/gnu.py b/mesonbuild/compilers/mixins/gnu.py
index 3d43162..95bcd7c 100644
--- a/mesonbuild/compilers/mixins/gnu.py
+++ b/mesonbuild/compilers/mixins/gnu.py
@@ -24,6 +24,7 @@ import typing as T
from ... import mesonlib
from ... import mlog
+from ...mesonlib import OptionKey
if T.TYPE_CHECKING:
from ...environment import Environment
@@ -146,14 +147,15 @@ class GnuLikeCompiler(Compiler, metaclass=abc.ABCMeta):
LINKER_PREFIX = '-Wl,'
def __init__(self) -> None:
- self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_coverage',
- 'b_ndebug', 'b_staticpic', 'b_pie']
+ self.base_options = {
+ OptionKey(o) for o in ['b_pch', 'b_lto', 'b_pgo', 'b_coverage',
+ 'b_ndebug', 'b_staticpic', 'b_pie']}
if not (self.info.is_windows() or self.info.is_cygwin() or self.info.is_openbsd()):
- self.base_options.append('b_lundef')
+ self.base_options.add(OptionKey('b_lundef'))
if not self.info.is_windows() or self.info.is_cygwin():
- self.base_options.append('b_asneeded')
+ self.base_options.add(OptionKey('b_asneeded'))
if not self.info.is_hurd():
- self.base_options.append('b_sanitize')
+ self.base_options.add(OptionKey('b_sanitize'))
# All GCC-like backends can do assembly
self.can_compile_suffixes.add('s')
@@ -328,7 +330,7 @@ class GnuCompiler(GnuLikeCompiler):
super().__init__()
self.id = 'gcc'
self.defines = defines or {}
- self.base_options.append('b_colorout')
+ self.base_options.add(OptionKey('b_colorout'))
def get_colorout_args(self, colortype: str) -> T.List[str]:
if mesonlib.version_compare(self.version, '>=4.9.0'):
diff --git a/mesonbuild/compilers/mixins/intel.py b/mesonbuild/compilers/mixins/intel.py
index 442e8c7..5bca254 100644
--- a/mesonbuild/compilers/mixins/intel.py
+++ b/mesonbuild/compilers/mixins/intel.py
@@ -79,8 +79,9 @@ class IntelGnuLikeCompiler(GnuLikeCompiler):
# It does have IPO, which serves much the same purpose as LOT, but
# there is an unfortunate rule for using IPO (you can't control the
# name of the output file) which break assumptions meson makes
- self.base_options = ['b_pch', 'b_lundef', 'b_asneeded', 'b_pgo',
- 'b_coverage', 'b_ndebug', 'b_staticpic', 'b_pie']
+ self.base_options = {mesonlib.OptionKey(o) for o in [
+ 'b_pch', 'b_lundef', 'b_asneeded', 'b_pgo', 'b_coverage',
+ 'b_ndebug', 'b_staticpic', 'b_pie']}
self.id = 'intel'
self.lang_header = 'none'
diff --git a/mesonbuild/compilers/mixins/pgi.py b/mesonbuild/compilers/mixins/pgi.py
index 61dee8d..8461574 100644
--- a/mesonbuild/compilers/mixins/pgi.py
+++ b/mesonbuild/compilers/mixins/pgi.py
@@ -19,6 +19,7 @@ import os
from pathlib import Path
from ..compilers import clike_debug_args, clike_optimization_args
+from ...mesonlib import OptionKey
if T.TYPE_CHECKING:
from ...environment import Environment
@@ -43,7 +44,7 @@ pgi_buildtype_args = {
class PGICompiler(Compiler):
def __init__(self) -> None:
- self.base_options = ['b_pch']
+ self.base_options = {OptionKey('b_pch')}
self.id = 'pgi'
default_warn_args = ['-Minform=inform']
diff --git a/mesonbuild/compilers/mixins/visualstudio.py b/mesonbuild/compilers/mixins/visualstudio.py
index c38d59a..92f4fcd 100644
--- a/mesonbuild/compilers/mixins/visualstudio.py
+++ b/mesonbuild/compilers/mixins/visualstudio.py
@@ -129,7 +129,7 @@ class VisualStudioLikeCompiler(Compiler, metaclass=abc.ABCMeta):
INVOKES_LINKER = False
def __init__(self, target: str):
- self.base_options = ['b_pch', 'b_ndebug', 'b_vscrt'] # FIXME add lto, pgo and the like
+ self.base_options = {mesonlib.OptionKey(o) for o in ['b_pch', 'b_ndebug', 'b_vscrt']} # FIXME add lto, pgo and the like
self.target = target
self.is_64 = ('x64' in target) or ('x86_64' in target)
# do some canonicalization of target machine
diff --git a/mesonbuild/compilers/rust.py b/mesonbuild/compilers/rust.py
index 8a1acc7..fd58819 100644
--- a/mesonbuild/compilers/rust.py
+++ b/mesonbuild/compilers/rust.py
@@ -55,9 +55,9 @@ class RustCompiler(Compiler):
linker=linker)
self.exe_wrapper = exe_wrapper
self.id = 'rustc'
- self.base_options.append('b_colorout')
+ self.base_options.add(OptionKey('b_colorout'))
if 'link' in self.linker.id:
- self.base_options.append('b_vscrt')
+ self.base_options.add(OptionKey('b_vscrt'))
def needs_static_linker(self) -> bool:
return False
diff --git a/mesonbuild/compilers/vala.py b/mesonbuild/compilers/vala.py
index 14971d4..80e91f6 100644
--- a/mesonbuild/compilers/vala.py
+++ b/mesonbuild/compilers/vala.py
@@ -16,7 +16,7 @@ import os.path
import typing as T
from .. import mlog
-from ..mesonlib import EnvironmentException, MachineChoice, version_compare
+from ..mesonlib import EnvironmentException, MachineChoice, version_compare, OptionKey
from .compilers import Compiler, LibType
@@ -33,7 +33,7 @@ class ValaCompiler(Compiler):
super().__init__(exelist, version, for_machine, info, is_cross=is_cross)
self.version = version
self.id = 'valac'
- self.base_options = ['b_colorout']
+ self.base_options = {OptionKey('b_colorout')}
def needs_static_linker(self) -> bool:
return False # Because compiles into C.