build: Changing the way version is managed
Now control over the version number is moved to wscript. In addition to
that, a new NDN_CXX_VERSION_BUILD_STRING macro is set to include more
detailed information, including commit ID (e.g., "0.1.0-rc1-1-g5c86570").
Change-Id: I89ddd4e2f1248bca4f828865ec6d3c3921fa2822
diff --git a/src/version.hpp.in b/src/version.hpp.in
new file mode 100644
index 0000000..dee1660
--- /dev/null
+++ b/src/version.hpp.in
@@ -0,0 +1,61 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/**
+ * Copyright (c) 2013-2014, Regents of the University of California.
+ * All rights reserved.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ *
+ * This file licensed under New BSD License. See COPYING for detailed information about
+ * ndn-cxx library copyright, permissions, and redistribution restrictions.
+ *
+ * Based on code originally written by Jeff Thompson <jefft0@remap.ucla.edu>
+ */
+
+#ifndef NDN_VERSION_HPP
+#define NDN_VERSION_HPP
+
+namespace ndn {
+
+/** ndn-cxx version follows Semantic Versioning 2.0.0 specification
+ * http://semver.org/
+ */
+
+/** \brief ndn-cxx version represented as an integer
+ *
+ * MAJOR*1000000 + MINOR*1000 + PATCH
+ */
+#define NDN_CXX_VERSION @VERSION@
+
+/** \brief ndn-cxx version represented as a string
+ *
+ * MAJOR.MINOR.PATCH
+ */
+#define NDN_CXX_VERSION_STRING "@VERSION_STRING@"
+
+/** \brief ndn-cxx version string, including git commit information, if ndn-cxx is build from
+ * specific git commit
+ *
+ * NDN_CXX_VERSION_BUILD_STRING is obtained using the following command (`ndn-cxx-` prefix is
+ * afterwards removed):
+ *
+ * `git describe --match 'ndn-cxx-*'`
+ *
+ * When ndn-cxx is built not from git, NDN_CXX_VERSION_BUILD_STRING equals NDN_CXX_VERSION_STRING
+ *
+ * MAJOR.MINOR.PATCH(-release-candidate-tag)(-(number-of-commits-since-tag)-COMMIT-HASH)
+ *
+ * Example, 0.1.0-rc1-1-g5c86570
+ */
+#define NDN_CXX_VERSION_BUILD_STRING "@VERSION_BUILD@"
+
+/// MAJOR version
+#define NDN_CXX_VERSION_MAJOR @VERSION_MAJOR@
+/// MINOR version
+#define NDN_CXX_VERSION_MINOR @VERSION_MINOR@
+/// PATCH version
+#define NDN_CXX_VERSION_PATCH @VERSION_PATCH@
+
+} // namespace ndn
+
+#endif // NDN_VERSION_HPP