diff --git a/src/c4/cmany/architecture.py b/src/c4/cmany/architecture.py index 004bfd0..cce6d8a 100644 --- a/src/c4/cmany/architecture.py +++ b/src/c4/cmany/architecture.py @@ -10,13 +10,13 @@ class Architecture(BuildItem): """Specifies a processor architecture""" @staticmethod - def default(): + def default(toolchain_file: str=None): """return the architecture of the current machine""" - return Architecture(__class__.default_str()) + return Architecture(__class__.default_str(toolchain_file)) @staticmethod - def default_str(): - s = CMakeSysInfo.architecture() + def default_str(toolchain_file: str=None): + s = CMakeSysInfo.architecture(toolchain=toolchain_file) if s == "amd64": s = "x86_64" return s diff --git a/src/c4/cmany/args.py b/src/c4/cmany/args.py index d4c7546..c0c8c12 100644 --- a/src/c4/cmany/args.py +++ b/src/c4/cmany/args.py @@ -254,47 +254,31 @@ def add_select(parser): given either as a comma-separated list or with repeated invokations of their arguments. Commas can be escaped by using a backslash, \\.""") - # - dft = [system.System.default_str()] g.add_argument("-s", "--systems", metavar="os1,os2,...", - default=dft, action=BuildItemArgument, + action=BuildItemArgument, help="""Specify a comma-separated list of operating systems - to combine. Defaults to the current system, """ + - _item_printer(dft) + """.""") - # - dft = [architecture.Architecture.default_str()] + to combine. Defaults to the current system.""") g.add_argument("-a", "--architectures", metavar="arch1,arch2,...", - default=dft, action=BuildItemArgument, + action=BuildItemArgument, help="""Specify a comma-separated list of processor architectures to combine. Defaults to CMake's default - architecture on this system, """ + - _item_printer(dft) + """.""") - # - dft = [compiler.Compiler.default_str()] + architecture on this system.""") g.add_argument("-c", "--compilers", metavar="compiler1,compiler2,...", - default=dft, action=BuildItemArgument, + action=BuildItemArgument, help="""Specify a comma-separated list of compilers to combine. Compilers can be given as an absolute path, or as a name, in which case that name will be searched for in the current shell's PATH. Defaults to CMake's default - compiler on this system, """ + - _item_printer(dft) + """.""") - # - # dft = [build_type.BuildType.default_str()] # avoid a circular dependency - dft = ["Release"] + compiler on this system.""") g.add_argument("-t", "--build-types", metavar="type1,type2,...", - default=dft, action=BuildItemArgument, + action=BuildItemArgument, help="""Specify a comma-separated list of build types - to combine. Defaults to """ + _item_printer(dft) + """.""") - # - # dft = [variant.Variant.default_str()] # avoid a circular dependency - dft = ["none"] + to combine.""") g.add_argument("-v", "--variants", metavar="variant1,variant2,...", - default=["none"], action=BuildItemArgument, + action=BuildItemArgument, help="""Specify a comma-separated list of variants to combine. The variant name 'none' is special and will be - omitted from the name of the resulting build. Defaults to - """ + _item_printer(dft) + """.""") + omitted from the name of the resulting build. Defaults to none.""") #add_combination_flags(parser) diff --git a/src/c4/cmany/build.py b/src/c4/cmany/build.py index 516eec1..2c2e75e 100644 --- a/src/c4/cmany/build.py +++ b/src/c4/cmany/build.py @@ -63,16 +63,7 @@ def __init__(self, proj_root, build_root, install_root, super().__init__(tag) # self.toolchain_file = self._get_toolchain() - if self.toolchain_file: - comps = cmake.extract_toolchain_compilers(self.toolchain_file) - if comps.get('CMAKE_CXX_COMPILER'): - c = Compiler(comps['CMAKE_CXX_COMPILER']) - else: - c = Compiler(os.environ.get('CXX')) - dbg(f"CMAKE_CXX_COMPILER not found, trying environment var CXX:", c) - self.adjust(compiler=c) - # - # WATCHOUT: this may trigger a readjustment of this build's parameters + # WATCHOUT: this may trigger a readjustment of the build's parameters self.generator = self.create_generator(num_jobs) # # This will load the vars from the builddir cache, if it exists. @@ -117,7 +108,7 @@ def _set_name_and_paths(self): self.installdir = os.path.join(self.installroot, self.installtag) self.preload_file = os.path.join(self.builddir, Build.pfile) self.cachefile = os.path.join(self.builddir, 'CMakeCache.txt') - for prop in "projdir buildroot installroot buildtag installtag builddir installdir preload_file cachefile".split(" "): + for prop in "system architecture compiler build_type variant projdir buildroot installroot buildtag installtag builddir installdir preload_file cachefile".split(" "): dbg(" {}: {}={}".format(self.tag, prop, getattr(self, prop))) return self.tag @@ -138,7 +129,7 @@ def create_generator(self, num_jobs, fallback_generator="Unix Makefiles"): if self.system.name == "windows": return Generator(fallback_generator, self, num_jobs) else: - return Generator(Generator.default_str(), self, num_jobs) + return Generator(Generator.default_str(self.toolchain_file), self, num_jobs) def adjust(self, **kwargs): for k, _ in kwargs.items(): @@ -466,9 +457,11 @@ def _get_toolchain(self): tc = BuildFlags.merge_toolchains(tc, fs.toolchain) if not tc: return None + dbg("toolchain:", tc) if not os.path.isabs(tc): tc = os.path.join(os.getcwd(), tc) tc = os.path.abspath(tc) + dbg("toolchain:", tc) if not os.path.exists(tc): raise err.ToolchainFileNotFound(tc, self) return tc diff --git a/src/c4/cmany/build_flags.py b/src/c4/cmany/build_flags.py index f9cb695..5ba152c 100644 --- a/src/c4/cmany/build_flags.py +++ b/src/c4/cmany/build_flags.py @@ -1,6 +1,7 @@ from .named_item import NamedItem as NamedItem from . import util +from .util import logdbg as dbg from . import err @@ -59,9 +60,11 @@ def log(self, log_fn=print, msg=""): @staticmethod def merge_toolchains(tc1, tc2): - if ((tc1 != tc2) and (tc1 is not None and tc2 is not None)): + dbg("merge_toolchains:", tc1, tc2) + if ((tc1 != tc2) and ((tc1 is not None) and (tc2 is not None))): raise err.Error("conflicting toolchains: {} vs {}", tc1, tc2) if tc1 is None and tc2 is not None: + dbg("picking toolchain:", tc2) tc1 = tc2 return tc1 diff --git a/src/c4/cmany/build_item.py b/src/c4/cmany/build_item.py index 6c49c3d..c78cc85 100644 --- a/src/c4/cmany/build_item.py +++ b/src/c4/cmany/build_item.py @@ -8,25 +8,40 @@ from .combination_rules import CombinationRules -# some of parsing functions below are difficult; this is a debugging scaffold +# some of the parsing functions below are difficult; this is a +# debugging scaffold _dbg_parse = False def _dbg(fmt, *args): if not _dbg_parse: return print(fmt.format(*args)) +def dbg(fmt, *args, **kwargs): + util.logdbg(fmt.format(*args, **kwargs)) + + # ----------------------------------------------------------------------------- class BuildItem(NamedItem): """A base class for build items.""" @staticmethod - def create(map_of_class_name_to_tuple_of_class_and_specs): + def create_build_items(names_and_classes, **kwargs): items = BuildItemCollection() - for cls_name, (cls, spec_list) in map_of_class_name_to_tuple_of_class_and_specs.items(): - if isinstance(spec_list, str): - spec_list = util.splitesc_quoted(spec_list, ',') - for s in spec_list: - items.add_build_item(cls(s)) + for name, cls in names_and_classes.items(): + spec_list = kwargs.get(name) + if spec_list is None: + item = cls.default(kwargs.get('toolchain')) + dbg('{}: none given; picking default {}: {}', name, cls.__name__, item) + items.add_build_item(item) + else: + if isinstance(spec_list, str): + splitted = util.splitesc_quoted(spec_list, ',') + dbg('{}: str given; splitting: {} -> {}', name, spec_list, splitted) + spec_list = splitted + for s in spec_list: + dbg('{}: adding {}', name, s) + item = cls(s) + items.add_build_item(item) items.resolve_references() return items @@ -177,7 +192,7 @@ def parse_args(v_): if rest: vli.append(rest) _dbg("parse_args 3.2.3: rest={} vli={}", rest, vli) - if _dbg_parse: print("parse_args 4: vli=", vli) + _dbg("parse_args 4: vli=", vli) # unquote split elements vli = [util.unquote(v).strip(',') for v in vli] _dbg("parse_args 5: input=____{}____ output=__{}__", v_, vli) @@ -240,7 +255,7 @@ def __init__(self, *args, **kwargs): def __eq__(self, other): """code quality checkers complain that this class adds attributes without overriding __eq__. So just fool them!""" - return super().__init__(other) + return super().__eq__(other) def add_build_item(self, item): # convert the class name to snake case and append s for plural diff --git a/src/c4/cmany/cmake.py b/src/c4/cmany/cmake.py index 7c0a26b..1e38d35 100644 --- a/src/c4/cmany/cmake.py +++ b/src/c4/cmany/cmake.py @@ -111,7 +111,7 @@ def __init__(self, builddir=None): def __eq__(self, other): """code quality checkers complain that this class adds attributes without overriding __eq__. So just fool them!""" - return super().__init__(other) + return super().__eq__(other) def getvars(self, names): out = odict() @@ -247,41 +247,43 @@ class CMakeSysInfo: generator, etc.""" @staticmethod - def generator(): + def generator(toolchain=None): return cacheattr(__class__, '_generator_default', - lambda: __class__._getstr('CMAKE_GENERATOR', 'default')) + lambda: __class__._getstr('CMAKE_GENERATOR', 'default', toolchain)) @staticmethod - def system_name(which_generator="default"): - return __class__.var('CMAKE_SYSTEM_NAME', which_generator, lambda v: v.lower()) + def system_name(generator="default", toolchain=None): + return __class__.var('CMAKE_SYSTEM_NAME', generator, toolchain, + lambda v: v.lower()) @staticmethod - def architecture(which_generator="default"): - return __class__.var('CMAKE_SYSTEM_PROCESSOR', which_generator, lambda v: v.lower()) + def architecture(generator="default", toolchain=None): + return __class__.var('CMAKE_SYSTEM_PROCESSOR', generator, toolchain, + lambda v: v.lower()) @staticmethod - def cxx_compiler(which_generator="default"): - return __class__.var('CMAKE_CXX_COMPILER', which_generator) + def cxx_compiler(generator="default", toolchain=None): + return __class__.var('CMAKE_CXX_COMPILER', generator, toolchain) @staticmethod - def c_compiler(which_generator="default"): - return __class__.var('CMAKE_C_COMPILER', which_generator) + def c_compiler(generator="default", toolchain=None): + return __class__.var('CMAKE_C_COMPILER', generator, toolchain) @staticmethod - def var(var_name, which_generator="default", transform_fn=lambda x: x): - gs = __class__._getstr - return cacheattr(__class__, '_{}_{}'.format(var_name, _genid(which_generator)), - lambda: transform_fn(gs(var_name, which_generator))) + def var(var_name, generator="default", toolchain=None, transform_fn=lambda x: x): + attrname = '_{}_{}'.format(var_name, _gentc_id(generator, toolchain)) + return cacheattr(__class__, attrname, + lambda: transform_fn(__class__._getstr(var_name, generator, toolchain))) @staticmethod - def info(which_generator="default"): - return cacheattr(__class__, '_info_' + _genid(which_generator), - lambda: __class__.system_info(which_generator)) + def info(generator="default", toolchain=None): + return cacheattr(__class__, '_info_' + _gentc_id(generator, toolchain), + lambda: __class__.system_info(generator, toolchain)) @staticmethod - def _getstr(var_name, which_generator): + def _getstr(var_name, generator, toolchain): regex = r'^{} "(.*)"'.format(var_name) - for l in __class__.info(which_generator): + for l in __class__.info(generator, toolchain): #dbg(l.strip("\n"), l.startswith(var_name), var_name) if l.startswith(var_name): l = l.strip("\n").lstrip(" ").rstrip(" ") @@ -290,64 +292,78 @@ def _getstr(var_name, which_generator): s = re.sub(regex, r'\1', l) #dbg(var_name, "result: '" + s + "'") return s - #dbg("--------------------------------------\n", __class__.info(which_generator)) - msg = "could not find variable {} in the output of `cmake --system-information -G '{}'`" - raise err.Error(msg, var_name, which_generator) + #dbg("--------------------------------------\n", __class__.info(generator)) + raise err.Error("could not find variable {} in the output of `cmake --system-information -G '{}'`", + var_name, generator) @staticmethod - def system_info(gen): + def system_info(gen, toolchain_file=None): """gen can be a string or a cmany.Generator object""" - from .generator import Generator - dbg("CMakeSystemInfo: asked info for", gen) - p = _genid(gen) - d = os.path.join(USER_DIR, 'cmake_info', p) - p = os.path.join(d, 'info') + dbg("CMakeSystemInfo: asked info for", gen, + (("toolchain="+toolchain_file) if toolchain_file is not None else "")) + toolchain_args = [] + if toolchain_file is not None: + if not os.path.exists(toolchain_file): + raise err.ToolchainFileNotFound(toolchain_file) + toolchain_args = ['--toolchain', toolchain_file] + d = _geninfodir(gen, toolchain_file) + p = os.path.join(d, 'cmake_system_information') + dbg("CMakeSystemInfo: dir=", d) dbg("CMakeSystemInfo: path=", p) - # https://stackoverflow.com/questions/7015587/python-difference-of-2-datetimes-in-months - if os.path.exists(p) and util.time_since_modification(p).months < 1: - dbg("CMakeSystemInfo: asked info for", gen, "... found", p) - with open(p, "r") as f: - i = f.readlines() - if i: - return i - else: - dbg("CMakeSystemInfo: info for gen", gen, "is empty...") - # - if isinstance(gen, Generator): - cmd = ['cmake'] + gen.configure_args() + ['--system-information'] - dbg("CMakeSystemInfo: from generator! '{}' ---> cmd={}".format(gen, cmd)) - else: + if os.path.exists(p): + dbg('CMakeSystemInfo: found at', p) + if util.time_since_modification(p).months >= 1: + dbg("CMakeSystemInfo: older than 1 month. Refreshing", p) + else: + dbg("CMakeSystemInfo: less than 1 month. Choosing", p) + return _getnfo(p) + gen_args = [] + if isinstance(gen, str): if gen == "default" or gen == "": dbg("CMakeSystemInfo: default! '{}'".format(gen)) - cmd = ['cmake', '--system-information'] else: dbg("CMakeSystemInfo: assume vs! '{}'".format(gen)) from . import vsinfo gen = vsinfo.to_gen(gen) if isinstance(gen, list): - cmd = ['cmake', '-G'] + gen + ['--system-information'] + gen_args = ['-G'] + gen else: if not (gen.startswith('vs') or gen.startswith('Visual Studio')): raise Exception("unknown generator: {}".format(gen)) - cmd = ['cmake', '-G', gen, '--system-information'] + gen_args = ['-G', gen] + else: + gen_args = gen.configure_args() + dbg("CMakeSystemInfo: from generator! '{}' ---> {}".format(gen, gen_args)) + cmd = ['cmake'] + toolchain_args + gen_args + ['--system-information', os.path.basename(p)] + dbg("CMakeSystemInfo: cmd={}".format(cmd)) # remove export build commands as cmake reacts badly to it, # generating an empty info string _remove_invalid_args_from_sysinfo_cmd(cmd) + dbg("CMakeSystemInfo: filtered cmd={}".format(cmd)) print("\ncmany: CMake information for generator '{}' was not found. Creating and storing... cmd={}".format(gen, cmd)) # if not os.path.exists(d): os.makedirs(d) - with setcwd(d): - out = runsyscmd(cmd, echo_output=False, capture_output=True) - dbg("cmany: finished generating information for generator '{}'\n".format(gen), out, cmd) - out = out.strip() + with util.setcwd(d): + runsyscmd(cmd) + out = _getnfo(p) + dbg("cmany: finished generating information for generator '{}', cmd={}. Info=\n{}".format(gen, cmd, '\n'.join(out))) if not out: from .err import InvalidGenerator raise InvalidGenerator(gen, "for --system-information. cmd='{}'".format(cmd)) - with open(p, "w") as f: - f.write(out) - i = out.split("\n") - return i + return out + + +def _getnfo(p): + dbg("CMakeSystemInfo: loading=", p) + if not os.path.exists(p): + raise FileNotFoundError(p) + with open(p, "r") as f: + lines = f.readlines() + if not lines: + dbg("CMakeSystemInfo: info for gen", gen, "is empty...", p) + lines = [l.strip() for l in lines] + return lines def _remove_invalid_args_from_sysinfo_cmd(cmd): @@ -372,40 +388,62 @@ def _remove_invalid_args_from_sysinfo_cmd(cmd): # ----------------------------------------------------------------------------- # ----------------------------------------------------------------------------- # ----------------------------------------------------------------------------- + + +def _geninfodir(gen, toolchain_file: str): + dbg('cmakeinfo USER_DIR=', USER_DIR) + if toolchain_file is None: + base = USER_DIR + else: + id = _toolchainid(toolchain_file) + base = os.path.join(USER_DIR, 'toolchains', id) + dbg('cmakeinfo toolchain=', toolchain_file) + dbg('cmakeinfo toolchain_id=', id) + dbg('cmakeinfo toolchain_base=', base) + id = _genid(gen) + d = os.path.join(base, 'cmake_info', id) + dbg('cmakeinfo base=', base) + dbg('cmakeinfo gen_id=', id) + dbg('cmakeinfo infodir=', d) + return d + + +def _toolchaindir(toolchain_file: str): + id = _toolchainid(toolchain_file) + base = os.path.join(USER_DIR, 'toolchains', id) + dbg('cmakeinfo USER_DIR=', USER_DIR) + return base + + +def _gentc_id(gen, toolchain): + if toolchain is None: + return _genid(gen) + else: + return _toolchainid(toolchain) + '_' + _genid(gen) + + def _genid(gen): - from .generator import Generator - p = gen.sysinfo_name if isinstance(gen, Generator) else gen - if isinstance(gen, list): p = " ".join(p) + if isinstance(gen, str): + p = gen + elif isinstance(gen, list): + p = " ".join(p) + else: + from .generator import Generator + p = gen.sysinfo_name p = re.sub(r'[() ]', '_', p) return p +def _toolchainid(toolchain: str): + id = re.sub(os.sep, '_', toolchain) + id = re.sub(r'[() +.]', '_', id) + return id + + + # ----------------------------------------------------------------------------- # ----------------------------------------------------------------------------- # ----------------------------------------------------------------------------- -def get_toolchain_cache(toolchain): - d = os.path.join(USER_DIR, 'toolchains', re.sub(os.sep, '_', toolchain)) - dbg("toolchain cache: USER_DIR=", USER_DIR) - dbg("toolchain cache: d=", d) - bd = os.path.join(d, 'build') - dbg("toolchain cache: bd=", bd) - if not os.path.exists(d): - os.makedirs(d) - with setcwd(d): - with open('main.cpp', 'w') as f: - f.write("int main() {}") - with open('CMakeLists.txt', 'w') as f: - f.write(""" -cmake_minimum_required(VERSION 2.6) -project(toolchain_test) -add_executable(main main.cpp) -""") - if not os.path.exists(bd): - os.makedirs(bd) - with setcwd(bd): - cmd = ['cmake', '-DCMAKE_TOOLCHAIN_FILE='+toolchain, '..'] - runsyscmd(cmd, echo_output=True) - return loadvars(bd) def extract_toolchain_compilers(toolchain): diff --git a/src/c4/cmany/compiler.py b/src/c4/cmany/compiler.py index 47da206..ae31458 100644 --- a/src/c4/cmany/compiler.py +++ b/src/c4/cmany/compiler.py @@ -17,16 +17,16 @@ class Compiler(BuildItem): """Represents a compiler choice""" @staticmethod - def default(): - return Compiler(__class__.default_str()) + def default(toolchain_file: str=None): + return Compiler(__class__.default_str(toolchain_file)) @staticmethod - def default_str(): - if str(System.default()) != "windows": - cpp = CMakeSysInfo.cxx_compiler() + def default_str(toolchain_file: str=None): + if str(System.default(toolchain_file)) != "windows": + cpp = CMakeSysInfo.cxx_compiler(toolchain=toolchain_file) else: vs = vsinfo.find_any() - cpp = vs.name if vs is not None else CMakeSysInfo.cxx_compiler() + cpp = vs.name if vs is not None else CMakeSysInfo.cxx_compiler(toolchain_file) return cpp def is_trivial(self): diff --git a/src/c4/cmany/generator.py b/src/c4/cmany/generator.py index de983c5..06b7921 100644 --- a/src/c4/cmany/generator.py +++ b/src/c4/cmany/generator.py @@ -61,7 +61,7 @@ """ # ----------------------------------------------------------------------------- -class Generator(BuildItem): +class Generator(BuildItem): # NamedItem """Visual Studio aliases example: vs2013: use the bitness of the current system @@ -70,9 +70,9 @@ class Generator(BuildItem): """ @staticmethod - def default_str(): + def default_str(toolchain_file: str=None): """get the default generator from cmake""" - s = cmake.CMakeSysInfo.generator() + s = cmake.CMakeSysInfo.generator(toolchain_file) return s def __init__(self, name, build, num_jobs): diff --git a/src/c4/cmany/project.py b/src/c4/cmany/project.py index 1a0d207..63c9433 100644 --- a/src/c4/cmany/project.py +++ b/src/c4/cmany/project.py @@ -153,7 +153,7 @@ def _init_with_glob(self, **kwargs): self.builds.append(build) def _init_with_build_items(self, **kwargs): - s, a, c, t, v = __class__.get_build_items(**kwargs) + s, a, c, t, v = __class__.create_build_items(**kwargs) # cr = CombinationRules(kwargs.get('combination_rules', [])) combs = cr.valid_combinations(s, a, c, t, v) @@ -187,16 +187,14 @@ def _addnew(b, name): _addnew(b, 'variant') @staticmethod - def get_build_items(**kwargs): - d = odict() - for c, cls in ( - ('systems', System), - ('architectures', Architecture), - ('compilers', Compiler), - ('build_types', BuildType), - ('variants', Variant)): - d[c] = (cls, kwargs.get(c)) - coll = BuildItem.create(d) + def create_build_items(**kwargs): + coll = BuildItem.create_build_items({ + 'systems': System, + 'architectures': Architecture, + 'compilers': Compiler, + 'build_types': BuildType, + 'variants': Variant, + }, **kwargs) s = coll['systems'] a = coll['architectures'] c = coll['compilers'] diff --git a/src/c4/cmany/system.py b/src/c4/cmany/system.py index 9e5c0f9..9344309 100644 --- a/src/c4/cmany/system.py +++ b/src/c4/cmany/system.py @@ -7,13 +7,13 @@ class System(BuildItem): """Specifies an operating system""" @staticmethod - def default(): + def default(toolchain_file: str=None): """return the current operating system""" - return System(__class__.default_str()) + return System(__class__.default_str(toolchain_file)) @staticmethod - def default_str(): - s = CMakeSysInfo.system_name() + def default_str(toolchain_file: str=None): + s = CMakeSysInfo.system_name(toolchain=toolchain_file) if s == "mac os x" or s == "Darwin": s = "mac" return s diff --git a/src/c4/cmany/util.py b/src/c4/cmany/util.py index 50f5b25..982cb8f 100644 --- a/src/c4/cmany/util.py +++ b/src/c4/cmany/util.py @@ -497,6 +497,7 @@ def __exit__(self, exc_type, exc_value, traceback): def time_since_modification(path): """return the time elapsed since a path has been last modified, as a dateutil.relativedelta""" + # https://stackoverflow.com/questions/7015587/python-difference-of-2-datetimes-in-months mtime = os.path.getmtime(path) mtime = datetime.datetime.fromtimestamp(mtime) currt = datetime.datetime.now() diff --git a/src/c4/cmany/variant.py b/src/c4/cmany/variant.py index a4386ba..d955d18 100644 --- a/src/c4/cmany/variant.py +++ b/src/c4/cmany/variant.py @@ -8,11 +8,11 @@ class Variant(BuildItem): """for variations in build flags""" @staticmethod - def default_str(): + def default_str(toolchain_file: str=None): return 'none' @staticmethod - def default(): + def default(toolchain_file: str=None): return Variant(__class__.default_str()) @staticmethod diff --git a/test/test04combinations.py b/test/test04combinations.py index 5535ac8..d1148e3 100644 --- a/test/test04combinations.py +++ b/test/test04combinations.py @@ -54,7 +54,7 @@ def do_combination_t(test, input, expected_items, expected_combinations): ) for s, a, c, t, v in expected_combinations] # actual combinations - s, a, c, t, v = cmany.Project.get_build_items(**vars(args)) + s, a, c, t, v = cmany.Project.create_build_items(**vars(args)) cr = [] if hasattr(args, 'combination_rules'): cr = args.combination_rules diff --git a/test/test06xcompile.py b/test/test06xcompile.py index 7790298..c329047 100644 --- a/test/test06xcompile.py +++ b/test/test06xcompile.py @@ -21,8 +21,7 @@ def toolchain_compiler_exists(tc_file): - comps = cmake.extract_toolchain_compilers(tc_file) - return osp.exists(comps['CMAKE_CXX_COMPILER']) + return osp.exists(cmake.cxx_compiler(toolchain=tc_file)) def run_with_args(testdir, args_in): @@ -50,8 +49,7 @@ def do_toolchain_builds(toolchain, test, args, expected_builds): if not toolchain_compiler_exists(toolchain): return args = [a.format(toolchain=toolchain) for a in args] - comps = cmake.extract_toolchain_compilers(toolchain) - c = Compiler(comps['CMAKE_CXX_COMPILER']) + c = cmake.cxx_compiler(toolchain=toolchain) expected_builds = [b.format(compiler=Build.sanitize_compiler_name(c.name)) for b in expected_builds] for t in testdirs: