aboutsummaryrefslogtreecommitdiff
path: root/tests/fdstream
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-09-22 23:32:28 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-09-22 23:32:28 +0200
commitc09cd7512491cee1e82c1ad8128ce9fd4bc3f79b (patch)
treea659ed768d849130ab5780a11b7f791a463a1a91 /tests/fdstream
parent2a00871f07067f8f9e2de08bb9c8f50e1bf6a650 (diff)
Initial modularization with both Clang and VC hacks
Note: gave up on VC about half way though.
Diffstat (limited to 'tests/fdstream')
-rw-r--r--tests/fdstream/buildfile6
-rw-r--r--tests/fdstream/driver.cxx32
2 files changed, 32 insertions, 6 deletions
diff --git a/tests/fdstream/buildfile b/tests/fdstream/buildfile
index 5440bc1..6028f3f 100644
--- a/tests/fdstream/buildfile
+++ b/tests/fdstream/buildfile
@@ -4,4 +4,10 @@
import libs = libbutl%lib{butl}
+if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc'))
+{
+ import libs += libstd-modules%liba{std-modules}
+ cxx.poptions += -D__cpp_lib_modules
+}
+
exe{driver}: {hxx cxx}{*} $libs
diff --git a/tests/fdstream/driver.cxx b/tests/fdstream/driver.cxx
index 42414bc..dd70cff 100644
--- a/tests/fdstream/driver.cxx
+++ b/tests/fdstream/driver.cxx
@@ -2,6 +2,9 @@
// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
+#include <cassert>
+
+#ifndef __cpp_lib_modules
#ifndef _WIN32
# include <chrono>
# include <thread> // this_thread::sleep_for()
@@ -11,18 +14,35 @@
#include <string>
#include <vector>
#include <iomanip>
-#include <cassert>
#include <sstream>
#include <fstream>
#include <utility> // move()
#include <iostream>
#include <exception>
+#endif
+
+// Other includes.
-#include <libbutl/path.hxx>
-#include <libbutl/process.hxx>
-#include <libbutl/fdstream.hxx>
-#include <libbutl/timestamp.hxx>
-#include <libbutl/filesystem.hxx>
+#ifdef __cpp_modules
+#ifdef __cpp_lib_modules
+import std.core;
+import std.io;
+#ifndef _WIN32
+//@@ MOD TODO import std.threading;
+#endif
+#endif
+import butl.path;
+import butl.process;
+import butl.fdstream;
+import butl.timestamp;
+import butl.filesystem;
+#else
+#include <libbutl/path.mxx>
+#include <libbutl/process.mxx>
+#include <libbutl/fdstream.mxx>
+#include <libbutl/timestamp.mxx>
+#include <libbutl/filesystem.mxx>
+#endif
using namespace std;
using namespace butl;