From 290ea7840c979e38a2108030a99e7e9c61f40a8c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 23 Nov 2017 11:43:02 +0200 Subject: Restructure and install std-detect.hxx We have to install this header since it needs to be included'able during module sidebuilds. --- libstd-modules/buildfile | 97 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 libstd-modules/buildfile (limited to 'libstd-modules/buildfile') diff --git a/libstd-modules/buildfile b/libstd-modules/buildfile new file mode 100644 index 0000000..a04d103 --- /dev/null +++ b/libstd-modules/buildfile @@ -0,0 +1,97 @@ +# file : libstd-modules/buildfile +# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd +# license : MIT; see accompanying LICENSE file + +if! $cxx.features.modules +{ + # List sources as files so that we can prepare a distribution with any + # compiler. + # + ./: {hxx mxx cxx}{*} +} +else +{ + # We only do the static library since this is what we would have gotten + # should we have used headers (i.e., whatever object code generated from + # those headers would have ended up in each executable/library). + # + ./: liba{std-modules} + + # Building of the modules gets rather compiler-specific. + # + if ($cxx.id.type == 'clang') + { + # Use the naming scheme expected by -fprebuilt-module-path=. Can also be + # specified with -fmodule-file=. + # + core = std.core.pcm + io = std.io.pcm + regex = std.regex.pcm + threading = std.threading.pcm + + liba{std-modules}: bmia{$core $io $regex $threading} + + export_target = $out_base/liba{std-modules} + } + elif ($cxx.id.type == 'msvc') + { + # Use the naming scheme expected by /module:stdIfcDir. Note that IFCPATH + # would require an extra directory (x64 or x86; e.g., x64/Release/). + # + # @@ Currently VC looks in Release regardless of /MD or /MDd. + # + dir = release/ + core = $dir/std.core.ifc + io = $dir/std.io.ifc + regex = $dir/std.regex.ifc + threading = $dir/std.threading.ifc + + bmia{$core $io $regex $threading}: fsdir{$dir} + + # VC expects to find std.lib next to the .ifc's. Make it the real one + # while std-modules -- a dummy. + # + ./: $dir/liba{std} + $dir/liba{std}: bmia{$core $io $regex $threading} + liba{std-modules}: cxx{dummy.cxx} + + # @@ Doesn't work if installed so we don't bother installing it. But we + # still install dummy std-modules; the idea is to link a dummy and + # (try) to use Microsoft-shipped .ifc's. + # + $dir/liba{std}: install = false + + # Include std-modules to trigger install. + # + export_target = $out_base/$dir/liba{std} $out_base/liba{std-modules} + } + + liba{std-modules}: hxx{*} + + # @@ TMP: use utility library instead? + # + if ($cxx.target.class == 'linux' || $cxx.target.class == 'bsd') + cxx.coptions += -fPIC + + # Clang with libc++ (sometimes) needs it -- go figure. + # + if ($cxx.target.class != "windows") + cxx.libs += -lpthread + + bmia{$core}: mxx{std-core} + bmia{$io}: mxx{std-io} bmia{$core} + bmia{$regex}: mxx{std-regex} bmia{$core} bmia{$io} + bmia{$threading}: mxx{std-threading} bmia{$core} + + mxx{std-core}@./: cc.module_name = std.core + mxx{std-io}@./: cc.module_name = std.io + mxx{std-regex}@./: cc.module_name = std.regex + mxx{std-threading}@./: cc.module_name = std.threading + + cxx.poptions =+ "-I$out_root" "-I$src_root" + liba{std-modules}: cxx.export.poptions = "-I$out_root" "-I$src_root" + + # Install into the libstd-modules/ subdirectory of, say, /usr/include/. + # + {hxx mxx}{*}: install = include/$project/ +} -- cgit v1.1