Merge pull request #4916 from leoetlino/cpp-optparse

Use cpp-optparse for command line parsing
This commit is contained in:
Anthony 2017-02-26 15:51:35 -08:00 committed by GitHub
commit 06428c3f14
16 changed files with 1104 additions and 89 deletions

View File

@ -567,6 +567,8 @@ include_directories(Externals/Bochs_disasm)
add_subdirectory(Externals/glslang) add_subdirectory(Externals/glslang)
add_subdirectory(Externals/cpp-optparse)
if(USE_SHARED_ENET) if(USE_SHARED_ENET)
check_lib(ENET libenet enet enet/enet.h QUIET) check_lib(ENET libenet enet enet/enet.h QUIET)
include(CheckSymbolExists) include(CheckSymbolExists)

6
Externals/cpp-optparse/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,6 @@
check_and_add_flag(CXX11 -std=c++11)
set(SRCS OptionParser.cpp OptionParser.h)
add_library(cpp-optparse STATIC ${SRCS})
target_include_directories(cpp-optparse PUBLIC .)

593
Externals/cpp-optparse/OptionParser.cpp vendored Normal file
View File

@ -0,0 +1,593 @@
/**
* Copyright (C) 2010 Johannes Weißl <jargon@molb.org>
* License: MIT License
* URL: https://github.com/weisslj/cpp-optparse
*/
#include "OptionParser.h"
#include <cstdlib>
#include <algorithm>
#include <complex>
#include <ciso646>
#if defined(ENABLE_NLS) && ENABLE_NLS
# include <libintl.h>
# define _(s) gettext(s)
#else
# define _(s) ((const char *) (s))
#endif
using namespace std;
namespace optparse {
////////// auxiliary (string) functions { //////////
class str_wrap {
public:
str_wrap(const string& l, const string& r) : lwrap(l), rwrap(r) {}
str_wrap(const string& w) : lwrap(w), rwrap(w) {}
string operator() (const string& s) { return lwrap + s + rwrap; }
const string lwrap, rwrap;
};
template<typename InputIterator, typename UnaryOperator>
static string str_join_trans(const string& sep, InputIterator begin, InputIterator end, UnaryOperator op) {
string buf;
for (InputIterator it = begin; it != end; ++it) {
if (it != begin)
buf += sep;
buf += op(*it);
}
return buf;
}
template<class InputIterator>
static string str_join(const string& sep, InputIterator begin, InputIterator end) {
return str_join_trans(sep, begin, end, str_wrap(""));
}
static string& str_replace(string& s, const string& patt, const string& repl) {
size_t pos = 0, n = patt.length();
while (true) {
pos = s.find(patt, pos);
if (pos == string::npos)
break;
s.replace(pos, n, repl);
pos += repl.size();
}
return s;
}
static string str_replace(const string& s, const string& patt, const string& repl) {
string tmp = s;
str_replace(tmp, patt, repl);
return tmp;
}
static string str_format(const string& str, size_t pre, size_t len, bool running_text = true, bool indent_first = true) {
string s = str;
stringstream ss;
string p;
len -= 2; // Python seems to not use full length
if (running_text)
replace(s.begin(), s.end(), '\n', ' ');
if (indent_first)
p = string(pre, ' ');
size_t pos = 0, linestart = 0;
size_t line = 0;
while (true) {
bool wrap = false;
size_t new_pos = s.find_first_of(" \n\t", pos);
if (new_pos == string::npos)
break;
if (s[new_pos] == '\n') {
pos = new_pos + 1;
wrap = true;
}
if (line == 1)
p = string(pre, ' ');
if (wrap || new_pos + pre > linestart + len) {
ss << p << s.substr(linestart, pos - linestart - 1) << endl;
linestart = pos;
line++;
}
pos = new_pos + 1;
}
ss << p << s.substr(linestart) << endl;
return ss.str();
}
static string str_inc(const string& s) {
stringstream ss;
string v = (s != "") ? s : "0";
long i;
istringstream(v) >> i;
ss << i+1;
return ss.str();
}
static unsigned int cols() {
unsigned int n = 80;
#ifndef _WIN32
const char *s = getenv("COLUMNS");
if (s)
istringstream(s) >> n;
#endif
return n;
}
static string basename(const string& s) {
string b = s;
size_t i = b.find_last_not_of('/');
if (i == string::npos) {
if (b[0] == '/')
b.erase(1);
return b;
}
b.erase(i+1, b.length()-i-1);
i = b.find_last_of("/");
if (i != string::npos)
b.erase(0, i+1);
return b;
}
////////// } auxiliary (string) functions //////////
////////// class OptionContainer { //////////
Option& OptionContainer::add_option(const string& opt) {
const string tmp[1] = { opt };
return add_option(vector<string>(&tmp[0], &tmp[1]));
}
Option& OptionContainer::add_option(const string& opt1, const string& opt2) {
const string tmp[2] = { opt1, opt2 };
return add_option(vector<string>(&tmp[0], &tmp[2]));
}
Option& OptionContainer::add_option(const string& opt1, const string& opt2, const string& opt3) {
const string tmp[3] = { opt1, opt2, opt3 };
return add_option(vector<string>(&tmp[0], &tmp[3]));
}
Option& OptionContainer::add_option(const vector<string>& v) {
_opts.resize(_opts.size()+1, Option(get_parser()));
Option& option = _opts.back();
string dest_fallback;
for (vector<string>::const_iterator it = v.begin(); it != v.end(); ++it) {
if (it->substr(0,2) == "--") {
const string s = it->substr(2);
if (option.dest() == "")
option.dest(str_replace(s, "-", "_"));
option._long_opts.insert(s);
_optmap_l[s] = &option;
} else {
const string s = it->substr(1,1);
if (dest_fallback == "")
dest_fallback = s;
option._short_opts.insert(s);
_optmap_s[s] = &option;
}
}
if (option.dest() == "")
option.dest(dest_fallback);
return option;
}
string OptionContainer::format_option_help(unsigned int indent /* = 2 */) const {
stringstream ss;
if (_opts.empty())
return ss.str();
for (list<Option>::const_iterator it = _opts.begin(); it != _opts.end(); ++it) {
if (it->help() != SUPPRESS_HELP)
ss << it->format_help(indent);
}
return ss.str();
}
////////// } class OptionContainer //////////
////////// class OptionParser { //////////
OptionParser::OptionParser() :
OptionContainer(),
_usage(_("%prog [options]")),
_add_help_option(true),
_add_version_option(true),
_interspersed_args(true) {}
OptionParser& OptionParser::add_option_group(const OptionGroup& group) {
for (list<Option>::const_iterator oit = group._opts.begin(); oit != group._opts.end(); ++oit) {
const Option& option = *oit;
for (set<string>::const_iterator it = option._short_opts.begin(); it != option._short_opts.end(); ++it)
_optmap_s[*it] = &option;
for (set<string>::const_iterator it = option._long_opts.begin(); it != option._long_opts.end(); ++it)
_optmap_l[*it] = &option;
}
_groups.push_back(&group);
return *this;
}
const Option& OptionParser::lookup_short_opt(const string& opt) const {
optMap::const_iterator it = _optmap_s.find(opt);
if (it == _optmap_s.end())
error(_("no such option") + string(": -") + opt);
return *it->second;
}
void OptionParser::handle_short_opt(const string& opt, const string& arg) {
_remaining.pop_front();
string value;
const Option& option = lookup_short_opt(opt);
if (option._nargs == 1) {
value = arg.substr(2);
if (value == "") {
if (_remaining.empty())
error("-" + opt + " " + _("option requires an argument"));
value = _remaining.front();
_remaining.pop_front();
}
} else {
if (arg.length() > 2)
_remaining.push_front(string("-") + arg.substr(2));
}
process_opt(option, string("-") + opt, value);
}
const Option& OptionParser::lookup_long_opt(const string& opt) const {
list<string> matching;
for (optMap::const_iterator it = _optmap_l.begin(); it != _optmap_l.end(); ++it) {
if (it->first.compare(0, opt.length(), opt) == 0) {
matching.push_back(it->first);
if (it->first.length() == opt.length())
break;
}
}
if (matching.size() > 1) {
string x = str_join_trans(", ", matching.begin(), matching.end(), str_wrap("--", ""));
error(_("ambiguous option") + string(": --") + opt + " (" + x + "?)");
}
if (matching.size() == 0)
error(_("no such option") + string(": --") + opt);
return *_optmap_l.find(matching.front())->second;
}
void OptionParser::handle_long_opt(const string& optstr) {
_remaining.pop_front();
string opt, value;
size_t delim = optstr.find("=");
if (delim != string::npos) {
opt = optstr.substr(0, delim);
value = optstr.substr(delim+1);
} else
opt = optstr;
const Option& option = lookup_long_opt(opt);
if (option._nargs == 1 and delim == string::npos) {
if (not _remaining.empty()) {
value = _remaining.front();
_remaining.pop_front();
}
}
if (option._nargs == 1 and value == "")
error("--" + opt + " " + _("option requires an argument"));
process_opt(option, string("--") + opt, value);
}
Values& OptionParser::parse_args(const int argc, char const* const* const argv) {
if (prog() == "")
prog(basename(argv[0]));
return parse_args(&argv[1], &argv[argc]);
}
Values& OptionParser::parse_args(const vector<string>& v) {
_remaining.assign(v.begin(), v.end());
if (add_help_option()) {
add_option("-h", "--help") .action("help") .help(_("show this help message and exit"));
_opts.splice(_opts.begin(), _opts, --(_opts.end()));
}
if (add_version_option() and version() != "") {
add_option("--version") .action("version") .help(_("show program's version number and exit"));
_opts.splice(_opts.begin(), _opts, --(_opts.end()));
}
while (not _remaining.empty()) {
const string arg = _remaining.front();
if (arg == "--") {
_remaining.pop_front();
break;
}
if (arg.substr(0,2) == "--") {
handle_long_opt(arg.substr(2));
} else if (arg.substr(0,1) == "-" and arg.length() > 1) {
handle_short_opt(arg.substr(1,1), arg);
} else {
_remaining.pop_front();
_leftover.push_back(arg);
if (not interspersed_args())
break;
}
}
while (not _remaining.empty()) {
const string arg = _remaining.front();
_remaining.pop_front();
_leftover.push_back(arg);
}
for (list<Option>::const_iterator it = _opts.begin(); it != _opts.end(); ++it) {
if (it->get_default() != "" and not _values.is_set(it->dest()))
_values[it->dest()] = it->get_default();
}
for (list<OptionGroup const*>::iterator group_it = _groups.begin(); group_it != _groups.end(); ++group_it) {
for (list<Option>::const_iterator it = (*group_it)->_opts.begin(); it != (*group_it)->_opts.end(); ++it) {
if (it->get_default() != "" and not _values.is_set(it->dest()))
_values[it->dest()] = it->get_default();
}
}
return _values;
}
void OptionParser::process_opt(const Option& o, const string& opt, const string& value) {
if (o.action() == "store") {
string err = o.check_type(opt, value);
if (err != "")
error(err);
_values[o.dest()] = value;
_values.is_set_by_user(o.dest(), true);
}
else if (o.action() == "store_const") {
_values[o.dest()] = o.get_const();
_values.is_set_by_user(o.dest(), true);
}
else if (o.action() == "store_true") {
_values[o.dest()] = "1";
_values.is_set_by_user(o.dest(), true);
}
else if (o.action() == "store_false") {
_values[o.dest()] = "0";
_values.is_set_by_user(o.dest(), true);
}
else if (o.action() == "append") {
string err = o.check_type(opt, value);
if (err != "")
error(err);
_values[o.dest()] = value;
_values.all(o.dest()).push_back(value);
_values.is_set_by_user(o.dest(), true);
}
else if (o.action() == "append_const") {
_values[o.dest()] = o.get_const();
_values.all(o.dest()).push_back(o.get_const());
_values.is_set_by_user(o.dest(), true);
}
else if (o.action() == "count") {
_values[o.dest()] = str_inc(_values[o.dest()]);
_values.is_set_by_user(o.dest(), true);
}
else if (o.action() == "help") {
print_help();
std::exit(0);
}
else if (o.action() == "version") {
print_version();
std::exit(0);
}
else if (o.action() == "callback" && o.callback()) {
string err = o.check_type(opt, value);
if (err != "")
error(err);
(*o.callback())(o, opt, value, *this);
}
}
string OptionParser::format_help() const {
stringstream ss;
if (usage() != SUPPRESS_USAGE)
ss << get_usage() << endl;
if (description() != "")
ss << str_format(description(), 0, cols()) << endl;
ss << _("Options") << ":" << endl;
ss << format_option_help();
for (list<OptionGroup const*>::const_iterator it = _groups.begin(); it != _groups.end(); ++it) {
const OptionGroup& group = **it;
ss << endl << " " << group.title() << ":" << endl;
if (group.description() != "") {
unsigned int malus = 4; // Python seems to not use full length
ss << str_format(group.description(), 4, cols() - malus) << endl;
}
ss << group.format_option_help(4);
}
if (epilog() != "")
ss << endl << str_format(epilog(), 0, cols());
return ss.str();
}
void OptionParser::print_help() const {
cout << format_help();
}
void OptionParser::set_usage(const string& u) {
string lower = u;
transform(lower.begin(), lower.end(), lower.begin(), ::tolower);
if (lower.compare(0, 7, "usage: ") == 0)
_usage = u.substr(7);
else
_usage = u;
}
string OptionParser::format_usage(const string& u) const {
stringstream ss;
ss << _("Usage") << ": " << u << endl;
return ss.str();
}
string OptionParser::get_usage() const {
if (usage() == SUPPRESS_USAGE)
return string("");
return format_usage(str_replace(usage(), "%prog", prog()));
}
void OptionParser::print_usage(ostream& out) const {
string u = get_usage();
if (u != "")
out << u << endl;
}
void OptionParser::print_usage() const {
print_usage(cout);
}
string OptionParser::get_version() const {
return str_replace(_version, "%prog", prog());
}
void OptionParser::print_version(ostream& out) const {
out << get_version() << endl;
}
void OptionParser::print_version() const {
print_version(cout);
}
void OptionParser::exit() const {
std::exit(2);
}
void OptionParser::error(const string& msg) const {
print_usage(cerr);
cerr << prog() << ": " << _("error") << ": " << msg << endl;
exit();
}
////////// } class OptionParser //////////
////////// class Values { //////////
const string& Values::operator[] (const string& d) const {
strMap::const_iterator it = _map.find(d);
static const string empty = "";
return (it != _map.end()) ? it->second : empty;
}
void Values::is_set_by_user(const string& d, bool yes) {
if (yes)
_userSet.insert(d);
else
_userSet.erase(d);
}
////////// } class Values //////////
////////// class Option { //////////
string Option::check_type(const string& opt, const string& val) const {
istringstream ss(val);
stringstream err;
if (type() == "int" || type() == "long") {
long t;
if (not (ss >> t))
err << _("option") << " " << opt << ": " << _("invalid integer value") << ": '" << val << "'";
}
else if (type() == "float" || type() == "double") {
double t;
if (not (ss >> t))
err << _("option") << " " << opt << ": " << _("invalid floating-point value") << ": '" << val << "'";
}
else if (type() == "choice") {
if (find(choices().begin(), choices().end(), val) == choices().end()) {
list<string> tmp = choices();
transform(tmp.begin(), tmp.end(), tmp.begin(), str_wrap("'"));
err << _("option") << " " << opt << ": " << _("invalid choice") << ": '" << val << "'"
<< " (" << _("choose from") << " " << str_join(", ", tmp.begin(), tmp.end()) << ")";
}
}
else if (type() == "complex") {
complex<double> t;
if (not (ss >> t))
err << _("option") << " " << opt << ": " << _("invalid complex value") << ": '" << val << "'";
}
return err.str();
}
string Option::format_option_help(unsigned int indent /* = 2 */) const {
string mvar_short, mvar_long;
if (nargs() == 1) {
string mvar = metavar();
if (mvar == "") {
mvar = dest();
transform(mvar.begin(), mvar.end(), mvar.begin(), ::toupper);
}
mvar_short = " " + mvar;
mvar_long = "=" + mvar;
}
stringstream ss;
ss << string(indent, ' ');
if (not _short_opts.empty()) {
ss << str_join_trans(", ", _short_opts.begin(), _short_opts.end(), str_wrap("-", mvar_short));
if (not _long_opts.empty())
ss << ", ";
}
if (not _long_opts.empty())
ss << str_join_trans(", ", _long_opts.begin(), _long_opts.end(), str_wrap("--", mvar_long));
return ss.str();
}
string Option::format_help(unsigned int indent /* = 2 */) const {
stringstream ss;
string h = format_option_help(indent);
unsigned int width = cols();
unsigned int opt_width = min(width*3/10, 36u);
bool indent_first = false;
ss << h;
// if the option list is too long, start a new paragraph
if (h.length() >= (opt_width-1)) {
ss << endl;
indent_first = true;
} else {
ss << string(opt_width - h.length(), ' ');
if (help() == "")
ss << endl;
}
if (help() != "") {
string help_str = (get_default() != "") ? str_replace(help(), "%default", get_default()) : help();
if (type() == "choice") {
help_str = str_replace(help_str, "%choices", str_join("|", _choices.begin(), _choices.end()));
}
ss << str_format(help_str, opt_width, width, false, indent_first);
}
return ss.str();
}
Option& Option::action(const string& a) {
_action = a;
if (a == "store_const" || a == "store_true" || a == "store_false" ||
a == "append_const" || a == "count" || a == "help" || a == "version") {
nargs(0);
} else if (a == "callback") {
nargs(0);
type("");
}
return *this;
}
Option& Option::type(const std::string& t) {
_type = t;
nargs((t == "") ? 0 : 1);
return *this;
}
const std::string& Option::get_default() const {
strMap::const_iterator it = _parser._defaults.find(dest());
if (it != _parser._defaults.end())
return it->second;
else
return _default;
}
////////// } class Option //////////
}

