scotch: takes care IDXSIZE differs from INTSIZE even with cmake (#49842)

This commit is contained in:
Olivier Cessenat 2025-04-09 17:46:48 +02:00 committed by GitHub
parent 1cbee69bec
commit b6722ce5c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -140,9 +140,17 @@ def cmake_args(self):
if "+int64" in self.spec: if "+int64" in self.spec:
args.append("-DINTSIZE=64") 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 return args
def is_64bit(self):
return "64" in str(self.pkg.spec.target.family)
@when("+noarch") @when("+noarch")
def setup_build_environment(self, env): def setup_build_environment(self, env):
env.unset("SPACK_TARGET_ARGS") env.unset("SPACK_TARGET_ARGS")
@ -155,13 +163,17 @@ def edit(self, pkg, spec, prefix):
makefile_inc = [] makefile_inc = []
cflags = ["-O3", "-DCOMMON_RANDOM_FIXED_SEED", "-DSCOTCH_DETERMINISTIC", "-DSCOTCH_RENAME"] cflags = ["-O3", "-DCOMMON_RANDOM_FIXED_SEED", "-DSCOTCH_DETERMINISTIC", "-DSCOTCH_RENAME"]
if "+int64" in self.spec:
# SCOTCH_Num typedef: size of integers in arguments # SCOTCH_Num typedef: size of integers in arguments
# SCOTCH_Idx typedef: indices for addressing
if "+int64" in self.spec:
cflags.append("-DINTSIZE64") 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: else:
cflags.append("-DINTSIZE32") cflags.append("-DINTSIZE32")
cflags.append("-DIDXSIZE64") # SCOTCH_Idx typedef: indices for addressing cflags.append("-DIDXSIZE32")
if self.spec.satisfies("platform=darwin"): if self.spec.satisfies("platform=darwin"):
cflags.extend(["-Drestrict=__restrict"]) cflags.extend(["-Drestrict=__restrict"])
@ -283,6 +295,9 @@ def edit(self, pkg, spec, prefix):
with open("Makefile.inc", "w") as fh: with open("Makefile.inc", "w") as fh:
fh.write("\n".join(makefile_inc)) fh.write("\n".join(makefile_inc))
def is_64bit(self):
return "64" in str(self.pkg.spec.target.family)
@property @property
def build_targets(self): def build_targets(self):
targets = ["scotch"] targets = ["scotch"]