aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/bin/init.hxx
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/bin/init.hxx
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/bin/init.hxx')
-rw-r--r--libbuild2/bin/init.hxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/libbuild2/bin/init.hxx b/libbuild2/bin/init.hxx
index 6b0db27..4eb0f10 100644
--- a/libbuild2/bin/init.hxx
+++ b/libbuild2/bin/init.hxx
@@ -25,14 +25,20 @@ namespace build2
// rules.
// `bin.ar.config` -- loads bin.config and registers/sets more variables.
// `bin.ar` -- loads bin and bin.ar.config.
+ //
// `bin.ld.config` -- loads bin.config and registers/sets more variables.
// `bin.ld` -- loads bin and bin.ld.config and registers more
// target types for msvc.
+ //
// `bin.rc.config` -- loads bin.config and registers/sets more variables.
// `bin.rc` -- loads bin and bin.rc.config.
+ //
// `bin.nm.config` -- loads bin.config and registers/sets more variables.
// `bin.nm` -- loads bin and bin.nm.config.
//
+ // `bin.def` -- loads bin, bin.nm.config unless using MSVC link.exe,
+ // and registers the .def file generation rule.
+ //
extern "C" LIBBUILD2_BIN_SYMEXPORT const module_functions*
build2_bin_load ();
}