278
Externals/cpp-optparse/OptionParser.h vendored Normal file
View File

@ -0,0 +1,278 @@
/**
* Copyright (C) 2010 Johannes Weißl <jargon@molb.org>
* License: MIT License
* URL: https://github.com/weisslj/cpp-optparse
*/
#ifndef OPTIONPARSER_H_
#define OPTIONPARSER_H_
#include <string>
#include <utility>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
namespace optparse {
class OptionParser;
class OptionGroup;
class Option;
class Values;
class Value;
class Callback;
typedef std::map<std::string,std::string> strMap;
typedef std::map<std::string,std::list<std::string> > lstMap;
typedef std::map<std::string,Option const*> optMap;
const char* const SUPPRESS_HELP = "SUPPRESS" "HELP";
const char* const SUPPRESS_USAGE = "SUPPRESS" "USAGE";
//! Class for automatic conversion from string -> anytype
class Value {
public:
Value() : str(), valid(false) {}
Value(const std::string& v) : str(v), valid(true) {}
operator const char*() { return str.c_str(); }
operator bool() { bool t; return (valid && (std::istringstream(str) >> t)) ? t : false; }
operator short() { short t; return (valid && (std::istringstream(str) >> t)) ? t : 0; }
operator unsigned short() { unsigned short t; return (valid && (std::istringstream(str) >> t)) ? t : 0; }
operator int() { int t; return (valid && (std::istringstream(str) >> t)) ? t : 0; }
operator unsigned int() { unsigned int t; return (valid && (std::istringstream(str) >> t)) ? t : 0; }
operator long() { long t; return (valid && (std::istringstream(str) >> t)) ? t : 0; }
operator unsigned long() { unsigned long t; return (valid && (std::istringstream(str) >> t)) ? t : 0; }
operator float() { float t; return (valid && (std::istringstream(str) >> t)) ? t : 0; }
operator double() { double t; return (valid && (std::istringstream(str) >> t)) ? t : 0; }
operator long double() { long double t; return (valid && (std::istringstream(str) >> t)) ? t : 0; }
private:
const std::string str;
bool valid;
};
class Values {
public:
Values() : _map() {}
const std::string& operator[] (const std::string& d) const;
std::string& operator[] (const std::string& d) { return _map[d]; }
bool is_set(const std::string& d) const { return _map.find(d) != _map.end(); }
bool is_set_by_user(const std::string& d) const { return _userSet.find(d) != _userSet.end(); }
void is_set_by_user(const std::string& d, bool yes);
Value get(const std::string& d) const { return (is_set(d)) ? Value((*this)[d]) : Value(); }
typedef std::list<std::string>::iterator iterator;
typedef std::list<std::string>::const_iterator const_iterator;
std::list<std::string>& all(const std::string& d) { return _appendMap[d]; }
const std::list<std::string>& all(const std::string& d) const { return _appendMap.find(d)->second; }
private:
strMap _map;
lstMap _appendMap;
std::set<std::string> _userSet;
};
class Option {
public:
Option(const OptionParser& p) :
_parser(p), _action("store"), _type("string"), _nargs(1), _callback(0) {}
virtual ~Option() {}
Option& action(const std::string& a);
Option& type(const std::string& t);
Option& dest(const std::string& d) { _dest = d; return *this; }
Option& set_default(const std::string& d) { _default = d; return *this; }
template<typename T>
Option& set_default(T t) { std::ostringstream ss; ss << t; _default = ss.str(); return *this; }
Option& nargs(size_t n) { _nargs = n; return *this; }
Option& set_const(const std::string& c) { _const = c; return *this; }
template<typename InputIterator>
Option& choices(InputIterator begin, InputIterator end) {
_choices.assign(begin, end); type("choice"); return *this;
}
Option& choices(std::initializer_list<std::string> ilist) {
_choices.assign(ilist); type("choice"); return *this;
}
Option& help(const std::string& h) { _help = h; return *this; }
Option& metavar(const std::string& m) { _metavar = m; return *this; }
Option& callback(Callback& c) { _callback = &c; return *this; }
const std::string& action() const { return _action; }
const std::string& type() const { return _type; }
const std::string& dest() const { return _dest; }
const std::string& get_default() const;
size_t nargs() const { return _nargs; }
const std::string& get_const() const { return _const; }
const std::list<std::string>& choices() const { return _choices; }
const std::string& help() const { return _help; }
const std::string& metavar() const { return _metavar; }
Callback* callback() const { return _callback; }
private:
std::string check_type(const std::string& opt, const std::string& val) const;
std::string format_option_help(unsigned int indent = 2) const;
std::string format_help(unsigned int indent = 2) const;
const OptionParser& _parser;
std::set<std::string> _short_opts;
std::set<std::string> _long_opts;
std::string _action;
std::string _type;
std::string _dest;
std::string _default;
size_t _nargs;
std::string _const;
std::list<std::string> _choices;
std::string _help;
std::string _metavar;
Callback* _callback;
friend class OptionContainer;
friend class OptionParser;
};
class OptionContainer {
public:
OptionContainer(const std::string& d = "") : _description(d) {}
virtual ~OptionContainer() {}
virtual OptionContainer& description(const std::string& d) { _description = d; return *this; }
virtual const std::string& description() const { return _description; }
Option& add_option(const std::string& opt);
Option& add_option(const std::string& opt1, const std::string& opt2);
Option& add_option(const std::string& opt1, const std::string& opt2, const std::string& opt3);
Option& add_option(const std::vector<std::string>& opt);
std::string format_option_help(unsigned int indent = 2) const;
protected:
std::string _description;
std::list<Option> _opts;
optMap _optmap_s;
optMap _optmap_l;
private:
virtual const OptionParser& get_parser() = 0;
};
class OptionParser : public OptionContainer {
public:
OptionParser();
virtual ~OptionParser() {}
OptionParser& usage(const std::string& u) { set_usage(u); return *this; }
OptionParser& version(const std::string& v) { _version = v; return *this; }
OptionParser& description(const std::string& d) { _description = d; return *this; }
OptionParser& add_help_option(bool h) { _add_help_option = h; return *this; }
OptionParser& add_version_option(bool v) { _add_version_option = v; return *this; }
OptionParser& prog(const std::string& p) { _prog = p; return *this; }
OptionParser& epilog(const std::string& e) { _epilog = e; return *this; }
OptionParser& set_defaults(const std::string& dest, const std::string& val) {
_defaults[dest] = val; return *this;
}
template<typename T>
OptionParser& set_defaults(const std::string& dest, T t) { std::ostringstream ss; ss << t; _defaults[dest] = ss.str(); return *this; }
OptionParser& enable_interspersed_args() { _interspersed_args = true; return *this; }
OptionParser& disable_interspersed_args() { _interspersed_args = false; return *this; }
OptionParser& add_option_group(const OptionGroup& group);
const std::string& usage() const { return _usage; }
const std::string& version() const { return _version; }
const std::string& description() const { return _description; }
bool add_help_option() const { return _add_help_option; }
bool add_version_option() const { return _add_version_option; }
const std::string& prog() const { return _prog; }
const std::string& epilog() const { return _epilog; }
bool interspersed_args() const { return _interspersed_args; }
Values& parse_args(int argc, char const* const* argv);
Values& parse_args(const std::vector<std::string>& args);
template<typename InputIterator>
Values& parse_args(InputIterator begin, InputIterator end) {
return parse_args(std::vector<std::string>(begin, end));
}
const std::list<std::string>& args() const { return _leftover; }
std::vector<std::string> args() {
return std::vector<std::string>(_leftover.begin(), _leftover.end());
}
std::string format_help() const;
void print_help() const;
void set_usage(const std::string& u);
std::string get_usage() const;
void print_usage(std::ostream& out) const;
void print_usage() const;
std::string get_version() const;
void print_version(std::ostream& out) const;
void print_version() const;
void error(const std::string& msg) const;
void exit() const;
private:
const OptionParser& get_parser() { return *this; }
const Option& lookup_short_opt(const std::string& opt) const;
const Option& lookup_long_opt(const std::string& opt) const;
void handle_short_opt(const std::string& opt, const std::string& arg);
void handle_long_opt(const std::string& optstr);
void process_opt(const Option& option, const std::string& opt, const std::string& value);
std::string format_usage(const std::string& u) const;
std::string _usage;
std::string _version;
bool _add_help_option;
bool _add_version_option;
std::string _prog;
std::string _epilog;
bool _interspersed_args;
Values _values;
strMap _defaults;
std::list<OptionGroup const*> _groups;
std::list<std::string> _remaining;
std::list<std::string> _leftover;
friend class Option;
};
class OptionGroup : public OptionContainer {
public:
OptionGroup(const OptionParser& p, const std::string& t, const std::string& d = "") :
OptionContainer(d), _parser(p), _title(t) {}
virtual ~OptionGroup() {}
OptionGroup& title(const std::string& t) { _title = t; return *this; }
const std::string& title() const { return _title; }
private:
const OptionParser& get_parser() { return _parser; }
const OptionParser& _parser;
std::string _title;
friend class OptionParser;
};
class Callback {
public:
virtual void operator() (const Option& option, const std::string& opt, const std::string& val, const OptionParser& parser) = 0;
virtual ~Callback() {}
};
}
#endif

