From 0ee7e2426f5acf85f748bdfa64e337d1a64590ef Mon Sep 17 00:00:00 2001 From: Christopher Dunn Date: Sun, 15 Feb 2015 10:47:49 -0600 Subject: [PATCH] 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 --- amalgamate.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/amalgamate.py b/amalgamate.py index 22b825b..11d5357 100644 --- a/amalgamate.py +++ b/amalgamate.py @@ -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") @@ -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") @@ -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"))