Skip to content

Commit

Permalink
help use of amalgamated header
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
cdunn2001 committed Feb 15, 2015
1 parent 1522e4d commit 0ee7e24
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions amalgamate.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def amalgamate_source(source_top_dir=None,
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")
Expand All @@ -85,7 +85,7 @@ def amalgamate_source(source_top_dir=None,
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")
Expand All @@ -105,10 +105,15 @@ def amalgamate_source(source_top_dir=None,
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"))
Expand Down

0 comments on commit 0ee7e24

Please sign in to comment.