View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{C636D9D1-82FE-42B5-9987-63B7D4836341}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\Source\VSProps\Base.props" />
<Import Project="..\..\Source\VSProps\ClDisableAllWarnings.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile />
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile />
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="OptionParser.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="OptionParser.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="OptionParser.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="OptionParser.h" />
</ItemGroup>
</Project>

View File

@ -91,7 +91,7 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(WXLIBS ${WXLIBS} dl) set(WXLIBS ${WXLIBS} dl)
endif() endif()
list(APPEND LIBS core uicommon) list(APPEND LIBS core uicommon cpp-optparse)
if(APPLE) if(APPLE)
if(wxWidgets_FOUND) if(wxWidgets_FOUND)

View File

@ -48,8 +48,9 @@
<ResourceCompile> <ResourceCompile>
<AdditionalIncludeDirectories>$(ExternalsDir)wxWidgets3\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ExternalsDir)wxWidgets3\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile> </ResourceCompile>
<ClCompile /> <ClCompile>
<ClCompile /> <AdditionalIncludeDirectories>$(ExternalsDir)cpp-optparse;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Manifest> <Manifest>
<AdditionalManifestFiles>DolphinWX.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles> <AdditionalManifestFiles>DolphinWX.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest> </Manifest>
@ -228,6 +229,9 @@
<ProjectReference Include="$(ExternalsDir)Bochs_disasm\Bochs_disasm.vcxproj"> <ProjectReference Include="$(ExternalsDir)Bochs_disasm\Bochs_disasm.vcxproj">
<Project>{8ada04d7-6db1-4da4-ab55-64fb12a0997b}</Project> <Project>{8ada04d7-6db1-4da4-ab55-64fb12a0997b}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="$(ExternalsDir)cpp-optparse\cpp-optparse.vcxproj">
<Project>{C636D9D1-82FE-42B5-9987-63B7D4836341}</Project>
</ProjectReference>
<ProjectReference Include="$(ExternalsDir)libpng\png\png.vcxproj"> <ProjectReference Include="$(ExternalsDir)libpng\png\png.vcxproj">
<Project>{4c9f135b-a85e-430c-bad4-4c67ef5fc12c}</Project> <Project>{4c9f135b-a85e-430c-bad4-4c67ef5fc12c}</Project>
</ProjectReference> </ProjectReference>

