Commit 2337bbf35d1ce8805685f1b7229f62f56461d8a3

Authored by Sam Hocevar
Committed by GitHub
1 parent dccfb06d

Fix internal header include paths. (#475)

* Fix internal header include paths.

The extra leading "CLI/" part of include directives prevents the inclusion
of CLI.hpp from a relative directory without an extra -I or /I compiler
directive.

* Fix single header generation script.

Files included with "" should be relative to the header file location first.
include/CLI/App.hpp
... ... @@ -20,14 +20,14 @@
20 20 #include <vector>
21 21  
22 22 // CLI Library includes
23   -#include "CLI/ConfigFwd.hpp"
24   -#include "CLI/Error.hpp"
25   -#include "CLI/FormatterFwd.hpp"
26   -#include "CLI/Macros.hpp"
27   -#include "CLI/Option.hpp"
28   -#include "CLI/Split.hpp"
29   -#include "CLI/StringTools.hpp"
30   -#include "CLI/TypeTools.hpp"
  23 +#include "ConfigFwd.hpp"
  24 +#include "Error.hpp"
  25 +#include "FormatterFwd.hpp"
  26 +#include "Macros.hpp"
  27 +#include "Option.hpp"
  28 +#include "Split.hpp"
  29 +#include "StringTools.hpp"
  30 +#include "TypeTools.hpp"
31 31  
32 32 namespace CLI {
33 33  
... ...
include/CLI/CLI.hpp
... ... @@ -9,28 +9,28 @@
9 9 // CLI Library includes
10 10 // Order is important for combiner script
11 11  
12   -#include "CLI/Version.hpp"
  12 +#include "Version.hpp"
13 13  
14   -#include "CLI/Macros.hpp"
  14 +#include "Macros.hpp"
15 15  
16   -#include "CLI/StringTools.hpp"
  16 +#include "StringTools.hpp"
17 17  
18   -#include "CLI/Error.hpp"
  18 +#include "Error.hpp"
19 19  
20   -#include "CLI/TypeTools.hpp"
  20 +#include "TypeTools.hpp"
21 21  
22   -#include "CLI/Split.hpp"
  22 +#include "Split.hpp"
23 23  
24   -#include "CLI/ConfigFwd.hpp"
  24 +#include "ConfigFwd.hpp"
25 25  
26   -#include "CLI/Validators.hpp"
  26 +#include "Validators.hpp"
27 27  
28   -#include "CLI/FormatterFwd.hpp"
  28 +#include "FormatterFwd.hpp"
29 29  
30   -#include "CLI/Option.hpp"
  30 +#include "Option.hpp"
31 31  
32   -#include "CLI/App.hpp"
  32 +#include "App.hpp"
33 33  
34   -#include "CLI/Config.hpp"
  34 +#include "Config.hpp"
35 35  
36   -#include "CLI/Formatter.hpp"
  36 +#include "Formatter.hpp"
... ...
include/CLI/Config.hpp
... ... @@ -13,9 +13,9 @@
13 13 #include <utility>
14 14 #include <vector>
15 15  
16   -#include "CLI/App.hpp"
17   -#include "CLI/ConfigFwd.hpp"
18   -#include "CLI/StringTools.hpp"
  16 +#include "App.hpp"
  17 +#include "ConfigFwd.hpp"
  18 +#include "StringTools.hpp"
19 19  
20 20 namespace CLI {
21 21  
... ...
include/CLI/ConfigFwd.hpp
... ... @@ -12,8 +12,8 @@
12 12 #include <string>
13 13 #include <vector>
14 14  
15   -#include "CLI/Error.hpp"
16   -#include "CLI/StringTools.hpp"
  15 +#include "Error.hpp"
  16 +#include "StringTools.hpp"
17 17  
18 18 namespace CLI {
19 19  
... ...
include/CLI/Error.hpp
... ... @@ -13,7 +13,7 @@
13 13 #include <vector>
14 14  
15 15 // CLI library includes
16   -#include "CLI/StringTools.hpp"
  16 +#include "StringTools.hpp"
17 17  
18 18 namespace CLI {
19 19  
... ...
include/CLI/Formatter.hpp
... ... @@ -10,8 +10,8 @@
10 10 #include <string>
11 11 #include <vector>
12 12  
13   -#include "CLI/App.hpp"
14   -#include "CLI/FormatterFwd.hpp"
  13 +#include "App.hpp"
  14 +#include "FormatterFwd.hpp"
15 15  
16 16 namespace CLI {
17 17  
... ...
include/CLI/FormatterFwd.hpp
... ... @@ -11,7 +11,7 @@
11 11 #include <utility>
12 12 #include <vector>
13 13  
14   -#include "CLI/StringTools.hpp"
  14 +#include "StringTools.hpp"
15 15  
16 16 namespace CLI {
17 17  
... ...
include/CLI/Option.hpp
... ... @@ -15,11 +15,11 @@
15 15 #include <utility>
16 16 #include <vector>
17 17  
18   -#include "CLI/Error.hpp"
19   -#include "CLI/Macros.hpp"
20   -#include "CLI/Split.hpp"
21   -#include "CLI/StringTools.hpp"
22   -#include "CLI/Validators.hpp"
  18 +#include "Error.hpp"
  19 +#include "Macros.hpp"
  20 +#include "Split.hpp"
  21 +#include "StringTools.hpp"
  22 +#include "Validators.hpp"
23 23  
24 24 namespace CLI {
25 25  
... ...
include/CLI/Split.hpp
... ... @@ -11,8 +11,8 @@
11 11 #include <utility>
12 12 #include <vector>
13 13  
14   -#include "CLI/Error.hpp"
15   -#include "CLI/StringTools.hpp"
  14 +#include "Error.hpp"
  15 +#include "StringTools.hpp"
16 16  
17 17 namespace CLI {
18 18 namespace detail {
... ...
include/CLI/Validators.hpp
... ... @@ -6,9 +6,9 @@
6 6  
7 7 #pragma once
8 8  
9   -#include "CLI/Macros.hpp"
10   -#include "CLI/StringTools.hpp"
11   -#include "CLI/TypeTools.hpp"
  9 +#include "Macros.hpp"
  10 +#include "StringTools.hpp"
  11 +#include "TypeTools.hpp"
12 12  
13 13 #include <cmath>
14 14 #include <cstdint>
... ...
scripts/MakeSingleHeader.py
... ... @@ -128,6 +128,7 @@ def MakeHeader(
128 128  
129 129 base_dir = os.path.abspath(os.path.join(DIR, include_dir))
130 130 main_header = os.path.join(base_dir, main_header)
  131 + header_dir = os.path.dirname(main_header)
131 132 licence_file = os.path.abspath(os.path.join(DIR, "../LICENSE"))
132 133  
133 134 with open(licence_file) as f:
... ... @@ -138,7 +139,7 @@ def MakeHeader(
138 139  
139 140 include_files = includes_local.findall(header)
140 141  
141   - headers = [HeaderFile(base_dir, inc) for inc in include_files]
  142 + headers = [HeaderFile(header_dir, inc) for inc in include_files]
142 143 single_header = reduce(add, headers)
143 144  
144 145 if macro is not None:
... ...