summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-01-21 11:08:37 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-01-21 11:08:37 +0200
commiteb649ff736e101e49afacb31d580741851375e69 (patch)
treec615d4aa2323c6581cff9bd17fae2204b7ed6dae
Basic "Hello World" C++ program with build2
-rw-r--r--.gitignore6
-rw-r--r--build/.gitignore1
-rw-r--r--build/bootstrap.build15
-rw-r--r--build/root.build5
-rw-r--r--buildfile7
-rw-r--r--hello.cxx22
-rw-r--r--manifest15
-rw-r--r--test.out2
-rw-r--r--version1
9 files changed, 74 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..7e598bd
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,6 @@
+*.o
+*.so
+*.a
+core
+
+hello
diff --git a/build/.gitignore b/build/.gitignore
new file mode 100644
index 0000000..225c27f
--- /dev/null
+++ b/build/.gitignore
@@ -0,0 +1 @@
+config.build
diff --git a/build/bootstrap.build b/build/bootstrap.build
new file mode 100644
index 0000000..20e3dbe
--- /dev/null
+++ b/build/bootstrap.build
@@ -0,0 +1,15 @@
+project = hello
+version = 1.0.0
+revision = 0
+
+using config
+using dist
+using test
+using install
+
+dist.package = $project-$version
+
+if ($revision != 0)
+{
+ dist.package += +$revision
+}
diff --git a/build/root.build b/build/root.build
new file mode 100644
index 0000000..7b1aac4
--- /dev/null
+++ b/build/root.build
@@ -0,0 +1,5 @@
+using cxx
+
+cxx{*}: extension = cxx
+
+cxx.std = 11
diff --git a/buildfile b/buildfile
new file mode 100644
index 0000000..0f35aef
--- /dev/null
+++ b/buildfile
@@ -0,0 +1,7 @@
+import libs = libhello%lib{hello}
+
+exe{hello}: cxx{hello} $libs
+exe{hello}: test.arguments = World "Planet #345732"
+exe{hello}: test.output = test.out
+
+./: exe{hello} doc{version} file{manifest}
diff --git a/hello.cxx b/hello.cxx
new file mode 100644
index 0000000..c105d17
--- /dev/null
+++ b/hello.cxx
@@ -0,0 +1,22 @@
+// file: hello.cxx -*- C++ -*-
+
+#include <iostream>
+
+#include <hello/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/manifest b/manifest
new file mode 100644
index 0000000..27c1158
--- /dev/null
+++ b/manifest
@@ -0,0 +1,15 @@
+: 1
+name: hello
+version: 1.0.0
+summary: The "Hello World" example program
+license: MIT
+tags: c++, hello, world, example
+description: \
+A simple program that implements the "Hello World" example in C++ using the
+libhello library. Its primary goal is to show a canonical build2/bpkg
+project/package.
+\
+url: http://www.example.org/hello
+email: hello-users@example.org
+requires: c++11
+depends: libhello [1.0.0 2.0.0-); compatible with libhello-1.X.Y
diff --git a/test.out b/test.out
new file mode 100644
index 0000000..275233c
--- /dev/null
+++ b/test.out
@@ -0,0 +1,2 @@
+Hello, World!
+Hello, Planet #345732!
diff --git a/version b/version
new file mode 100644
index 0000000..3eefcb9
--- /dev/null
+++ b/version
@@ -0,0 +1 @@
+1.0.0