From 9d20ba45831e60f2146b1a338866d59bb81dc362 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 20 Jul 2017 08:55:11 +0200 Subject: Add modularized version --- mhello/.gitignore | 20 ++++++++++++++++++++ mhello/build/.gitignore | 1 + mhello/build/bootstrap.build | 7 +++++++ mhello/build/root.build | 9 +++++++++ mhello/buildfile | 11 +++++++++++ mhello/hello.cxx | 22 ++++++++++++++++++++++ mhello/manifest | 23 +++++++++++++++++++++++ mhello/test.out | 2 ++ 8 files changed, 95 insertions(+) create mode 100644 mhello/.gitignore create mode 100644 mhello/build/.gitignore create mode 100644 mhello/build/bootstrap.build create mode 100644 mhello/build/root.build create mode 100644 mhello/buildfile create mode 100644 mhello/hello.cxx create mode 100644 mhello/manifest create mode 100644 mhello/test.out 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 ..." << 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! -- cgit v1.1