mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-04 07:04:39 +00:00
commit
57b63b09fa
1
.stylua.toml
Normal file
1
.stylua.toml
Normal file
@ -0,0 +1 @@
|
|||||||
|
indent_type = "Spaces"
|
@ -29,6 +29,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef ARGPARSE_MODULE_USE_STD_MODULE
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <any>
|
#include <any>
|
||||||
#include <array>
|
#include <array>
|
||||||
@ -53,6 +55,7 @@ SOFTWARE.
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
#include <variant>
|
#include <variant>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace argparse {
|
namespace argparse {
|
||||||
|
|
||||||
@ -72,7 +75,7 @@ struct HasContainerTraits<
|
|||||||
decltype(std::declval<T>().size())>> : std::true_type {};
|
decltype(std::declval<T>().size())>> : std::true_type {};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static constexpr bool IsContainer = HasContainerTraits<T>::value;
|
inline constexpr bool IsContainer = HasContainerTraits<T>::value;
|
||||||
|
|
||||||
template <typename T, typename = void>
|
template <typename T, typename = void>
|
||||||
struct HasStreamableTraits : std::false_type {};
|
struct HasStreamableTraits : std::false_type {};
|
||||||
@ -84,7 +87,7 @@ struct HasStreamableTraits<
|
|||||||
: std::true_type {};
|
: std::true_type {};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static constexpr bool IsStreamable = HasStreamableTraits<T>::value;
|
inline constexpr bool IsStreamable = HasStreamableTraits<T>::value;
|
||||||
|
|
||||||
constexpr std::size_t repr_max_container_size = 5;
|
constexpr std::size_t repr_max_container_size = 5;
|
||||||
|
|
||||||
|
56
module/argparse.cppm
Normal file
56
module/argparse.cppm
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
__ _ _ __ __ _ _ __ __ _ _ __ ___ ___
|
||||||
|
/ _` | '__/ _` | '_ \ / _` | '__/ __|/ _ \ Argument Parser for Modern C++
|
||||||
|
| (_| | | | (_| | |_) | (_| | | \__ \ __/ http://github.com/p-ranav/argparse
|
||||||
|
\__,_|_| \__, | .__/ \__,_|_| |___/\___|
|
||||||
|
|___/|_|
|
||||||
|
|
||||||
|
Licensed under the MIT License <http://opensource.org/licenses/MIT>.
|
||||||
|
SPDX-License-Identifier: MIT
|
||||||
|
Copyright (c) 2019-2022 Pranav Srinivas Kumar <pranav.srinivas.kumar@gmail.com>
|
||||||
|
and other contributors.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
module;
|
||||||
|
|
||||||
|
#ifndef ARGPARSE_MODULE_USE_STD_MODULE
|
||||||
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
export module argparse;
|
||||||
|
|
||||||
|
#ifdef ARGPARSE_MODULE_USE_STD_MODULE
|
||||||
|
import std;
|
||||||
|
|
||||||
|
extern "C++" {
|
||||||
|
#include <argparse/argparse.hpp>
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
export namespace argparse {
|
||||||
|
using argparse::nargs_pattern;
|
||||||
|
using argparse::default_arguments;
|
||||||
|
using argparse::operator&;
|
||||||
|
using argparse::Argument;
|
||||||
|
using argparse::ArgumentParser;
|
||||||
|
}
|
||||||
|
|
10
test/argparse_details.cppm
Normal file
10
test/argparse_details.cppm
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
module;
|
||||||
|
|
||||||
|
#include <argparse/argparse.hpp>
|
||||||
|
|
||||||
|
export module argparse.details;
|
||||||
|
|
||||||
|
export namespace argparse::details {
|
||||||
|
using argparse::details::repr;
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
|
||||||
TEST_CASE("Simplest .append" * test_suite("append")) {
|
TEST_CASE("Simplest .append" * test_suite("append")) {
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
#include <test_utility.hpp>
|
#include <test_utility.hpp>
|
||||||
|
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
#include <test_utility.hpp>
|
#include <test_utility.hpp>
|
||||||
|
|
||||||
|
@ -1,7 +1,13 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <streambuf>
|
#include <streambuf>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -1,6 +1,14 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
|
||||||
TEST_CASE("Basic --value=value" * test_suite("equals_form")) {
|
TEST_CASE("Basic --value=value" * test_suite("equals_form")) {
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
|
#include <any>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
|
||||||
TEST_CASE("Getting a simple argument" * test_suite("ArgumentParser::get")) {
|
TEST_CASE("Getting a simple argument" * test_suite("ArgumentParser::get")) {
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
|
||||||
TEST_CASE("Missing argument" * test_suite("parse_args")) {
|
TEST_CASE("Missing argument" * test_suite("parse_args")) {
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
|
||||||
TEST_CASE("Parse unknown optional and positional arguments without exceptions" *
|
TEST_CASE("Parse unknown optional and positional arguments without exceptions" *
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
|
@ -1,6 +1,14 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
import argparse.details;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include <list>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
#include <cmath>
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
|
||||||
TEST_CASE("Add subparsers" * test_suite("subparsers")) {
|
TEST_CASE("Add subparsers" * test_suite("subparsers")) {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef ARGPARSE_TEST_UTILITY_HPP
|
#ifndef ARGPARSE_TEST_UTILITY_HPP
|
||||||
#define ARGPARSE_TEST_UTILITY_HPP
|
#define ARGPARSE_TEST_UTILITY_HPP
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
|
||||||
namespace testutility {
|
namespace testutility {
|
||||||
// Get value at index from std::list
|
// Get value at index from std::list
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
|
|
||||||
using doctest::test_suite;
|
using doctest::test_suite;
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#ifdef WITH_MODULE
|
||||||
|
import argparse;
|
||||||
|
#else
|
||||||
#include <argparse/argparse.hpp>
|
#include <argparse/argparse.hpp>
|
||||||
|
#endif
|
||||||
#include <doctest.hpp>
|
#include <doctest.hpp>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
89
xmake.lua
Normal file
89
xmake.lua
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
set_xmakever("2.8.2")
|
||||||
|
set_project("argparse")
|
||||||
|
|
||||||
|
set_version("2.9.0", { build = "%Y%m%d%H%M" })
|
||||||
|
|
||||||
|
option("enable_module")
|
||||||
|
option("enable_std_import", { defines = "ARGPARSE_MODULE_USE_STD_MODULE" })
|
||||||
|
option("enable_tests")
|
||||||
|
option("enable_samples")
|
||||||
|
|
||||||
|
add_cxxflags(
|
||||||
|
"-Wall",
|
||||||
|
"-Wno-long-long",
|
||||||
|
"-pedantic",
|
||||||
|
"-Wsign-conversion",
|
||||||
|
"-Wshadow",
|
||||||
|
"-Wconversion",
|
||||||
|
{ toolsets = { "clang", "gcc" } }
|
||||||
|
)
|
||||||
|
add_cxxflags("cl::/W4")
|
||||||
|
|
||||||
|
if is_plat("windows") then
|
||||||
|
add_defines("_CRT_SECURE_NO_WARNINGS")
|
||||||
|
end
|
||||||
|
|
||||||
|
target("argparse", function()
|
||||||
|
set_languages("c++17")
|
||||||
|
set_kind("headeronly")
|
||||||
|
if get_config("enable_module") then
|
||||||
|
set_languages("c++20")
|
||||||
|
set_kind("static") -- static atm because of a XMake bug, headeronly doesn't generate package module metadata
|
||||||
|
end
|
||||||
|
|
||||||
|
add_options("enable_std_import")
|
||||||
|
|
||||||
|
add_includedirs("include", { public = true })
|
||||||
|
add_headerfiles("include/argparse/argparse.hpp")
|
||||||
|
if get_config("enable_module") then
|
||||||
|
add_files("module/argparse.cppm", { install = true })
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
if get_config("enable_tests") then
|
||||||
|
target("argparse_tests", function()
|
||||||
|
set_kind("binary")
|
||||||
|
set_languages("c++17")
|
||||||
|
set_basename("tests")
|
||||||
|
|
||||||
|
add_includedirs("test")
|
||||||
|
|
||||||
|
add_files("test/main.cpp", { defines = { "DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN" } })
|
||||||
|
add_files("test/**.cpp")
|
||||||
|
|
||||||
|
add_deps("argparse")
|
||||||
|
end)
|
||||||
|
|
||||||
|
if get_config("enable_module") then
|
||||||
|
target("argparse_module_tests", function()
|
||||||
|
set_kind("binary")
|
||||||
|
set_languages("c++20")
|
||||||
|
set_basename("module_tests")
|
||||||
|
|
||||||
|
add_defines("WITH_MODULE")
|
||||||
|
|
||||||
|
add_includedirs("test")
|
||||||
|
|
||||||
|
add_files("test/main.cpp", { defines = { "DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN" } })
|
||||||
|
add_files("test/**.cpp")
|
||||||
|
add_files("test/argparse_details.cppm")
|
||||||
|
|
||||||
|
add_deps("argparse")
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if get_config("enable_samples") then
|
||||||
|
for _, sample_file in ipairs(os.files("samples/*.cpp")) do
|
||||||
|
target(path.basename(sample_file), function()
|
||||||
|
set_kind("binary")
|
||||||
|
set_languages("c++17")
|
||||||
|
|
||||||
|
add_files(sample_file)
|
||||||
|
|
||||||
|
set_policy("build.c++.modules", false)
|
||||||
|
|
||||||
|
add_deps("argparse")
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user