- New CMake based build system. Based in part on contribution from
Igor Okulist and Damien Buhl (Patch #14). Added support for running
tests and building with DLL on Windows.
- added missing JSON_API
- Visual Studio DLL: suppressed warning "C4251: <data member>: <type>
needs to have dll-interface to be used by..." via pragma push/pop
in json-cpp headers.
- New header json/version.h now contains version number macros
(JSONCPP_VERSION_MAJOR, JSONCPP_VERSION_MINOR, JSONCPP_VERSION_PATCH
and JSONCPP_VERSION_HEXA). While this header is generated by CMake,
it is committed to ease build with alternate build system
(CMake only update the file when it changes avoid issues with VCS).
diff --git a/include/json/config.h b/include/json/config.h
index 72437c4..c9b298d 100644
--- a/include/json/config.h
+++ b/include/json/config.h
@@ -46,10 +46,17 @@
# ifdef JSON_IN_CPPTL
# define JSON_API CPPTL_API
# elif defined(JSON_DLL_BUILD)
-# define JSON_API __declspec(dllexport)
+# if defined(_MSC_VER)
+# define JSON_API __declspec(dllexport)
+# define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
+# endif // if defined(_MSC_VER)
# elif defined(JSON_DLL)
-# define JSON_API __declspec(dllimport)
-# else
+# if defined(_MSC_VER)
+# define JSON_API __declspec(dllimport)
+# define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
+# endif // if defined(_MSC_VER)
+# endif // ifdef JSON_IN_CPPTL
+# if !defined(JSON_API)
# define JSON_API
# endif
diff --git a/include/json/reader.h b/include/json/reader.h
index a3023b3..189da57 100644
--- a/include/json/reader.h
+++ b/include/json/reader.h
@@ -14,6 +14,13 @@
# include <stack>
# include <string>
+// Disable warning C4251: <data member>: <type> needs to have dll-interface to be used by...
+#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
+# pragma warning(push)
+# pragma warning(disable:4251)
+#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
+
+
namespace Json {
/** \brief Unserialize a <a HREF="http://www.json.org">JSON</a> document into a Value.
@@ -206,8 +213,13 @@
\throw std::exception on parse error.
\see Json::operator<<()
*/
- std::istream& operator>>( std::istream&, Value& );
+ JSON_API std::istream& operator>>( std::istream&, Value& );
} // namespace Json
+#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
+# pragma warning(pop)
+#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
+
+
#endif // CPPTL_JSON_READER_H_INCLUDED
diff --git a/include/json/value.h b/include/json/value.h
index 6daa8d1..bd7f181 100644
--- a/include/json/value.h
+++ b/include/json/value.h
@@ -21,6 +21,13 @@
# include <cpptl/forwards.h>
# endif
+// Disable warning C4251: <data member>: <type> needs to have dll-interface to be used by...
+#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
+# pragma warning(push)
+# pragma warning(disable:4251)
+#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
+
+
/** \brief JSON (JavaScript Object Notation).
*/
namespace Json {
@@ -1109,4 +1116,9 @@
} // namespace Json
+#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
+# pragma warning(pop)
+#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
+
+
#endif // CPPTL_JSON_H_INCLUDED
diff --git a/include/json/version.h b/include/json/version.h
new file mode 100644
index 0000000..9e1efcc
--- /dev/null
+++ b/include/json/version.h
@@ -0,0 +1,14 @@
+// DO NOT EDIT. This file is generated by CMake from "version"
+// and "version.h.in" files.
+// Run CMake configure step to update it.
+#ifndef JSON_VERSION_H_INCLUDED
+# define JSON_VERSION_H_INCLUDED
+
+# define JSONCPP_VERSION_STRING "0.6.0-dev"
+# define JSONCPP_VERSION_MAJOR 0
+# define JSONCPP_VERSION_MINOR 6
+# define JSONCPP_VERSION_PATCH 0
+# define JSONCPP_VERSION_QUALIFIER -dev
+# define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))
+
+#endif // JSON_VERSION_H_INCLUDED
diff --git a/include/json/writer.h b/include/json/writer.h
index 46d5ccc..23ebd50 100644
--- a/include/json/writer.h
+++ b/include/json/writer.h
@@ -12,6 +12,13 @@
# include <vector>
# include <string>
+// Disable warning C4251: <data member>: <type> needs to have dll-interface to be used by...
+#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
+# pragma warning(push)
+# pragma warning(disable:4251)
+#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
+
+
namespace Json {
class Value;
@@ -183,10 +190,14 @@
/// \brief Output using the StyledStreamWriter.
/// \see Json::operator>>()
- std::ostream& operator<<( std::ostream&, const Value &root );
+ JSON_API std::ostream& operator<<( std::ostream&, const Value &root );
} // namespace Json
+#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
+# pragma warning(pop)
+#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
+
#endif // JSON_WRITER_H_INCLUDED