From: Christoph Egger Date: Wed, 19 Nov 2014 15:46:36 +0000 (+0100) Subject: Make commandline parser optional to build against cip qt 5.1 X-Git-Tag: v0.1~170 X-Git-Url: https://git.siccegge.de//index.cgi?p=frida%2Ffrida.git;a=commitdiff_plain;h=ade1d271328d2153876eb208d10a4525c962951b;hp=181d12ec9311d9bb216f18b7774ed1d621fdc4ed Make commandline parser optional to build against cip qt 5.1 --- diff --git a/src/main.cxx b/src/main.cxx index 80e06ce..ebb85e8 100644 --- a/src/main.cxx +++ b/src/main.cxx @@ -4,7 +4,13 @@ #include #include +#if QT_VERSION > QT_VERSION_CHECK(5, 2, 0) +#define ARGPARSE +#endif + +#ifdef ARGPARSE #include +#endif #include #include "log4cxx/logger.h" @@ -23,15 +29,19 @@ int main(int argc, char** argv) log4cxx::BasicConfigurator::configure(); log4cxx::LoggerPtr _logger(log4cxx::Logger::getLogger("main")); +#ifdef ARGPARSE QCommandLineParser parser; +#endif QApplication::setApplicationName("frida"); +#ifdef ARGPARSE parser.addHelpOption(); parser.addVersionOption(); parser.addPositionalArgument("filename", QCoreApplication::translate("main", "File to disassemble.")); parser.process(app); +#endif LOG4CXX_DEBUG(_logger, "Initializing LLVM"); llvm::InitializeAllTargetInfos(); @@ -41,12 +51,12 @@ int main(int argc, char** argv) LOG4CXX_DEBUG(_logger, "Initializing Qt"); - std::string filename; - if (parser.positionalArguments().isEmpty()) { - filename = ""; - } else { + std::string filename = ""; +#ifdef ARGPARSE + if (! parser.positionalArguments().isEmpty()) { filename = parser.positionalArguments().at(0).toStdString(); } +#endif Mainwindow m(filename); m.show();