]> git.tdb.fi Git - builder.git/commitdiff
Library search fixes
authorMikko Rasa <tdb@tdb.fi>
Thu, 6 Sep 2012 11:54:29 +0000 (14:54 +0300)
committerMikko Rasa <tdb@tdb.fi>
Thu, 6 Sep 2012 11:54:29 +0000 (14:54 +0300)
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.

source/architecture.cpp
source/virtualfilesystem.cpp

index efe9c732dd707696d3d74610e340065c480960f2..fd31bcdbfd942a9ad05146d73e7dbb73fcecc38b 100644 (file)
@@ -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
index 19bc8db6fe2e4cf0ef24255ccd02bef5b5d7fbca..f1a0adb7b633c78a6b16896be775a65ba5f497fd 100644 (file)
@@ -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);
                        }