Skip to content

Commit 505e086

Browse files
committed
Merge pull request open-source-parsers#173 from cdunn2001/fix-include-amal
help use of amalgamated header Reviewed by "Lightness Races in Orbit" at StackOverflow.
2 parents 1522e4d + c658241 commit 505e086

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

amalgamate.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def amalgamate_source(source_top_dir=None,
5959
print("Amalgating header...")
6060
header = AmalgamationFile(source_top_dir)
6161
header.add_text("/// Json-cpp amalgated header (http://jsoncpp.sourceforge.net/).")
62-
header.add_text("/// It is intented to be used with #include <%s>" % header_include_path)
62+
header.add_text('/// It is intended to be used with #include "%s"' % header_include_path)
6363
header.add_file("LICENSE", wrap_in_comment=True)
6464
header.add_text("#ifndef JSON_AMALGATED_H_INCLUDED")
6565
header.add_text("# define JSON_AMALGATED_H_INCLUDED")
@@ -85,7 +85,7 @@ def amalgamate_source(source_top_dir=None,
8585
print("Amalgating forward header...")
8686
header = AmalgamationFile(source_top_dir)
8787
header.add_text("/// Json-cpp amalgated forward header (http://jsoncpp.sourceforge.net/).")
88-
header.add_text("/// It is intented to be used with #include <%s>" % forward_header_include_path)
88+
header.add_text('/// It is intended to be used with #include "%s"' % forward_header_include_path)
8989
header.add_text("/// This header provides forward declaration for all JsonCpp types.")
9090
header.add_file("LICENSE", wrap_in_comment=True)
9191
header.add_text("#ifndef JSON_FORWARD_AMALGATED_H_INCLUDED")
@@ -105,10 +105,15 @@ def amalgamate_source(source_top_dir=None,
105105
print("Amalgating source...")
106106
source = AmalgamationFile(source_top_dir)
107107
source.add_text("/// Json-cpp amalgated source (http://jsoncpp.sourceforge.net/).")
108-
source.add_text("/// It is intented to be used with #include <%s>" % header_include_path)
108+
source.add_text('/// It is intended to be used with #include "%s"' % header_include_path)
109109
source.add_file("LICENSE", wrap_in_comment=True)
110110
source.add_text("")
111-
source.add_text("#include <%s>" % header_include_path)
111+
source.add_text('#include "%s"' % header_include_path)
112+
source.add_text("""
113+
#ifndef JSON_IS_AMALGAMATED
114+
#error "Compile with -I PATH_TO_JSON_DIRECTORY"
115+
#endif
116+
""")
112117
source.add_text("")
113118
lib_json = "src/lib_json"
114119
source.add_file(os.path.join(lib_json, "json_tool.h"))

0 commit comments

Comments
 (0)