summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorAshwin Kumar Karnad <46030335+iamashwin99@users.noreply.github.com>2023-03-27 20:13:28 +0200
committerGitHub <noreply@github.com>2023-03-27 11:13:28 -0700
commit7266cc9b92b14a4b46c51f30f64f61233c941632 (patch)
tree7b8947491b5adce409e9917acebf0de86dc72bc9 /var
parentcc4a5282747a1ec5c3abf9131c99f5420cf95133 (diff)
downloadspack-7266cc9b92b14a4b46c51f30f64f61233c941632.tar.gz
spack-7266cc9b92b14a4b46c51f30f64f61233c941632.tar.bz2
spack-7266cc9b92b14a4b46c51f30f64f61233c941632.tar.xz
spack-7266cc9b92b14a4b46c51f30f64f61233c941632.zip
octopus: Update compiler flags (#36446)
* octopus: set the right compiler flags https://github.com/fangohr/octopus-in-spack/pull/70 * octopus: fix pep8 style issue
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/octopus/package.py37
1 files changed, 27 insertions, 10 deletions
diff --git a/var/spack/repos/builtin/packages/octopus/package.py b/var/spack/repos/builtin/packages/octopus/package.py
index 01167d8a21..cb7e63c956 100644
--- a/var/spack/repos/builtin/packages/octopus/package.py
+++ b/var/spack/repos/builtin/packages/octopus/package.py
@@ -219,16 +219,33 @@ class Octopus(AutotoolsPackage, CudaPackage):
# In case of GCC version 10, we will have errors because of
# argument mismatching. Need to provide a flag to turn this into a
# warning and build sucessfully
-
- fcflags = "FCFLAGS=-O2 -ffree-line-length-none"
- fflags = "FFLAGS=O2 -ffree-line-length-none"
- if spec.satisfies("%gcc@10:"):
- gcc10_extra = "-fallow-argument-mismatch -fallow-invalid-boz"
- args.append(fcflags + " " + gcc10_extra)
- args.append(fflags + " " + gcc10_extra)
- else:
- args.append(fcflags)
- args.append(fflags)
+ # We can disable variable tracking at assignments introduced in GCC10
+ # for debug variant to decrease compile time.
+
+ # Set optimization level for all flags
+ opt_level = "-O2"
+ fcflags = f"FCFLAGS={opt_level} -ffree-line-length-none"
+ cxxflags = f"CXXFLAGS={opt_level}"
+ cflags = f"CFLAGS={opt_level}"
+
+ # Add extra flags for gcc 10 or higher
+ gcc10_extra = (
+ "-fallow-argument-mismatch -fallow-invalid-boz"
+ if spec.satisfies("%gcc@10:")
+ else ""
+ )
+ # Add debug flag if needed
+ if spec.satisfies("+debug"):
+ fcflags += " -g"
+ cxxflags += " -g"
+ cflags += " -g"
+ gcc10_extra += (
+ "-fno-var-tracking-assignments" if spec.satisfies("%gcc@10:") else ""
+ )
+
+ args.append(f"{fcflags} {gcc10_extra}")
+ args.append(f"{cxxflags} {gcc10_extra}")
+ args.append(f"{cflags} {gcc10_extra}")
return args