From b6722ce5c94c498426e02324d3c39412a0c0ff41 Mon Sep 17 00:00:00 2001 From: Olivier Cessenat Date: Wed, 9 Apr 2025 17:46:48 +0200 Subject: [PATCH] scotch: takes care IDXSIZE differs from INTSIZE even with cmake (#49842) --- .../repos/builtin/packages/scotch/package.py | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/scotch/package.py b/var/spack/repos/builtin/packages/scotch/package.py index 6bb6d0c3896..5e9231244bc 100644 --- a/var/spack/repos/builtin/packages/scotch/package.py +++ b/var/spack/repos/builtin/packages/scotch/package.py @@ -140,9 +140,17 @@ def cmake_args(self): if "+int64" in self.spec: args.append("-DINTSIZE=64") + elif self.is_64bit(): + c_flags = [] + c_flags.append("-DIDXSIZE64") + c_flags.append("-DINTSIZE32") + args.append(self.define("CMAKE_C_FLAGS", " ".join(c_flags))) return args + def is_64bit(self): + return "64" in str(self.pkg.spec.target.family) + @when("+noarch") def setup_build_environment(self, env): env.unset("SPACK_TARGET_ARGS") @@ -155,13 +163,17 @@ def edit(self, pkg, spec, prefix): makefile_inc = [] cflags = ["-O3", "-DCOMMON_RANDOM_FIXED_SEED", "-DSCOTCH_DETERMINISTIC", "-DSCOTCH_RENAME"] + # SCOTCH_Num typedef: size of integers in arguments + # SCOTCH_Idx typedef: indices for addressing if "+int64" in self.spec: - # SCOTCH_Num typedef: size of integers in arguments cflags.append("-DINTSIZE64") - cflags.append("-DIDXSIZE64") # SCOTCH_Idx typedef: indices for addressing + cflags.append("-DIDXSIZE64") + elif self.is_64bit(): + cflags.append("-DINTSIZE32") + cflags.append("-DIDXSIZE64") else: cflags.append("-DINTSIZE32") - cflags.append("-DIDXSIZE64") # SCOTCH_Idx typedef: indices for addressing + cflags.append("-DIDXSIZE32") if self.spec.satisfies("platform=darwin"): cflags.extend(["-Drestrict=__restrict"]) @@ -283,6 +295,9 @@ def edit(self, pkg, spec, prefix): with open("Makefile.inc", "w") as fh: fh.write("\n".join(makefile_inc)) + def is_64bit(self): + return "64" in str(self.pkg.spec.target.family) + @property def build_targets(self): targets = ["scotch"]