From ade1d271328d2153876eb208d10a4525c962951b Mon Sep 17 00:00:00 2001 From: Christoph Egger Date: Wed, 19 Nov 2014 16:46:36 +0100 Subject: [PATCH] Make commandline parser optional to build against cip qt 5.1 --- src/main.cxx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) 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(); -- 2.39.5