#include <limits>
-#ifndef WIN32
+#ifndef _WIN32
#include <sys/utsname.h>
#endif
#include <msp/strings/format.h>
0
};
+const char *fpus[] =
+{
+ "387", "x86",
+ "sse", "x86",
+ "vfpv3", "arm",
+ "neon", "arm",
+ 0
+};
+
const char *systems[] =
{
"linux",
0
};
+const char *toolchains[] =
+{
+ "gnu",
+ "clang",
+ 0
+};
+
const char *aliases[] =
{
"pc", "x86",
"power macintosh", "ppc",
"armeabi", "arm",
"v7a", "armv7a",
+ "gcc", "gnu",
+ "mingw", "windows-gnu",
0
};
{
if(spec.empty())
{
-#ifdef WIN32
+#ifdef _WIN32
system = "windows";
#else
utsname un;
else if(bits==native_arch.bits)
native = true;
}
+
+ if(toolchain.empty())
+ {
+ if((system=="darwin" || system=="freebsd") && builder.get_vfs().find_binary("clang"))
+ toolchain = "clang";
+ else
+ toolchain = "gnu";
+ }
+
name = type;
if(!cpu.empty())
name += format("-%s", cpu);
- name += format("-%d-%s", bits, system);
+ if(!fpu.empty())
+ name += format("-%s", fpu);
+ name += format("-%d-%s-%s", bits, system, toolchain);
if(system=="windows")
{
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
{
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 && *i!=toolchain)
return negate;
}
return !negate;
ok = true;
}
+ for(unsigned j=0; (!ok && fpus[j]); j+=2)
+ if(*i==fpus[j])
+ {
+ if(fpus[j+1]!=type)
+ throw invalid_argument("Conflicting FPU specification");
+ fpu = *i;
+ ok = true;
+ }
+
for(unsigned j=0; (!ok && systems[j]); ++j)
if(*i==systems[j])
{
ok = true;
}
+ for(unsigned j=0; (!ok && toolchains[j]); ++j)
+ if(*i==toolchains[j])
+ {
+ toolchain = *i;
+ ok = true;
+ }
+
if(!ok && (*i=="32" || *i=="64"))
{
bits = lexical_cast<unsigned>(*i);