Create INTERPROCEDURAL_OPTIMIZATION build feature
This commit creates target and directory properties to enable the Intel interprocedural optimization support on Linux. Enabling it adds the compiler option '-ipo' and uses 'xiar' to create archives. See issue #9615.
This commit is contained in:
parent
1e48243591
commit
c513962701
|
@ -1,6 +1,8 @@
|
|||
INCLUDE(Platform/Linux-Intel)
|
||||
IF(XIAR)
|
||||
SET(CMAKE_C_CREATE_STATIC_LIBRARY
|
||||
# INTERPROCEDURAL_OPTIMIZATION
|
||||
SET(CMAKE_C_COMPILE_OPTIONS_IPO -ipo)
|
||||
SET(CMAKE_C_CREATE_STATIC_LIBRARY_IPO
|
||||
"${XIAR} cr <TARGET> <LINK_FLAGS> <OBJECTS> "
|
||||
"${XIAR} -s <TARGET> ")
|
||||
ENDIF(XIAR)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
INCLUDE(Platform/Linux-Intel)
|
||||
IF(XIAR)
|
||||
SET(CMAKE_CXX_CREATE_STATIC_LIBRARY
|
||||
# INTERPROCEDURAL_OPTIMIZATION
|
||||
SET(CMAKE_CXX_COMPILE_OPTIONS_IPO -ipo)
|
||||
SET(CMAKE_CXX_CREATE_STATIC_LIBRARY_IPO
|
||||
"${XIAR} cr <TARGET> <LINK_FLAGS> <OBJECTS> "
|
||||
"${XIAR} -s <TARGET> ")
|
||||
ENDIF(XIAR)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
INCLUDE(Platform/Linux-Intel)
|
||||
IF(XIAR)
|
||||
SET(CMAKE_Fortran_CREATE_STATIC_LIBRARY
|
||||
# INTERPROCEDURAL_OPTIMIZATION
|
||||
SET(CMAKE_Fortran_COMPILE_OPTIONS_IPO -ipo)
|
||||
SET(CMAKE_Fortran_CREATE_STATIC_LIBRARY_IPO
|
||||
"${XIAR} cr <TARGET> <LINK_FLAGS> <OBJECTS> "
|
||||
"${XIAR} -s <TARGET> ")
|
||||
ENDIF(XIAR)
|
||||
|
|
|
@ -3554,6 +3554,19 @@ void cmMakefile::DefineProperties(cmake *cm)
|
|||
"during dependency scanning to match include files that should "
|
||||
"be followed. See the include_regular_expression command.", false);
|
||||
|
||||
cm->DefineProperty
|
||||
("INTERPROCEDURAL_OPTIMIZATION", cmProperty::DIRECTORY,
|
||||
"Enable interprocedural optimization for targets in a directory.",
|
||||
"If set to true, enables interprocedural optimizations "
|
||||
"if they are known to be supported by the compiler.");
|
||||
|
||||
cm->DefineProperty
|
||||
("INTERPROCEDURAL_OPTIMIZATION_<CONFIG>", cmProperty::DIRECTORY,
|
||||
"Per-configuration interprocedural optimization for a directory.",
|
||||
"This is a per-configuration version of INTERPROCEDURAL_OPTIMIZATION. "
|
||||
"If set, this property overrides the generic property "
|
||||
"for the named configuration.");
|
||||
|
||||
cm->DefineProperty
|
||||
("VARIABLES", cmProperty::DIRECTORY,
|
||||
"List of variables defined in the current directory.",
|
||||
|
|
|
@ -113,6 +113,12 @@ void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules()
|
|||
}
|
||||
linkRuleVar += "_CREATE_STATIC_LIBRARY";
|
||||
|
||||
if(this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION") &&
|
||||
this->Makefile->GetDefinition((linkRuleVar+"_IPO").c_str()))
|
||||
{
|
||||
linkRuleVar += "_IPO";
|
||||
}
|
||||
|
||||
std::string extraFlags;
|
||||
this->LocalGenerator->AppendFlags
|
||||
(extraFlags,this->Target->GetProperty("STATIC_LIBRARY_FLAGS"));
|
||||
|
|
|
@ -1780,4 +1780,9 @@ void cmMakefileTargetGenerator::AddFeatureFlags(
|
|||
{
|
||||
// Add language-specific flags.
|
||||
this->LocalGenerator->AddLanguageFlags(flags, lang, this->ConfigName);
|
||||
|
||||
if(this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION"))
|
||||
{
|
||||
this->LocalGenerator->AppendFeatureOptions(flags, lang, "IPO");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -420,6 +420,19 @@ void cmTarget::DefineProperties(cmake *cm)
|
|||
"CMAKE_INSTALL_RPATH_USE_LINK_PATH if it is set when a target is "
|
||||
"created.");
|
||||
|
||||
cm->DefineProperty
|
||||
("INTERPROCEDURAL_OPTIMIZATION", cmProperty::TARGET,
|
||||
"Enable interprocedural optimization for a target.",
|
||||
"If set to true, enables interprocedural optimizations "
|
||||
"if they are known to be supported by the compiler.");
|
||||
|
||||
cm->DefineProperty
|
||||
("INTERPROCEDURAL_OPTIMIZATION_<CONFIG>", cmProperty::TARGET,
|
||||
"Per-configuration interprocedural optimization for a target.",
|
||||
"This is a per-configuration version of INTERPROCEDURAL_OPTIMIZATION. "
|
||||
"If set, this property overrides the generic property "
|
||||
"for the named configuration.");
|
||||
|
||||
cm->DefineProperty
|
||||
("LABELS", cmProperty::TARGET,
|
||||
"Specify a list of text labels associated with a target.",
|
||||
|
|
Loading…
Reference in New Issue