X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgnucompiler.cpp;h=bff5f8cd145106520005052184d04da274e4ae90;hb=7777d548fddca66b21f26273faedfdf675b10234;hp=ec1959afae67cfaf3a3f4a82e25e8a8c748f1a7a;hpb=7ed7c30ee0ceb734f17fe0c6d4bc6d37fb2ab5a7;p=builder.git diff --git a/source/gnucompiler.cpp b/source/gnucompiler.cpp index ec1959a..bff5f8c 100644 --- a/source/gnucompiler.cpp +++ b/source/gnucompiler.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include "architecture.h" #include "builder.h" #include "component.h" @@ -13,9 +14,8 @@ using namespace std; using namespace Msp; -GnuCompiler::GnuCompiler(Builder &b, const Architecture &a, const string &t, const string &c): - Tool(b, a, t), - command(c) +GnuCompiler::GnuCompiler(Builder &b, const Architecture &a, const string &t): + Tool(b, a, t) { if(architecture->is_native()) system_path.push_back("/usr/include"); @@ -54,7 +54,22 @@ string GnuCompiler::create_build_signature(const BuildInfo &binfo) const void GnuCompiler::do_prepare() { - set_executable(command, true); + executable = builder.get_vfs().find_binary(command); + if(executable) + { + ExternalTask::Arguments argv; + argv.push_back(executable->get_path().str()); + argv.push_back("-dumpversion"); + + builder.get_logger().log("auxcommands", format("Running %s", join(argv.begin(), argv.end()))); + try + { + version = strip(ExternalTask::run_and_capture_output(argv)); + builder.get_logger().log("tools", format("%s version is %s", FS::basename(executable->get_path()), version)); + } + catch(const runtime_error &) + { } + } } Task *GnuCompiler::run(const Target &target) const @@ -121,7 +136,7 @@ Task *GnuCompiler::run(const Target &target) const else argv.push_back(format("-O%d", binfo.optimize)); } - if(binfo.threads) + if(binfo.threads && architecture->get_system()!="windows" && architecture->get_system()!="darwin") argv.push_back("-pthread"); if((comp.get_type()==Component::LIBRARY || comp.get_type()==Component::MODULE) && architecture->get_system()!="windows") argv.push_back("-fPIC");