summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-07-20 08:55:11 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-07-20 08:55:11 +0200
commit9d20ba45831e60f2146b1a338866d59bb81dc362 (patch)
tree8719b704b374a2806f2a8450687cf1d9fe0f7105
parent8bb21cfef3955e42bab30ca2dd074f29be5c2c36 (diff)
Add modularized version
-rw-r--r--mhello/.gitignore20
-rw-r--r--mhello/build/.gitignore1
-rw-r--r--mhello/build/bootstrap.build7
-rw-r--r--mhello/build/root.build9
-rw-r--r--mhello/buildfile11
-rw-r--r--mhello/hello.cxx22
-rw-r--r--mhello/manifest23
-rw-r--r--mhello/test.out2
8 files changed, 95 insertions, 0 deletions
diff --git a/mhello/.gitignore b/mhello/.gitignore
new file mode 100644
index 0000000..6e69d7f
--- /dev/null
+++ b/mhello/.gitignore
@@ -0,0 +1,20 @@
+# Compiler/linker output.
+#
+*.d
+*.ii
+*.o
+*.obj
+*.nms
+*.pcm
+*.ifc
+*.so
+*.dll
+*.a
+*.lib
+*.exp
+*.exe
+*.exe.dlls/
+*.exe.manifest
+
+hello
+version
diff --git a/mhello/build/.gitignore b/mhello/build/.gitignore
new file mode 100644
index 0000000..225c27f
--- /dev/null
+++ b/mhello/build/.gitignore
@@ -0,0 +1 @@
+config.build
diff --git a/mhello/build/bootstrap.build b/mhello/build/bootstrap.build
new file mode 100644
index 0000000..5243f55
--- /dev/null
+++ b/mhello/build/bootstrap.build
@@ -0,0 +1,7 @@
+project = mhello
+
+using version
+using config
+using dist
+using test
+using install
diff --git a/mhello/build/root.build b/mhello/build/root.build
new file mode 100644
index 0000000..a6a0f1b
--- /dev/null
+++ b/mhello/build/root.build
@@ -0,0 +1,9 @@
+cxx.std = experimental
+
+using cxx
+
+cxx{*}: extension = cxx
+
+# Specify the test target for cross-testing.
+#
+test.target = $cxx.target
diff --git a/mhello/buildfile b/mhello/buildfile
new file mode 100644
index 0000000..f13dea8
--- /dev/null
+++ b/mhello/buildfile
@@ -0,0 +1,11 @@
+import libs = libmhello%lib{mhello}
+import libs += libstd-modules%liba{std-modules}
+
+./: exe{hello} doc{version} file{manifest}
+
+doc{version}: file{manifest} # Generated by the version module.
+doc{version}: dist = true
+
+exe{hello}: cxx{hello} $libs
+exe{hello}: test.arguments = World "Planet #345732"
+exe{hello}: test.output = test.out
diff --git a/mhello/hello.cxx b/mhello/hello.cxx
new file mode 100644
index 0000000..7aa6c8a
--- /dev/null
+++ b/mhello/hello.cxx
@@ -0,0 +1,22 @@
+// file: hello.cxx -*- C++ -*-
+
+import std.core;
+import std.io;
+import hello;
+
+using namespace std;
+
+int
+main (int argc, char* argv[])
+{
+ if (argc < 2)
+ {
+ cerr << "usage: hello <name>..." << endl;
+ return 1;
+ }
+
+ using hello::say;
+
+ for (int i (1); i != argc; ++i)
+ say (argv[i]);
+}
diff --git a/mhello/manifest b/mhello/manifest
new file mode 100644
index 0000000..6a2883f
--- /dev/null
+++ b/mhello/manifest
@@ -0,0 +1,23 @@
+: 1
+name: mhello
+version: 1.0.0
+summary: The modularized "Hello World" example program
+license: MIT
+tags: c++, hello, world, example
+description: \
+A simple program that implements the "Hello World" example in C++ with
+modules using the libhello library. Its primary goal is to show a
+canonical build2/bpkg project/package.
+\
+url: http://www.example.org/mhello
+email: hello-users@example.org
+build-email: builds@build2.org
+build-exclude: *-msvc_15u0* ; Broken C++ modules support
+build-include: *-msvc_15*
+build-include: *-clang_5.0*
+build-exclude: * ; Requires C++ modules support
+requires: c++20
+depends: * build2 >= 0.6.0-
+depends: * bpkg >= 0.6.0-
+depends: libstd-modules
+depends: libmhello [1.0.0 2.0.0-); compatible with libmhello-1.X.Y
diff --git a/mhello/test.out b/mhello/test.out
new file mode 100644
index 0000000..275233c
--- /dev/null
+++ b/mhello/test.out
@@ -0,0 +1,2 @@
+Hello, World!
+Hello, Planet #345732!