-improve crosscompiling from Linux to iphone (#10526)
Patch by Karol Krizka Alex
This commit is contained in:
parent
42c40884d2
commit
3901e0408c
|
@ -423,3 +423,17 @@ void cmFindCommon::AddTrailingSlashes(std::vector<std::string>& paths)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void cmFindCommon::SetMakefile(cmMakefile* makefile)
|
||||||
|
{
|
||||||
|
cmCommand::SetMakefile(makefile);
|
||||||
|
|
||||||
|
// If we are building for Apple (OSX or also iphone), make sure
|
||||||
|
// that frameworks and bundles are searched first.
|
||||||
|
if(this->Makefile->IsOn("APPLE"))
|
||||||
|
{
|
||||||
|
this->SearchFrameworkFirst = true;
|
||||||
|
this->SearchAppBundleFirst = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -61,6 +61,8 @@ protected:
|
||||||
PathType pathType);
|
PathType pathType);
|
||||||
void AddPathInternal(std::string const& in_path, PathType pathType);
|
void AddPathInternal(std::string const& in_path, PathType pathType);
|
||||||
|
|
||||||
|
void SetMakefile(cmMakefile* makefile);
|
||||||
|
|
||||||
bool NoDefaultPath;
|
bool NoDefaultPath;
|
||||||
bool NoCMakePath;
|
bool NoCMakePath;
|
||||||
bool NoCMakeEnvironmentPath;
|
bool NoCMakeEnvironmentPath;
|
||||||
|
|
|
@ -712,9 +712,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target)
|
||||||
|
|
||||||
std::string langFlags;
|
std::string langFlags;
|
||||||
this->AddLanguageFlags(langFlags, llang, 0);
|
this->AddLanguageFlags(langFlags, llang, 0);
|
||||||
#ifdef __APPLE__
|
|
||||||
this->AddArchitectureFlags(langFlags, &target, llang, 0);
|
this->AddArchitectureFlags(langFlags, &target, llang, 0);
|
||||||
#endif /* __APPLE__ */
|
|
||||||
vars.LanguageCompileFlags = langFlags.c_str();
|
vars.LanguageCompileFlags = langFlags.c_str();
|
||||||
|
|
||||||
cmCustomCommandLines commandLines;
|
cmCustomCommandLines commandLines;
|
||||||
|
@ -1272,8 +1270,8 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang)
|
||||||
#endif
|
#endif
|
||||||
for(i = includes.begin(); i != includes.end(); ++i)
|
for(i = includes.begin(); i != includes.end(); ++i)
|
||||||
{
|
{
|
||||||
#ifdef __APPLE__
|
if(this->Makefile->IsOn("APPLE")
|
||||||
if(cmSystemTools::IsPathToFramework(i->c_str()))
|
&& cmSystemTools::IsPathToFramework(i->c_str()))
|
||||||
{
|
{
|
||||||
std::string frameworkDir = *i;
|
std::string frameworkDir = *i;
|
||||||
frameworkDir += "/../";
|
frameworkDir += "/../";
|
||||||
|
@ -1288,7 +1286,7 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang)
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
std::string include = *i;
|
std::string include = *i;
|
||||||
if(!flagUsed || repeatFlag)
|
if(!flagUsed || repeatFlag)
|
||||||
{
|
{
|
||||||
|
@ -1766,12 +1764,17 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout,
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
#ifdef __APPLE__
|
|
||||||
void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
|
void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
|
||||||
cmTarget* target,
|
cmTarget* target,
|
||||||
const char *lang,
|
const char *lang,
|
||||||
const char* config)
|
const char* config)
|
||||||
{
|
{
|
||||||
|
// Only add Mac OS X specific flags on Darwin platforms (OSX and iphone):
|
||||||
|
if(!this->Makefile->IsOn("APPLE"))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(this->EmitUniversalBinaryFlags)
|
if(this->EmitUniversalBinaryFlags)
|
||||||
{
|
{
|
||||||
std::vector<std::string> archs;
|
std::vector<std::string> archs;
|
||||||
|
@ -1828,7 +1831,6 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* __APPLE__ */
|
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
|
@ -133,10 +133,8 @@ public:
|
||||||
std::vector<cmLocalGenerator*>& GetChildren() { return this->Children; };
|
std::vector<cmLocalGenerator*>& GetChildren() { return this->Children; };
|
||||||
|
|
||||||
|
|
||||||
#ifdef __APPLE__
|
|
||||||
void AddArchitectureFlags(std::string& flags, cmTarget* target,
|
void AddArchitectureFlags(std::string& flags, cmTarget* target,
|
||||||
const char *lang, const char* config);
|
const char *lang, const char* config);
|
||||||
#endif /* __APPLE__ */
|
|
||||||
|
|
||||||
void AddLanguageFlags(std::string& flags, const char* lang,
|
void AddLanguageFlags(std::string& flags, const char* lang,
|
||||||
const char* config);
|
const char* config);
|
||||||
|
|
|
@ -229,10 +229,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||||
// Add language feature flags.
|
// Add language feature flags.
|
||||||
this->AddFeatureFlags(flags, linkLanguage);
|
this->AddFeatureFlags(flags, linkLanguage);
|
||||||
|
|
||||||
#ifdef __APPLE__
|
|
||||||
this->LocalGenerator->AddArchitectureFlags(flags, this->Target,
|
this->LocalGenerator->AddArchitectureFlags(flags, this->Target,
|
||||||
linkLanguage, this->ConfigName);
|
linkLanguage, this->ConfigName);
|
||||||
#endif /* __APPLE__ */
|
|
||||||
|
|
||||||
// Add target-specific linker flags.
|
// Add target-specific linker flags.
|
||||||
this->LocalGenerator->AppendFlags
|
this->LocalGenerator->AppendFlags
|
||||||
|
|
|
@ -682,10 +682,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
|
||||||
std::string langFlags;
|
std::string langFlags;
|
||||||
this->AddFeatureFlags(langFlags, linkLanguage);
|
this->AddFeatureFlags(langFlags, linkLanguage);
|
||||||
|
|
||||||
#ifdef __APPLE__
|
|
||||||
this->LocalGenerator->AddArchitectureFlags(langFlags, this->Target,
|
this->LocalGenerator->AddArchitectureFlags(langFlags, this->Target,
|
||||||
linkLanguage, this->ConfigName);
|
linkLanguage, this->ConfigName);
|
||||||
#endif /* __APPLE__ */
|
|
||||||
|
|
||||||
// remove any language flags that might not work with the
|
// remove any language flags that might not work with the
|
||||||
// particular os
|
// particular os
|
||||||
|
|
|
@ -294,10 +294,8 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
|
||||||
// Add language feature flags.
|
// Add language feature flags.
|
||||||
this->AddFeatureFlags(flags, lang);
|
this->AddFeatureFlags(flags, lang);
|
||||||
|
|
||||||
#ifdef __APPLE__
|
|
||||||
this->LocalGenerator->AddArchitectureFlags(flags, this->Target,
|
this->LocalGenerator->AddArchitectureFlags(flags, this->Target,
|
||||||
lang, this->ConfigName);
|
lang, this->ConfigName);
|
||||||
#endif /* __APPLE__ */
|
|
||||||
|
|
||||||
// Fortran-specific flags computed for this target.
|
// Fortran-specific flags computed for this target.
|
||||||
if(*l == "Fortran")
|
if(*l == "Fortran")
|
||||||
|
@ -1439,11 +1437,15 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(const char* main_output,
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
std::string cmMakefileTargetGenerator::GetFrameworkFlags()
|
std::string cmMakefileTargetGenerator::GetFrameworkFlags()
|
||||||
{
|
{
|
||||||
#ifndef __APPLE__
|
if(!this->Makefile->IsOn("APPLE"))
|
||||||
return std::string();
|
{
|
||||||
#else
|
return std::string();
|
||||||
std::set<cmStdString> emitted;
|
}
|
||||||
|
|
||||||
|
std::set<cmStdString> emitted;
|
||||||
|
#ifdef __APPLE__ /* don't insert this when crosscompiling e.g. to iphone */
|
||||||
emitted.insert("/System/Library/Frameworks");
|
emitted.insert("/System/Library/Frameworks");
|
||||||
|
#else
|
||||||
std::vector<std::string> includes;
|
std::vector<std::string> includes;
|
||||||
this->LocalGenerator->GetIncludeDirectories(includes);
|
this->LocalGenerator->GetIncludeDirectories(includes);
|
||||||
std::vector<std::string>::iterator i;
|
std::vector<std::string>::iterator i;
|
||||||
|
|
Loading…
Reference in New Issue