From: Mikko Rasa Date: Thu, 6 Sep 2012 11:54:29 +0000 (+0300) Subject: Library search fixes X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=b58e16b078df97d8aabf64a8e4d0d8ce37ad3877;p=builder.git Library search fixes An outdated check was preventing dynamic libraries from being considered with libmode==STATIC (as opposed for FORCE_STATIC, which doesn't even generate the candidate names). Added a hack to prefer import libraries over real static libraries, and consider them even in FORCE_DYNAMIC mode. --- diff --git a/source/architecture.cpp b/source/architecture.cpp index efe9c73..fd31bcd 100644 --- a/source/architecture.cpp +++ b/source/architecture.cpp @@ -108,8 +108,10 @@ Architecture::Architecture(Builder &b, const string &spec): { sharedlib_patterns.push_back(Pattern("%.dll")); sharedlib_patterns.push_back(Pattern("lib%.dll")); + /* XXX Hack: Consider import libraries (*.dll.a) as dynamic libraries, + 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%.dll.a")); executable_patterns.push_back(Pattern("%.exe")); } else diff --git a/source/virtualfilesystem.cpp b/source/virtualfilesystem.cpp index 19bc8db..f1a0adb 100644 --- a/source/virtualfilesystem.cpp +++ b/source/virtualfilesystem.cpp @@ -96,17 +96,19 @@ FileTarget *VirtualFileSystem::find_library(const string &lib, const SearchPath FS::Path filename = *i / *j; if(FileTarget *tgt = get_target(filename)) { - if(cur_names!=&shared_names || mode==BuildInfo::DYNAMIC) - { - builder.get_logger().log("vfs", format("Library %s (%s) found in %s as existing %s", lib, *j, i->str(), tgt->get_type())); - return tgt; - } + builder.get_logger().log("vfs", format("Library %s (%s) found in %s as existing %s", lib, *j, i->str(), tgt->get_type())); + return tgt; } else if(file_exists(filename)) { builder.get_logger().log("vfs", format("Library %s (%s) found in %s", lib, *j, i->str())); if(cur_names==&shared_names) + { + // XXX Hack: create StaticLibrary targets for import libraries + if(FS::extpart(*j)==".a") + return new StaticLibrary(builder, filename); return new SharedLibrary(builder, filename); + } else return new StaticLibrary(builder, filename); }