View File

@ -2,6 +2,7 @@
// Licensed under GPLv2+ // Licensed under GPLv2+
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <OptionParser.h>
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>
#include <mutex> #include <mutex>
@ -47,6 +48,7 @@
#include "DolphinWX/VideoConfigDiag.h" #include "DolphinWX/VideoConfigDiag.h"
#include "DolphinWX/WxUtils.h" #include "DolphinWX/WxUtils.h"
#include "UICommon/CommandLineParse.h"
#include "UICommon/UICommon.h" #include "UICommon/UICommon.h"
#include "VideoCommon/VideoBackendBase.h" #include "VideoCommon/VideoBackendBase.h"
@ -77,6 +79,11 @@ bool DolphinApp::Initialize(int& c, wxChar** v)
// The 'main program' equivalent that creates the main window and return the main frame // The 'main program' equivalent that creates the main window and return the main frame
void DolphinApp::OnInitCmdLine(wxCmdLineParser& parser)
{
parser.SetCmdLine("");
}
bool DolphinApp::OnInit() bool DolphinApp::OnInit()
{ {
std::lock_guard<std::mutex> lk(s_init_mutex); std::lock_guard<std::mutex> lk(s_init_mutex);
@ -96,6 +103,8 @@ bool DolphinApp::OnInit()
wxHandleFatalExceptions(true); wxHandleFatalExceptions(true);
#endif #endif
ParseCommandLine();
UICommon::SetUserDirectory(m_user_path.ToStdString()); UICommon::SetUserDirectory(m_user_path.ToStdString());
UICommon::CreateDirectories(); UICommon::CreateDirectories();
InitLanguageSupport(); // The language setting is loaded from the user directory InitLanguageSupport(); // The language setting is loaded from the user directory
@ -130,60 +139,41 @@ bool DolphinApp::OnInit()
return true; return true;
} }
void DolphinApp::OnInitCmdLine(wxCmdLineParser& parser) void DolphinApp::ParseCommandLine()
{ {
static const wxCmdLineEntryDesc desc[] = { auto parser = CommandLineParse::CreateParser(CommandLineParse::ParserOptions::IncludeGUIOptions);
{wxCMD_LINE_SWITCH, "h", "help", "Show this help message", wxCMD_LINE_VAL_NONE, optparse::Values& options = CommandLineParse::ParseArguments(parser.get(), argc, argv);
wxCMD_LINE_OPTION_HELP}, std::vector<std::string> args = parser->args();
{wxCMD_LINE_SWITCH, "d", "debugger", "Opens the debugger", wxCMD_LINE_VAL_NONE,
wxCMD_LINE_PARAM_OPTIONAL},
{wxCMD_LINE_SWITCH, "l", "logger", "Opens the logger", wxCMD_LINE_VAL_NONE,
wxCMD_LINE_PARAM_OPTIONAL},
{wxCMD_LINE_OPTION, "e", "exec",
"Loads the specified file (ELF, DOL, GCM, ISO, TGC, WBFS, CISO, GCZ, WAD)",
wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL},
{wxCMD_LINE_SWITCH, "b", "batch", "Exit Dolphin with emulator", wxCMD_LINE_VAL_NONE,
wxCMD_LINE_PARAM_OPTIONAL},
{wxCMD_LINE_OPTION, "c", "confirm", "Set Confirm on Stop", wxCMD_LINE_VAL_STRING,
wxCMD_LINE_PARAM_OPTIONAL},
{wxCMD_LINE_OPTION, "v", "video_backend", "Specify a video backend", wxCMD_LINE_VAL_STRING,
wxCMD_LINE_PARAM_OPTIONAL},
{wxCMD_LINE_OPTION, "a", "audio_emulation", "Low level (LLE) or high level (HLE) audio",
wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL},
{wxCMD_LINE_OPTION, "m", "movie", "Play a movie file", wxCMD_LINE_VAL_STRING,
wxCMD_LINE_PARAM_OPTIONAL},
{wxCMD_LINE_OPTION, "u", "user", "User folder path", wxCMD_LINE_VAL_STRING,
wxCMD_LINE_PARAM_OPTIONAL},
{wxCMD_LINE_NONE, nullptr, nullptr, nullptr, wxCMD_LINE_VAL_NONE, 0}};
parser.SetDesc(desc); if (options.is_set("exec"))
}
bool DolphinApp::OnCmdLineParsed(wxCmdLineParser& parser)
{
if (argc == 2 && File::Exists(argv[1].ToUTF8().data()))
{ {
m_load_file = true; m_load_file = true;
m_file_to_load = argv[1]; m_file_to_load = static_cast<const char*>(options.get("exec"));
} }
else if (parser.Parse() != 0) else if (args.size())
{ {
return false; m_load_file = true;
m_file_to_load = args.front();
args.erase(args.begin());
} }
if (!m_load_file) m_use_debugger = options.is_set("debugger");
m_load_file = parser.Found("exec", &m_file_to_load); m_use_logger = options.is_set("logger");
m_batch_mode = options.is_set("batch");
m_use_debugger = parser.Found("debugger"); m_confirm_stop = options.is_set("confirm");
m_use_logger = parser.Found("logger"); m_confirm_setting = options.get("confirm");
m_batch_mode = parser.Found("batch");
m_confirm_stop = parser.Found("confirm", &m_confirm_setting);
m_select_video_backend = parser.Found("video_backend", &m_video_backend_name);
m_select_audio_emulation = parser.Found("audio_emulation", &m_audio_emulation_name);
m_play_movie = parser.Found("movie", &m_movie_file);
parser.Found("user", &m_user_path);
return true; m_select_video_backend = options.is_set("video_backend");
m_video_backend_name = static_cast<const char*>(options.get("video_backend"));
m_select_audio_emulation = options.is_set("audio_emulation");
m_audio_emulation_name = static_cast<const char*>(options.get("audio_emulation"));
m_play_movie = options.is_set("movie");
m_movie_file = static_cast<const char*>(options.get("movie"));
m_user_path = static_cast<const char*>(options.get("user"));
} }
#ifdef __APPLE__ #ifdef __APPLE__
@ -224,12 +214,7 @@ void DolphinApp::AfterInit()
} }
if (m_confirm_stop) if (m_confirm_stop)
{ SConfig::GetInstance().bConfirmStop = m_confirm_setting;
if (m_confirm_setting.Upper() == "TRUE")
SConfig::GetInstance().bConfirmStop = true;
else if (m_confirm_setting.Upper() == "FALSE")
SConfig::GetInstance().bConfirmStop = false;
}
if (m_play_movie && !m_movie_file.empty()) if (m_play_movie && !m_movie_file.empty())
{ {

View File

@ -8,6 +8,7 @@
#include <wx/app.h> #include <wx/app.h>
class CFrame; class CFrame;
class wxCmdLineParser;
class wxLocale; class wxLocale;
extern CFrame* main_frame; extern CFrame* main_frame;
@ -21,9 +22,8 @@ public:
private: private:
bool OnInit() override; bool OnInit() override;
int OnExit() override;
void OnInitCmdLine(wxCmdLineParser& parser) override; void OnInitCmdLine(wxCmdLineParser& parser) override;
bool OnCmdLineParsed(wxCmdLineParser& parser) override; int OnExit() override;
void OnFatalException() override; void OnFatalException() override;
bool Initialize(int& c, wxChar** v) override; bool Initialize(int& c, wxChar** v) override;
@ -37,6 +37,8 @@ private:
void OnActivate(wxActivateEvent& ev); void OnActivate(wxActivateEvent& ev);
void OnIdle(wxIdleEvent&); void OnIdle(wxIdleEvent&);
void ParseCommandLine();
bool m_batch_mode = false; bool m_batch_mode = false;
bool m_confirm_stop = false; bool m_confirm_stop = false;
bool m_is_active = true; bool m_is_active = true;
@ -46,7 +48,7 @@ private:
bool m_use_logger = false; bool m_use_logger = false;
bool m_select_video_backend = false; bool m_select_video_backend = false;
bool m_select_audio_emulation = false; bool m_select_audio_emulation = false;
wxString m_confirm_setting; bool m_confirm_setting;
wxString m_video_backend_name; wxString m_video_backend_name;
wxString m_audio_emulation_name; wxString m_audio_emulation_name;
wxString m_user_path; wxString m_user_path;

View File

@ -2,10 +2,10 @@
// Licensed under GPLv2+ // Licensed under GPLv2+
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <OptionParser.h>
#include <cstddef> #include <cstddef>
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>
#include <getopt.h>
#include <signal.h> #include <signal.h>
#include <string> #include <string>
#include <thread> #include <thread>
@ -29,6 +29,7 @@
#include "Core/IOS/USB/Bluetooth/WiimoteDevice.h" #include "Core/IOS/USB/Bluetooth/WiimoteDevice.h"
#include "Core/State.h" #include "Core/State.h"
#include "UICommon/CommandLineParse.h"
#include "UICommon/UICommon.h" #include "UICommon/UICommon.h"
#include "VideoCommon/RenderBase.h" #include "VideoCommon/RenderBase.h"
@ -379,37 +380,24 @@ static Platform* GetPlatform()
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
int ch, help = 0; std::string boot_filename;
struct option longopts[] = {{"exec", no_argument, nullptr, 'e'}, auto parser = CommandLineParse::CreateParser(CommandLineParse::ParserOptions::OmitGUIOptions);
{"help", no_argument, nullptr, 'h'}, optparse::Values& options = CommandLineParse::ParseArguments(parser.get(), argc, argv);
{"version", no_argument, nullptr, 'v'}, std::vector<std::string> args = parser->args();
{nullptr, 0, nullptr, 0}};
while ((ch = getopt_long(argc, argv, "eh?v", longopts, 0)) != -1) if (options.is_set("exec"))
{ {
switch (ch) boot_filename = static_cast<const char*>(options.get("exec"));
{
case 'e':
break;
case 'h':
case '?':
help = 1;
break;
case 'v':
fprintf(stderr, "%s\n", scm_rev_str.c_str());
return 1;
}
} }
else if (args.size())
if (help == 1 || argc == optind)
{ {
fprintf(stderr, "%s\n\n", scm_rev_str.c_str()); boot_filename = args.front();
fprintf(stderr, "A multi-platform GameCube/Wii emulator\n\n"); args.erase(args.begin());
fprintf(stderr, "Usage: %s [-e <file>] [-h] [-v]\n", argv[0]); }
fprintf(stderr, " -e, --exec Load the specified file\n"); else
fprintf(stderr, " -h, --help Show this help message\n"); {
fprintf(stderr, " -v, --version Print version and exit\n"); parser->print_help();
return 1; return 0;
} }
platform = GetPlatform(); platform = GetPlatform();
@ -435,9 +423,9 @@ int main(int argc, char* argv[])
DolphinAnalytics::Instance()->ReportDolphinStart("nogui"); DolphinAnalytics::Instance()->ReportDolphinStart("nogui");
if (!BootManager::BootCore(argv[optind])) if (!BootManager::BootCore(boot_filename))
{ {
fprintf(stderr, "Could not boot %s\n", argv[optind]); fprintf(stderr, "Could not boot %s\n", boot_filename.c_str());
return 1; return 1;
} }

View File

@ -1,8 +1,9 @@
set(SRCS Disassembler.cpp set(SRCS CommandLineParse.cpp
Disassembler.cpp
UICommon.cpp UICommon.cpp
USBUtils.cpp) USBUtils.cpp)
set(LIBS common) set(LIBS common cpp-optparse)
if(LIBUSB_FOUND) if(LIBUSB_FOUND)
set(LIBS ${LIBS} ${LIBUSB_LIBRARIES}) set(LIBS ${LIBS} ${LIBUSB_LIBRARIES})
endif() endif()

View File

@ -0,0 +1,48 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <OptionParser.h>
#include "Common/Common.h"
#include "UICommon/CommandLineParse.h"
namespace CommandLineParse
{
std::unique_ptr<optparse::OptionParser> CreateParser(ParserOptions options)
{
auto parser = std::make_unique<optparse::OptionParser>();
parser->usage("usage: %prog [options]... [FILE]...").version(scm_rev_str);
parser->add_option("--version").action("version").help("Print version and exit");
parser->add_option("-u", "--user").action("store").help("User folder path");
parser->add_option("-m", "--movie").action("store").help("Play a movie file");
parser->add_option("-e", "--exec")
.action("store")
.metavar("<file>")
.type("string")
.help("Load the specified file");
if (options == ParserOptions::IncludeGUIOptions)
{
parser->add_option("-d", "--debugger").action("store_true").help("Opens the debuger");
parser->add_option("-l", "--logger").action("store_true").help("Opens the logger");
parser->add_option("-b", "--batch").action("store_true").help("Exit Dolphin with emulation");
parser->add_option("-c", "--confirm").action("store_true").help("Set Confirm on Stop");
}
// XXX: These two are setting configuration options
parser->add_option("-v", "--video_backend").action("store").help("Specify a video backend");
parser->add_option("-a", "--audio_emulation")
.choices({"HLE", "LLE"})
.help("Choose audio emulation from [%choices]");
return parser;
}
optparse::Values& ParseArguments(optparse::OptionParser* parser, int argc, char** argv)
{
return parser->parse_args(argc, argv);
}
}

View File

@ -0,0 +1,23 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <memory>
namespace optparse
{
class OptionParser;
class Values;
}
namespace CommandLineParse
{
enum class ParserOptions
{
IncludeGUIOptions,
OmitGUIOptions,
};
std::unique_ptr<optparse::OptionParser> CreateParser(ParserOptions options);
optparse::Values& ParseArguments(optparse::OptionParser* parser, int argc, char** argv);
}

View File

@ -34,6 +34,16 @@
<Import Project="..\..\VSProps\PCHUse.props" /> <Import Project="..\..\VSProps\PCHUse.props" />
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<AdditionalIncludeDirectories>$(ExternalsDir)zlib;$(ExternalsDir)cpp-optparse;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>$(ExternalsDir)zlib;$(ExternalsDir)cpp-optparse;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<Text Include="CMakeLists.txt" /> <Text Include="CMakeLists.txt" />
</ItemGroup> </ItemGroup>
@ -43,6 +53,7 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="CommandLineParse.cpp" />
<ClCompile Include="UICommon.cpp" /> <ClCompile Include="UICommon.cpp" />
<ClCompile Include="Disassembler.cpp" /> <ClCompile Include="Disassembler.cpp" />
<ClCompile Include="USBUtils.cpp"> <ClCompile Include="USBUtils.cpp">
@ -50,10 +61,16 @@
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="CommandLineParse.h" />
<ClInclude Include="UICommon.h" /> <ClInclude Include="UICommon.h" />
<ClInclude Include="Disassembler.h" /> <ClInclude Include="Disassembler.h" />
<ClInclude Include="USBUtils.h" /> <ClInclude Include="USBUtils.h" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="$(ExternalsDir)cpp-optparse\cpp-optparse.vcxproj">
<Project>{C636D9D1-82FE-42B5-9987-63B7D4836341}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>

View File

@ -80,6 +80,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DolphinQt2", "Core\DolphinQ
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glslang", "..\Externals\glslang\glslang.vcxproj", "{D178061B-84D3-44F9-BEED-EFD18D9033F0}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glslang", "..\Externals\glslang\glslang.vcxproj", "{D178061B-84D3-44F9-BEED-EFD18D9033F0}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp-optparse", "..\Externals\cpp-optparse\cpp-optparse.vcxproj", "{C636D9D1-82FE-42B5-9987-63B7D4836341}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64 Debug|x64 = Debug|x64
@ -230,6 +232,10 @@ Global
{D178061B-84D3-44F9-BEED-EFD18D9033F0}.Debug|x64.Build.0 = Debug|x64 {D178061B-84D3-44F9-BEED-EFD18D9033F0}.Debug|x64.Build.0 = Debug|x64
{D178061B-84D3-44F9-BEED-EFD18D9033F0}.Release|x64.ActiveCfg = Release|x64 {D178061B-84D3-44F9-BEED-EFD18D9033F0}.Release|x64.ActiveCfg = Release|x64
{D178061B-84D3-44F9-BEED-EFD18D9033F0}.Release|x64.Build.0 = Release|x64 {D178061B-84D3-44F9-BEED-EFD18D9033F0}.Release|x64.Build.0 = Release|x64
{C636D9D1-82FE-42B5-9987-63B7D4836341}.Debug|x64.ActiveCfg = Debug|x64
{C636D9D1-82FE-42B5-9987-63B7D4836341}.Debug|x64.Build.0 = Debug|x64
{C636D9D1-82FE-42B5-9987-63B7D4836341}.Release|x64.ActiveCfg = Release|x64
{C636D9D1-82FE-42B5-9987-63B7D4836341}.Release|x64.Build.0 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -266,5 +272,6 @@ Global
{BB00605C-125F-4A21-B33B-7BF418322DCB} = {87ADDFF9-5768-4DA2-A33B-2477593D6677} {BB00605C-125F-4A21-B33B-7BF418322DCB} = {87ADDFF9-5768-4DA2-A33B-2477593D6677}
{570215B7-E32F-4438-95AE-C8D955F9FCA3} = {AAD1BCD6-9804-44A5-A5FC-4782EA00E9D4} {570215B7-E32F-4438-95AE-C8D955F9FCA3} = {AAD1BCD6-9804-44A5-A5FC-4782EA00E9D4}
{D178061B-84D3-44F9-BEED-EFD18D9033F0} = {87ADDFF9-5768-4DA2-A33B-2477593D6677} {D178061B-84D3-44F9-BEED-EFD18D9033F0} = {87ADDFF9-5768-4DA2-A33B-2477593D6677}
{C636D9D1-82FE-42B5-9987-63B7D4836341} = {87ADDFF9-5768-4DA2-A33B-2477593D6677}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal