*j = prefix/ *j;
for(HeaderList::const_iterator j=headers.begin(); j!=headers.end(); ++j)
- all_found &= (builder.get_vfs().find_header(*j, incpath, system)!=0);
+ all_found &= (builder.get_vfs().find_header(*j, 0, incpath, system)!=0);
if(all_found)
{
#include "component.h"
#include "csourcefile.h"
#include "sourcepackage.h"
+#include "tool.h"
using namespace std;
using namespace Msp;
local_incpath.insert(local_incpath.begin(), build_info.local_incpath.begin(), build_info.local_incpath.end());
local_incpath.push_front(FS::dirname(path).str());
+ Tool *compiler = builder.get_toolchain().get_tool_for_suffix(FS::extpart(FS::basename(path)), true);
+ if(compiler)
+ compiler->prepare();
for(IncludeList::iterator i=includes.begin(); i!=includes.end(); ++i)
{
- Target *hdr = builder.get_vfs().find_header(i->substr(1), ((*i)[0]=='"' ? local_incpath : incpath));
+ Target *hdr = builder.get_vfs().find_header(i->substr(1), compiler, ((*i)[0]=='"' ? local_incpath : incpath));
if(hdr)
add_transitive_dependency(*hdr);
}
builder.get_logger().log("vfs", format("Path %s registered to %s", path, t->get_name()));
}
-FileTarget *VirtualFileSystem::find_header(const string &name, const SearchPath &path, bool use_syspath)
+FileTarget *VirtualFileSystem::find_header(const string &name, const Tool *tool, const SearchPath &path, bool use_syspath)
{
- // XXX This will cause trouble with multiple architectures in a single build
- const Tool *tool = builder.get_toolchain().get_tool_for_suffix(FS::extpart(FS::basename(name)), true);
+ if(!tool)
+ tool = builder.get_toolchain().get_tool_for_suffix(FS::extpart(FS::basename(name)), true);
if(!tool)
return 0;
/** Locates a source file. If a file is found but no target is associated
with it, a new package-less target is created with the appropriate tool. If
use_syspath is true, the system path reported by the tool is also searched. */
- FileTarget *find_header(const std::string &, const SearchPath &, bool use_syspath = true);
+ FileTarget *find_header(const std::string &, const Tool *, const SearchPath &, bool use_syspath = true);
/** Locates a library. The library name should be the same as what would be
used in linking with the library. If a file is found but no target is