From 939a5a750196545441eb64f6857aad15e2204697 Mon Sep 17 00:00:00 2001 From: Josef Eisl Date: Tue, 9 Apr 2024 12:06:13 +0200 Subject: [PATCH 1/2] CMakeNinjaProject support for multitarget --- mx.mx/suite.py | 16 ++++++++++++++++ src/mx/_impl/mx_cmake.py | 14 ++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/mx.mx/suite.py b/mx.mx/suite.py index ae34883e..1d26dde1 100644 --- a/mx.mx/suite.py +++ b/mx.mx/suite.py @@ -1100,5 +1100,21 @@ "maven": False, "graalCompilerSourceEdition": "ignore", }, + "DEFAULT_CMAKE_TOOLCHAIN": { + "native": True, + "platformDependent": True, + "description": "Default (empty) ninja toolchain for an OS-dependent toolchain found on the PATH", + "native_toolchain": { + "kind": "cmake", + "target": { + # all defaults (host compiler, host os/arch/libc, no variant) + }, + }, + "layout": { + "toolchain.cmake": "string:", + }, + "maven": False, + "graalCompilerSourceEdition": "ignore", + }, }, } diff --git a/src/mx/_impl/mx_cmake.py b/src/mx/_impl/mx_cmake.py index 18d5cbaf..945e0f48 100644 --- a/src/mx/_impl/mx_cmake.py +++ b/src/mx/_impl/mx_cmake.py @@ -86,6 +86,10 @@ def __init__(self, suite, name, deps, workingSets, subDir, ninja_targets=None, n if self._cmake_toolchain: self.buildDependencies += [self._cmake_toolchain] + @property + def toolchain_kind(self): + return "cmake" if self._multitarget else None + def resolveDeps(self): super(CMakeNinjaProject, self).resolveDeps() self._cmake_toolchain = mx.distribution(self._cmake_toolchain, context=self) if self._cmake_toolchain else None @@ -164,6 +168,12 @@ def mklink(): return src_link return src_dir + def generate_manifest_for_task(self, task, output_dir, filename): + extra_cmake_config = [] + if task.toolchain: + extra_cmake_config.append("-DCMAKE_TOOLCHAIN_FILE=" + os.path.join(task.toolchain.get_path(), "toolchain.cmake")) + self.generate_manifest(output_dir, filename, extra_cmake_config=extra_cmake_config) + def generate_manifest(self, output_dir, filename, extra_cmake_config=None): source_dir = self.sourceDir(create=True) if self._cmake_subdir: @@ -199,8 +209,8 @@ def generate_manifest(self, output_dir, filename, extra_cmake_config=None): shutil.copyfile(os.path.join(output_dir, mx_native.Ninja.default_manifest), path) return True - def _build_task(self, target_arch, args): - return CMakeNinjaBuildTask(args, self, target_arch, self._ninja_targets) + def _build_task(self, target_arch, args, toolchain=None): + return CMakeNinjaBuildTask(args, self, target_arch, self._ninja_targets, toolchain=toolchain) def getResults(self, replaceVar=mx_subst.results_substitutions): return [mx_subst.as_engine(replaceVar).substitute(rt, dependency=self) for rt in self.results] From c2ef30853dee6bca1865085552086f2bbd3c9252 Mon Sep 17 00:00:00 2001 From: Josef Eisl Date: Tue, 9 Apr 2024 12:07:49 +0200 Subject: [PATCH 2/2] Bump version --- src/mx/_impl/mx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mx/_impl/mx.py b/src/mx/_impl/mx.py index 909bbc55..acf22c8c 100755 --- a/src/mx/_impl/mx.py +++ b/src/mx/_impl/mx.py @@ -18147,7 +18147,7 @@ def alarm_handler(signum, frame): _CACHE_DIR = get_env('MX_CACHE_DIR', join(dot_mx_dir(), 'cache')) # The version must be updated for every PR (checked in CI) and the comment should reflect the PR's issue -version = VersionSpec("7.21.2") # revert 7.19.4 "[GR-51382] Change default tracker to 'rsspercentiles' and copy 99th rss percentile into max-rss" +version = VersionSpec("7.22.0") # CMakeNinjaProject support for multitarget _mx_start_datetime = datetime.utcnow()