diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 03470fd19..d3f8043a5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,11 +22,8 @@ jobs: - uses: actions/setup-python@v2 - - name: Make header - run: python ./scripts/MakeSingleHeader.py CLI11.hpp - - name: Prepare CMake config - run: cmake -S . -B build + run: cmake -S . -B build -DCLI11_SINGLE_FILE=ON - name: Make package run: cmake --build build --target package_source @@ -37,10 +34,13 @@ jobs: cp build/CLI11-*-Source.* CLI11-Source cp build/CLI11-*-Source.* . + - name: Make header + run: cmake --build build --target CLI11-generate-single-file + - uses: actions/upload-artifact@v2 with: name: CLI11.hpp - path: CLI11.hpp + path: build/include/CLI11.hpp - uses: actions/upload-artifact@v2 with: diff --git a/CLI11.hpp.in b/CLI11.hpp.in new file mode 100644 index 000000000..8de9c532e --- /dev/null +++ b/CLI11.hpp.in @@ -0,0 +1,67 @@ +// CLI11: Version {version} +// Originally designed by Henry Schreiner +// https://github.com/CLIUtils/CLI11 +// +// This is a standalone header file generated by MakeSingleHeader.py in CLI11/scripts +// from: {git} +// +// CLI11 {version} Copyright (c) 2017-2020 University of Cincinnati, developed by Henry +// Schreiner under NSF AWARD 1414736. All rights reserved. +// +// Redistribution and use in source and binary forms of CLI11, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// 3. Neither the name of the copyright holder nor the names of its contributors +// may be used to endorse or promote products derived from this software without +// specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Standard combined includes: +{public_includes} + +{version_hpp} + +{macros_hpp} + +{validators_hpp_filesystem} + +namespace {namespace} {{ + +{string_tools_hpp} + +{error_hpp} + +{type_tools_hpp} + +{split_hpp} + +{config_fwd_hpp} + +{validators_hpp} + +{formatter_fwd_hpp} + +{option_hpp} + +{app_hpp} + +{config_hpp} + +{formatter_hpp} + +}} // namespace {namespace} diff --git a/CMakeLists.txt b/CMakeLists.txt index f3df27444..ee0228ee5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -247,7 +247,10 @@ if(CLI11_SINGLE_FILE) add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/include/CLI11.hpp" COMMAND Python::Interpreter "${CMAKE_CURRENT_SOURCE_DIR}/scripts/MakeSingleHeader.py" - "${CMAKE_CURRENT_BINARY_DIR}/include/CLI11.hpp" + ${CLI11_headers} + --main "${CMAKE_CURRENT_SOURCE_DIR}/CLI11.hpp.in" + --output "${CMAKE_CURRENT_BINARY_DIR}/include/CLI11.hpp" + --version "${CLI11_VERSION}" DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/include/CLI/CLI.hpp" ${CLI11_headers}) diff --git a/include/CLI/App.hpp b/include/CLI/App.hpp index 53bb8fae8..d3c513bd0 100644 --- a/include/CLI/App.hpp +++ b/include/CLI/App.hpp @@ -6,6 +6,7 @@ #pragma once +// [CLI11:public_includes:set] #include #include #include @@ -18,6 +19,7 @@ #include #include #include +// [CLI11:public_includes:end] // CLI Library includes #include "ConfigFwd.hpp" @@ -30,6 +32,7 @@ #include "TypeTools.hpp" namespace CLI { +// [CLI11:app_hpp:verbatim] #ifndef CLI11_PARSE #define CLI11_PARSE(app, argc, argv) \ @@ -3234,4 +3237,5 @@ struct AppFriend { }; } // namespace detail +// [CLI11:app_hpp:end] } // namespace CLI diff --git a/include/CLI/Config.hpp b/include/CLI/Config.hpp index 0f6a05a7f..725872dca 100644 --- a/include/CLI/Config.hpp +++ b/include/CLI/Config.hpp @@ -6,19 +6,21 @@ #pragma once +// [CLI11:public_includes:set] #include #include #include #include #include #include +// [CLI11:public_includes:set] #include "App.hpp" #include "ConfigFwd.hpp" #include "StringTools.hpp" namespace CLI { - +// [CLI11:config_hpp:verbatim] namespace detail { inline std::string convert_arg_for_ini(const std::string &arg) { @@ -348,4 +350,5 @@ ConfigBase::to_config(const App *app, bool default_also, bool write_description, return out.str(); } +// [CLI11:config_hpp:end] } // namespace CLI diff --git a/include/CLI/ConfigFwd.hpp b/include/CLI/ConfigFwd.hpp index 2546d1352..2d9f9a39c 100644 --- a/include/CLI/ConfigFwd.hpp +++ b/include/CLI/ConfigFwd.hpp @@ -6,16 +6,19 @@ #pragma once +// [CLI11:public_includes:set] #include #include #include #include #include +// [CLI11:public_includes:end] #include "Error.hpp" #include "StringTools.hpp" namespace CLI { +// [CLI11:config_fwd_hpp:verbatim] class App; @@ -128,4 +131,5 @@ class ConfigINI : public ConfigTOML { valueDelimiter = '='; } }; +// [CLI11:config_fwd_hpp:end] } // namespace CLI diff --git a/include/CLI/Error.hpp b/include/CLI/Error.hpp index 6055cfba5..e6a832573 100644 --- a/include/CLI/Error.hpp +++ b/include/CLI/Error.hpp @@ -6,16 +6,19 @@ #pragma once +// [CLI11:public_includes:set] #include #include #include #include #include +// [CLI11:public_includes:end] // CLI library includes #include "StringTools.hpp" namespace CLI { +// [CLI11:error_hpp:verbatim] // Use one of these on all error classes. // These are temporary and are undef'd at the end of this file. @@ -344,4 +347,5 @@ class OptionNotFound : public Error { /// @} +// [CLI11:error_hpp:end] } // namespace CLI diff --git a/include/CLI/Formatter.hpp b/include/CLI/Formatter.hpp index daae93153..cb9e92a57 100644 --- a/include/CLI/Formatter.hpp +++ b/include/CLI/Formatter.hpp @@ -6,14 +6,17 @@ #pragma once +// [CLI11:public_includes:set] #include #include #include +// [CLI11:public_includes:end] #include "App.hpp" #include "FormatterFwd.hpp" namespace CLI { +// [CLI11:formatter_hpp:verbatim] inline std::string Formatter::make_group(std::string group, bool is_positional, std::vector opts) const { @@ -285,4 +288,5 @@ inline std::string Formatter::make_option_usage(const Option *opt) const { return opt->get_required() ? out.str() : "[" + out.str() + "]"; } +// [CLI11:formatter_hpp:end] } // namespace CLI diff --git a/include/CLI/FormatterFwd.hpp b/include/CLI/FormatterFwd.hpp index 362219e24..6908d4644 100644 --- a/include/CLI/FormatterFwd.hpp +++ b/include/CLI/FormatterFwd.hpp @@ -6,14 +6,17 @@ #pragma once +// [CLI11:public_includes:set] #include #include #include #include +// [CLI11:public_includes:end] #include "StringTools.hpp" namespace CLI { +// [CLI11:formatter_fwd_hpp:verbatim] class Option; class App; @@ -177,4 +180,5 @@ class Formatter : public FormatterBase { ///@} }; +// [CLI11:formatter_fwd_hpp:end] } // namespace CLI diff --git a/include/CLI/Macros.hpp b/include/CLI/Macros.hpp index 44e7098a0..778fec7dc 100644 --- a/include/CLI/Macros.hpp +++ b/include/CLI/Macros.hpp @@ -6,7 +6,7 @@ #pragma once -// [CLI11:verbatim] +// [CLI11:macros_hpp:verbatim] // The following version macro is very similar to the one in PyBind11 #if !(defined(_MSC_VER) && __cplusplus == 199711L) && !defined(__INTEL_COMPILER) @@ -41,4 +41,4 @@ #define CLI11_DEPRECATED(reason) __attribute__((deprecated(reason))) #endif -// [CLI11:verbatim] +// [CLI11:macros_hpp:end] diff --git a/include/CLI/Option.hpp b/include/CLI/Option.hpp index fdf4b5ce7..f09f61f97 100644 --- a/include/CLI/Option.hpp +++ b/include/CLI/Option.hpp @@ -6,6 +6,7 @@ #pragma once +// [CLI11:public_includes:set] #include #include #include @@ -14,6 +15,7 @@ #include #include #include +// [CLI11:public_includes:end] #include "Error.hpp" #include "Macros.hpp" @@ -22,6 +24,7 @@ #include "Validators.hpp" namespace CLI { +// [CLI11:option_hpp:verbatim] using results_t = std::vector; /// callback function definition @@ -1316,4 +1319,5 @@ class Option : public OptionBase