Skip to content

Standardized CMake Interprocedural Optimization Variant #18373

@omor1

Description

@omor1

Add standard ipo variant to CMakePackage.

Rationale

CMake exposes the CMAKE_INTERPROCEDURAL_OPTIMIZATION variable to enable IPO/LTO on all targets in a project. Similar to the standard build_type variant for CMake, Spack should have a standard ipo variant (defaulting to False) that enables CMAKE_INTERPROCEDURAL_OPTIMIZATION.

Description

# lib/spack/spack/build_systems/cmake.py
variant('ipo', default=False, description='CMake interprocedural optimization')

def _std_args(pkg):
    ...
    try:
        ipo = pkg.spec.variants['ipo'].value
    except KeyError:
        ipo = False

    args = [
        '-G', generator,
        define('CMAKE_INSTALL_PREFIX', pkg.prefix),
        define('CMAKE_BUILD_TYPE', build_type),
        define_from_variant('CMAKE_INTERPROCEDURAL_OPTIMIZATION', ipo),
    ]

Additional information

Spack 0.15.4-710-125191931

General information

  • I have run spack --version and reported the version of Spack
  • I have searched the issues of this repo and believe this is not a duplicate

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureA feature is missing in Spack

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions