diff options
author | Omri Mor <omrimor2@illinois.edu> | 2020-10-21 02:09:45 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-21 11:09:45 +0200 |
commit | 1147220b9bd5c925e30fb57e5296e8f89aa1da91 (patch) | |
tree | 10df52861e4364ba394e8db733a38c35feda6f9a /lib | |
parent | bed929e7a91d66c0be37d81351d8fb290a26e8cf (diff) | |
download | spack-1147220b9bd5c925e30fb57e5296e8f89aa1da91.tar.gz spack-1147220b9bd5c925e30fb57e5296e8f89aa1da91.tar.bz2 spack-1147220b9bd5c925e30fb57e5296e8f89aa1da91.tar.xz spack-1147220b9bd5c925e30fb57e5296e8f89aa1da91.zip |
CMakePackage: added 'ipo' variant (#18374)
+ipo sets CMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
The option is not supported for CMake < 3.9
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/build_systems/cmake.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/spack/spack/build_systems/cmake.py b/lib/spack/spack/build_systems/cmake.py index 2f5fd05405..4b679b358a 100644 --- a/lib/spack/spack/build_systems/cmake.py +++ b/lib/spack/spack/build_systems/cmake.py @@ -12,7 +12,7 @@ import re import spack.build_environment from llnl.util.filesystem import working_dir from spack.util.environment import filter_system_paths -from spack.directives import depends_on, variant +from spack.directives import depends_on, variant, conflicts from spack.package import PackageBase, InstallError, run_after # Regex to extract the primary generator from the CMake generator @@ -94,6 +94,13 @@ class CMakePackage(PackageBase): description='CMake build type', values=('Debug', 'Release', 'RelWithDebInfo', 'MinSizeRel')) + # https://cmake.org/cmake/help/latest/variable/CMAKE_INTERPROCEDURAL_OPTIMIZATION.html + variant('ipo', default=False, + description='CMake interprocedural optimization') + # CMAKE_INTERPROCEDURAL_OPTIMIZATION only exists for CMake >= 3.9 + conflicts('+ipo', when='^cmake@:3.8', + msg='+ipo is not supported by CMake < 3.9') + depends_on('cmake', type='build') @property @@ -147,6 +154,11 @@ class CMakePackage(PackageBase): except KeyError: build_type = 'RelWithDebInfo' + try: + ipo = pkg.spec.variants['ipo'].value + except KeyError: + ipo = False + define = CMakePackage.define args = [ '-G', generator, @@ -154,6 +166,10 @@ class CMakePackage(PackageBase): define('CMAKE_BUILD_TYPE', build_type), ] + # CMAKE_INTERPROCEDURAL_OPTIMIZATION only exists for CMake >= 3.9 + if pkg.spec.satisfies('^cmake@3.9:'): + args.append(define('CMAKE_INTERPROCEDURAL_OPTIMIZATION', ipo)) + if primary_generator == 'Unix Makefiles': args.append(define('CMAKE_VERBOSE_MAKEFILE', True)) |