aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cc
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-06-30 13:01:16 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-06-30 13:01:16 +0200
commit0a52676ff3de5b302eb4fa85ed8440ae14281318 (patch)
tree897f2d8435eb3140ee5e56fe817cb63cdff7fdcd /libbuild2/cc
parent195de65a84864cf5931325eeb2356f7d98155055 (diff)
Move symbol exporting .def file rule to bin.def module, add support for MinGW
The bin.def module is automatically loaded by the c and cxx modules for the *-win32-msvc target architecture. This allows automatically exporting all symbols for all Windows targets using the following setup (showing for cxx in this example): lib{foo}: libul{foo}: {hxx cxx}{**} ... lib{foo}: def{foo}: include = ($cxx.target.system == 'win32-msvc') def{foo}: libul{foo} if ($cxx.target.system == 'mingw32') cxx.loptions += -Wl,--export-all-symbols That is, we use the .def file generation for MSVC and the built-in support (--export-all-symbols) for MinGW. But it is also possible to use the .def file generation for MinGW. In this case we need to explicitly load the bin.def module (which should be done after loading c or cxx) and using the following setup: using bin.def # In root.build. lib{foo}: libul{foo}: {hxx cxx}{**} ... lib{foo}: def{foo}: include = ($cxx.target.class == 'windows') def{foo}: libul{foo}
Diffstat (limited to 'libbuild2/cc')
-rw-r--r--libbuild2/cc/init.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/libbuild2/cc/init.cxx b/libbuild2/cc/init.cxx
index eae6d6d..f201d79 100644
--- a/libbuild2/cc/init.cxx
+++ b/libbuild2/cc/init.cxx
@@ -340,15 +340,17 @@ namespace build2
}
}
- // Load bin.*.config for bin.* modules we may need (see core_init()
- // below).
+ // Load bin.* modules we may need (see core_init() below).
//
const string& tsys (cast<string> (rs["cc.target.system"]));
load_module (rs, rs, "bin.ar.config", loc);
if (tsys == "win32-msvc")
+ {
load_module (rs, rs, "bin.ld.config", loc);
+ load_module (rs, rs, "bin.def", loc);
+ }
if (tsys == "mingw32")
load_module (rs, rs, "bin.rc.config", loc);