help use of amalgamated header
* Include from same-directory first, so `-I DIR` is rarely needed.
* Double-check that proper header has been included.
http://stackoverflow.com/questions/28510109/linking-problems-with-jsoncpp
diff --git a/amalgamate.py b/amalgamate.py
index 22b825b..11d5357 100644
--- a/amalgamate.py
+++ b/amalgamate.py
@@ -59,7 +59,7 @@
print("Amalgating header...")
header = AmalgamationFile(source_top_dir)
header.add_text("/// Json-cpp amalgated header (http://jsoncpp.sourceforge.net/).")
- header.add_text("/// It is intented to be used with #include <%s>" % header_include_path)
+ header.add_text('/// It is intented to be used with #include "%s"' % header_include_path)
header.add_file("LICENSE", wrap_in_comment=True)
header.add_text("#ifndef JSON_AMALGATED_H_INCLUDED")
header.add_text("# define JSON_AMALGATED_H_INCLUDED")
@@ -85,7 +85,7 @@
print("Amalgating forward header...")
header = AmalgamationFile(source_top_dir)
header.add_text("/// Json-cpp amalgated forward header (http://jsoncpp.sourceforge.net/).")
- header.add_text("/// It is intented to be used with #include <%s>" % forward_header_include_path)
+ header.add_text('/// It is intented to be used with #include "%s"' % forward_header_include_path)
header.add_text("/// This header provides forward declaration for all JsonCpp types.")
header.add_file("LICENSE", wrap_in_comment=True)
header.add_text("#ifndef JSON_FORWARD_AMALGATED_H_INCLUDED")
@@ -105,10 +105,15 @@
print("Amalgating source...")
source = AmalgamationFile(source_top_dir)
source.add_text("/// Json-cpp amalgated source (http://jsoncpp.sourceforge.net/).")
- source.add_text("/// It is intented to be used with #include <%s>" % header_include_path)
+ source.add_text('/// It is intented to be used with #include "%s"' % header_include_path)
source.add_file("LICENSE", wrap_in_comment=True)
source.add_text("")
- source.add_text("#include <%s>" % header_include_path)
+ source.add_text('#include "%s"' % header_include_path)
+ source.add_text("""
+#ifndef JSON_IS_AMALGAMATED
+#error "Compile with -I PATH_TO_JSON_DIRECTORY"
+#endif
+""")
source.add_text("")
lib_json = "src/lib_json"
source.add_file(os.path.join(lib_json, "json_tool.h"))