mirror of
https://github.com/FEX-Emu/FEX.git
synced 2025-02-02 12:37:14 +00:00
Common: Convert cpp-optparse over to fextl and use.
This commit is contained in:
parent
a14353bc3c
commit
3cfc1de410
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -3,7 +3,7 @@
|
||||
path = External/vixl
|
||||
url = https://github.com/FEX-Emu/vixl.git
|
||||
[submodule "External/cpp-optparse"]
|
||||
path = External/cpp-optparse
|
||||
path = Source/Common/cpp-optparse
|
||||
url = https://github.com/Sonicadvance1/cpp-optparse
|
||||
[submodule "External/imgui"]
|
||||
path = External/imgui
|
||||
|
@ -242,9 +242,6 @@ if (BUILD_TESTS)
|
||||
include(Catch)
|
||||
endif()
|
||||
|
||||
add_subdirectory(External/cpp-optparse/)
|
||||
include_directories(External/cpp-optparse/)
|
||||
|
||||
add_subdirectory(External/fmt/)
|
||||
|
||||
add_subdirectory(External/imgui/)
|
||||
|
1
External/cpp-optparse
vendored
1
External/cpp-optparse
vendored
@ -1 +0,0 @@
|
||||
Subproject commit 2e480985bd5b024d4659988dc30c94ac24b4b14a
|
@ -3,7 +3,7 @@
|
||||
#include <FEXCore/fextl/string.h>
|
||||
#include <FEXCore/fextl/vector.h>
|
||||
|
||||
#include "OptionParser.h"
|
||||
#include "cpp-optparse/OptionParser.h"
|
||||
#include "git_version.h"
|
||||
|
||||
#include <stdint.h>
|
||||
@ -12,9 +12,8 @@ namespace FEX::ArgLoader {
|
||||
fextl::vector<fextl::string> RemainingArgs;
|
||||
fextl::vector<fextl::string> ProgramArguments;
|
||||
|
||||
static std::string Version = "FEX-Emu (" GIT_DESCRIBE_STRING ") ";
|
||||
static fextl::string Version = "FEX-Emu (" GIT_DESCRIBE_STRING ") ";
|
||||
void FEX::ArgLoader::ArgLoader::Load() {
|
||||
FEXCore::Allocator::YesIKnowImNotSupposedToUseTheGlibcAllocator glibc;
|
||||
optparse::OptionParser Parser{};
|
||||
Parser.version(Version);
|
||||
optparse::OptionGroup CPUGroup(Parser, "CPU Core options");
|
||||
@ -40,12 +39,8 @@ namespace FEX::ArgLoader {
|
||||
using uint32 = uint32_t;
|
||||
#define AFTER_PARSE
|
||||
#include <FEXCore/Config/ConfigOptions.inl>
|
||||
// TODO: Convert cpp-optparse over to fextl::vector
|
||||
auto ParserArgs = Parser.args();
|
||||
auto ParsedArgs = Parser.parsed_args();
|
||||
|
||||
RemainingArgs.insert(RemainingArgs.begin(), ParserArgs.begin(), ParserArgs.end());
|
||||
ProgramArguments.insert(ProgramArguments.begin(), ParsedArgs.begin(), ParsedArgs.end());
|
||||
RemainingArgs = Parser.args();
|
||||
ProgramArguments = Parser.parsed_args();
|
||||
}
|
||||
|
||||
void LoadWithoutArguments(int _argc, char **_argv) {
|
||||
|
@ -1,3 +1,5 @@
|
||||
add_subdirectory(cpp-optparse/)
|
||||
|
||||
set(NAME Common)
|
||||
set(SRCS
|
||||
ArgumentLoader.cpp
|
||||
|
1
Source/Common/cpp-optparse
Submodule
1
Source/Common/cpp-optparse
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 1f3b88a1ba3c4c6302a096d7e9002982e8811cb7
|
@ -1,5 +1,5 @@
|
||||
#include "ConfigDefines.h"
|
||||
#include "OptionParser.h"
|
||||
#include "Common/cpp-optparse/OptionParser.h"
|
||||
#include "Common/FEXServerClient.h"
|
||||
#include "git_version.h"
|
||||
#include <FEXCore/Config/Config.h>
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <FEXCore/fextl/fmt.h>
|
||||
#include <FEXCore/fextl/string.h>
|
||||
|
||||
#include "OptionParser.h"
|
||||
#include "Common/cpp-optparse/OptionParser.h"
|
||||
#include "XXFileHash.h"
|
||||
|
||||
#include "Common/ArgumentLoader.h"
|
||||
@ -37,7 +37,7 @@ namespace ArgOptions {
|
||||
|
||||
ListQueryOption DistroListOption {ListQueryOption::OPTION_ASK};
|
||||
|
||||
std::vector<fextl::string> RemainingArgs;
|
||||
fextl::vector<fextl::string> RemainingArgs;
|
||||
|
||||
std::string DistroName{};
|
||||
std::string DistroVersion{};
|
||||
@ -95,10 +95,7 @@ namespace ArgOptions {
|
||||
DistroVersion = Options["distro_version"];
|
||||
}
|
||||
|
||||
|
||||
// TODO: Convert cpp-optparse over to fextl::vector
|
||||
auto ParserArgs = Parser.args();
|
||||
RemainingArgs.insert(RemainingArgs.begin(), ParserArgs.begin(), ParserArgs.end());
|
||||
RemainingArgs = Parser.args();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
#include "ArgumentLoader.h"
|
||||
#include "OptionParser.h"
|
||||
#include "Common/cpp-optparse/OptionParser.h"
|
||||
|
||||
#include "git_version.h"
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
namespace FEXServer::Config {
|
||||
static std::string Version = "FEX-Emu (" GIT_DESCRIBE_STRING ") ";
|
||||
static fextl::string Version = "FEX-Emu (" GIT_DESCRIBE_STRING ") ";
|
||||
|
||||
FEXServerOptions Load(int argc, char **argv) {
|
||||
FEXServerOptions FEXOptions{};
|
||||
|
Loading…
x
Reference in New Issue
Block a user