From 2671496db7c3996a6d8467360979f3085375c6df Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 10 Oct 2019 23:13:46 +0300 Subject: Implement MSVC installation discovery for version 15 (2017) and later In particular, this removes the requirement to build from the Visual Studio command prompt. Note that since MSVC compiler binaries are target-specific (i.e., there are no -m32/-m64 options nor something like /MACHINE), in this case we default to a 64-bit build (a 32-bit build can still be achieved by running from a suitable command prompt). Finally, this mechanism is also used to find Clang bundled with MSVC. --- libbuild2/cc/buildfile | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libbuild2/cc/buildfile') diff --git a/libbuild2/cc/buildfile b/libbuild2/cc/buildfile index 50192fa..19b9fc6 100644 --- a/libbuild2/cc/buildfile +++ b/libbuild2/cc/buildfile @@ -11,6 +11,7 @@ include ../bin/ int_libs = ../bin/lib{build2-bin} ./: lib{build2-cc}: libul{build2-cc}: {hxx ixx txx cxx}{** -**.test...} \ + h{msvc-setup} \ $int_libs $imp_libs # Unit tests. @@ -36,6 +37,13 @@ for t: cxx{**.test...} obja{*}: cxx.poptions += -DLIBBUILD2_CC_STATIC_BUILD objs{*}: cxx.poptions += -DLIBBUILD2_CC_SHARED_BUILD +if ($cxx.target.class == 'windows') + cxx.libs += $regex.apply(advapi32 ole32 oleaut32, \ + '(.+)', \ + $cxx.target.system == 'mingw32' \ + ? '-l\1' \ + : '\1.lib') + # Export options. # lib{build2-cc}: @@ -63,6 +71,8 @@ ver = ($version.pre_release \ lib{build2-cc}: bin.lib.version = @"-$ver" libs{build2-cc}: bin.lib.load_suffix = "-$ver" +h{msvc-setup}@./: install = false + # Install into the libbuild2/cc/ subdirectory of, say, /usr/include/ # recreating subdirectories. # -- cgit v1.1