From 0f6b759e11451b9cdae4b5f64fdcc82989161482 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 20 Jul 2017 08:55:33 +0200 Subject: Add modularized version --- libmhello/libmhello/buildfile | 15 +++++++++++++++ libmhello/libmhello/hello.cxx | 20 ++++++++++++++++++++ libmhello/libmhello/hello.mxx | 11 +++++++++++ 3 files changed, 46 insertions(+) create mode 100644 libmhello/libmhello/buildfile create mode 100644 libmhello/libmhello/hello.cxx create mode 100644 libmhello/libmhello/hello.mxx (limited to 'libmhello/libmhello') diff --git a/libmhello/libmhello/buildfile b/libmhello/libmhello/buildfile new file mode 100644 index 0000000..799e848 --- /dev/null +++ b/libmhello/libmhello/buildfile @@ -0,0 +1,15 @@ +import libs = libstd-modules%liba{std-modules} + +lib{mhello}: {mxx cxx}{hello} $libs + +# For pre-releases use the complete version to make sure they cannot be used +# in place of another pre-release or the final version. +# +if $version.pre_release + lib{mhello}: bin.lib.version = @"-$version.project_id" +else + lib{mhello}: bin.lib.version = @"-$version.major.$version.minor" + +# Install into the libmhello/ subdirectory of, say, /usr/include/. +# +install.include = $install.include/$project/ diff --git a/libmhello/libmhello/hello.cxx b/libmhello/libmhello/hello.cxx new file mode 100644 index 0000000..ff01860 --- /dev/null +++ b/libmhello/libmhello/hello.cxx @@ -0,0 +1,20 @@ +// file: libmhello/hello.cxx -*- C++ -*- + +module hello; + +#ifdef __clang__ +import std.core; +#endif + +import std.io; + +using namespace std; + +namespace hello +{ + void + say (const string& n) + { + cout << "Hello, " << n << '!' << endl; + } +} diff --git a/libmhello/libmhello/hello.mxx b/libmhello/libmhello/hello.mxx new file mode 100644 index 0000000..56993b3 --- /dev/null +++ b/libmhello/libmhello/hello.mxx @@ -0,0 +1,11 @@ +// file: libmhello/hello.mxx -*- C++ -*- + +export module hello; + +import std.core; + +export namespace hello +{ + __symexport void + say (const std::string& name); +} -- cgit v1.1