From 2c381c0075c3684261b7433783918f30e5541fb6 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Wed, 21 Feb 2024 12:43:44 +0100 Subject: [PATCH] Update the CLI11 snapshot and move the header to --- README.md | 4 ++-- include/lol/3rdparty/cli11 | 2 +- include/lol/cli | 38 -------------------------------------- include/lol/lib/cli11 | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 36 insertions(+), 41 deletions(-) delete mode 100644 include/lol/cli create mode 100644 include/lol/lib/cli11 diff --git a/README.md b/README.md index bc871792..18400f78 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,6 @@ The header-only part of the Lol Engine framework. | header | description | examples | |--------|-------------|----------| -| `` | command-line parsing (imported from [cliutils/cli11](https://github.com/CLIUtils/CLI11)) | | | `` | portable file dialogs (imported from [samhocevar/portable-file-dialogs](https://github.com/samhocevar/portable-file-dialogs)) | | | `` | file reading utilities | ● `lol::read(filename, data)` for any `std::string` or `std::vector`
● `lol::write(filename, data)` | | `` | ensure `std::format` is available, using a fallback if necessary | | @@ -50,6 +49,7 @@ The header-only part of the Lol Engine framework. | header | description | |--------|-------------| -| `` | the PEGTL parser (imported from [taocpp/pegtl](https://github.com/taocpp/PEGTL)) | +| `` | the CLI11 command-line parsing library (imported from [cliutils/cli11](https://github.com/CLIUtils/CLI11)) | | | `` | the doctest unit test framework (imported from [doctest/doctest](https://github.com/doctest/doctest)) | | `` | a version of doctest that implements `main()` | +| `` | the PEGTL parser (imported from [taocpp/pegtl](https://github.com/taocpp/PEGTL)) | diff --git a/include/lol/3rdparty/cli11 b/include/lol/3rdparty/cli11 index 51f89966..141a4342 160000 --- a/include/lol/3rdparty/cli11 +++ b/include/lol/3rdparty/cli11 @@ -1 +1 @@ -Subproject commit 51f89966f07c12bb432e4521ec4a1b7d581e4435 +Subproject commit 141a434249ff55f14ff10ff717ec7efd24d4d948 diff --git a/include/lol/cli b/include/lol/cli deleted file mode 100644 index a8c79624..00000000 --- a/include/lol/cli +++ /dev/null @@ -1,38 +0,0 @@ -// -// Lol Engine -// -// Copyright © 2010–2024 Sam Hocevar -// -// Lol Engine is free software. It comes without any warranty, to -// the extent permitted by applicable law. You can redistribute it -// and/or modify it under the terms of the Do What the Fuck You Want -// to Public License, Version 2, as published by the WTFPL Task Force. -// See http://www.wtfpl.net/ for more details. -// - -#pragma once - -// Do not use on systems that do not have it -#include -#if defined _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY -# define CLI11_HAS_FILESYSTEM 0 -#endif - -#include "private/push_macros.h" -#include "3rdparty/cli11/include/CLI/CLI.hpp" -#include "private/pop_macros.h" - -namespace CLI -{ - -using app = App; - -}; - -namespace lol -{ - -namespace cli = CLI; - -}; - diff --git a/include/lol/lib/cli11 b/include/lol/lib/cli11 new file mode 100644 index 00000000..f62da906 --- /dev/null +++ b/include/lol/lib/cli11 @@ -0,0 +1,33 @@ +// +// Lol Engine +// +// Copyright © 2010–2024 Sam Hocevar +// +// Lol Engine is free software. It comes without any warranty, to +// the extent permitted by applicable law. You can redistribute it +// and/or modify it under the terms of the Do What the Fuck You Want +// to Public License, Version 2, as published by the WTFPL Task Force. +// See http://www.wtfpl.net/ for more details. +// + +#pragma once + +// CLI11 unconditionally uses std::getenv, which is not available on SCE platforms +#if defined __SCE__ +namespace std { static auto getenv = [](char const *) { return nullptr; }; } +#endif + +// Tell CLI11 to not use on systems that do not have it, but before +// that, do not use on systems that do not have it. +#if !defined __SCE__ +# include +# if defined _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY +# define CLI11_HAS_FILESYSTEM 0 +# endif +#endif + +// The CLI11 library +#include "../3rdparty/cli11/include/CLI/CLI.hpp" + +// Create a lol::cli::app alias for CLI::App +namespace lol::cli { using app = CLI::App; };