X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Farchitecture.cpp;h=627ba66ccf6ab6defbcaa960c09fbca775845b14;hb=921e8234ff65bd23c0b94ed568ec1fb68e47655b;hp=a9434986a91170a3de3ef4c7e6462b7b2ee1c911;hpb=081e13e6f146d1685bdcb1ec1c82752f4c6d264d;p=builder.git diff --git a/source/architecture.cpp b/source/architecture.cpp index a943498..627ba66 100644 --- a/source/architecture.cpp +++ b/source/architecture.cpp @@ -42,6 +42,15 @@ const char *cpus[] = 0 }; +const char *fpus[] = +{ + "387", "x86", + "sse", "x86", + "vfpv3", "arm", + "neon", "arm", + 0 +}; + const char *systems[] = { "linux", @@ -116,6 +125,8 @@ Architecture::Architecture(Builder &b, const string &spec): name = type; if(!cpu.empty()) name += format("-%s", cpu); + if(!fpu.empty()) + name += format("-%s", fpu); name += format("-%d-%s", bits, system); if(system=="windows") @@ -126,6 +137,7 @@ Architecture::Architecture(Builder &b, const string &spec): even though technically they are linked statically. */ sharedlib_patterns.push_back(Pattern("lib%.dll.a")); staticlib_patterns.push_back(Pattern("lib%.a")); + staticlib_patterns.push_back(Pattern("%.lib")); executable_patterns.push_back(Pattern("%.exe")); } else @@ -148,12 +160,36 @@ bool Architecture::match_name(const string &pattern) const { if((*i=="32" && bits==32) || (*i=="64" && bits==64)) ; - else if(*i!=type && *i!=cpu && *i!=system) + else if(*i!=type && *i!=cpu && *i!=fpu && *i!=system) return negate; } return !negate; } +string Architecture::best_match(const list &names) const +{ + string best; + unsigned best_size = 0; + for(list::const_iterator i=names.begin(); i!=names.end(); ++i) + if(match_name(*i)) + { + /* TODO Do full parse and alias resolution here? Otherwise x86 and + x86_64 are treated as equally good, even though the latter is more + specific. */ + unsigned size = 1; + for(string::const_iterator j=i->begin(); j!=i->end(); ++j) + size += (*j=='-'); + + if(size>best_size) + { + best = *i; + best_size = size; + } + } + + return best; +} + void Architecture::resolve_aliases(vector &parts) { for(unsigned i=0; i