aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-11-23 11:43:02 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-11-23 11:43:02 +0200
commit290ea7840c979e38a2108030a99e7e9c61f40a8c (patch)
tree041eb38e45d39e032d203fb1c48f8ff07609db3e
parentd657b1d00d41bf448a94f6a7c49cacd41c5fac0e (diff)
Restructure and install std-detect.hxx
We have to install this header since it needs to be included'able during module sidebuilds.
-rw-r--r--build/export.build4
-rw-r--r--build/root.build1
-rw-r--r--buildfile91
-rw-r--r--libstd-modules/buildfile97
-rw-r--r--libstd-modules/dummy.cxx (renamed from dummy.cxx)2
-rw-r--r--libstd-modules/std-core.mxx (renamed from std-core.mxx)5
-rw-r--r--libstd-modules/std-detect.hxx (renamed from std-detect.hxx)0
-rw-r--r--libstd-modules/std-io.mxx (renamed from std-io.mxx)2
-rw-r--r--libstd-modules/std-regex.mxx (renamed from std-regex.mxx)4
-rw-r--r--libstd-modules/std-threading.mxx (renamed from std-threading.mxx)4
10 files changed, 110 insertions, 100 deletions
diff --git a/build/export.build b/build/export.build
index 334181e..6f0347c 100644
--- a/build/export.build
+++ b/build/export.build
@@ -4,7 +4,7 @@
$out_root/:
{
- include buildfile
+ include libstd-modules/
}
-export $($out_root/:export_target)
+export $($out_root/libstd-modules/:export_target)
diff --git a/build/root.build b/build/root.build
index 9f670f8..4e7e989 100644
--- a/build/root.build
+++ b/build/root.build
@@ -9,5 +9,6 @@ using cxx
if! $cxx.features.modules
warn 'c++ compiler does not support modules'
+hxx{*}: extension = hxx
mxx{*}: extension = mxx
cxx{*}: extension = cxx
diff --git a/buildfile b/buildfile
index f301ef1..2a5ec7a 100644
--- a/buildfile
+++ b/buildfile
@@ -2,7 +2,7 @@
# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
-./: tests/ doc{INSTALL LICENSE NEWS README version} file{manifest}
+./: {*/ -build/} doc{INSTALL LICENSE NEWS README version} file{manifest}
# The version file is auto-generated (by the version module) from manifest.
# Include it in distribution and don't remove when cleaning in src (so that
@@ -16,92 +16,3 @@ doc{version}: clean = ($src_root != $out_root)
#
dir{tests/}: install = false
doc{INSTALL}@./: install = false
-
-if! $cxx.features.modules
-{
- # List sources as files so that we can prepare a distribution with any
- # compiler.
- #
- ./: {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_root/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_root/$dir/liba{std} $out_root/liba{std-modules}
- }
-
- # @@ 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
-
- # Install into the libstd-modules/ subdirectory of, say, /usr/include/.
- #
- mxx{*}: install = include/$project/
-}
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/
+}
diff --git a/dummy.cxx b/libstd-modules/dummy.cxx
index fabedbf..68ebd58 100644
--- a/dummy.cxx
+++ b/libstd-modules/dummy.cxx
@@ -1,4 +1,4 @@
-// file : dummy.cxx -*- C++ -*-
+// file : libstd-modules/dummy.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
diff --git a/std-core.mxx b/libstd-modules/std-core.mxx
index ace9b59..c3f3566 100644
--- a/std-core.mxx
+++ b/libstd-modules/std-core.mxx
@@ -1,11 +1,11 @@
-// file : std-core.mxx -*- C++ -*-
+// file : libstd-modules/std-core.mxx -*- C++ -*-
// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
// For some standard library implementations we need to pre-include certain
// headers to prevent their exporting.
-#include "std-detect.hxx"
+#include <libstd-modules/std-detect.hxx>
#if defined(_MSC_VER)
/*
@@ -20,6 +20,7 @@
# include <errno.h>
# include <wchar.h> // struct tm forward declaration.
# include <stdio.h>
+# include <stdlib.h>
# include <string.h>
# include <strings.h>
# include <sys/types.h>
diff --git a/std-detect.hxx b/libstd-modules/std-detect.hxx
index b2998b5..b2998b5 100644
--- a/std-detect.hxx
+++ b/libstd-modules/std-detect.hxx
diff --git a/std-io.mxx b/libstd-modules/std-io.mxx
index 5370817..701e1b9 100644
--- a/std-io.mxx
+++ b/libstd-modules/std-io.mxx
@@ -1,4 +1,4 @@
-// file : std-io.mxx -*- C++ -*-
+// file : libstd-modules/std-io.mxx -*- C++ -*-
// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
diff --git a/std-regex.mxx b/libstd-modules/std-regex.mxx
index 7edfd94..427642c 100644
--- a/std-regex.mxx
+++ b/libstd-modules/std-regex.mxx
@@ -1,10 +1,10 @@
-// file : std-regex.mxx -*- C++ -*-
+// file : libstd-modules/std-regex.mxx -*- C++ -*-
// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
// Pre-includes.
//
-#include "std-detect.hxx"
+#include <libstd-modules/std-detect.hxx>
#if defined(_MSC_VER)
# include <algorithm>
diff --git a/std-threading.mxx b/libstd-modules/std-threading.mxx
index ab397cc..b03f55f 100644
--- a/std-threading.mxx
+++ b/libstd-modules/std-threading.mxx
@@ -1,4 +1,4 @@
-// file : std-threading.mxx -*- C++ -*-
+// file : libstd-modules/std-threading.mxx -*- C++ -*-
// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
@@ -7,7 +7,7 @@ export module std.threading; // Dummy.
#if 0
// Pre-includes.
//
-#include "std-detect.hxx"
+#include <libstd-modules/std-detect.hxx>
#if defined(_MSC_VER)
#error TODO