aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cc/buildfile
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-10-10 23:13:46 +0300
committerBoris Kolpackov <boris@codesynthesis.com>2019-10-14 12:57:28 +0200
commit2671496db7c3996a6d8467360979f3085375c6df (patch)
tree281531a27acfdd4a929f19b6b35ce2a94bfc9633 /libbuild2/cc/buildfile
parent19e1b71a396e6b82c8e8a4602446ada0173579b9 (diff)
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.
Diffstat (limited to 'libbuild2/cc/buildfile')
-rw-r--r--libbuild2/cc/buildfile10
1 files changed, 10 insertions, 0 deletions
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.
#