diff options
author | Jose <jose@zeroc.com> | 2015-04-13 14:58:28 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2015-04-13 14:58:28 +0200 |
commit | 8cff2a828400acb3769b7b05452ac267725086eb (patch) | |
tree | 3735ea75f8890fcec71909b0ce4cc616bd14d30a /cpp/src/slice2cpp | |
parent | ICE-6445 Remove .NET CF support (diff) | |
download | ice-8cff2a828400acb3769b7b05452ac267725086eb.tar.bz2 ice-8cff2a828400acb3769b7b05452ac267725086eb.tar.xz ice-8cff2a828400acb3769b7b05452ac267725086eb.zip |
Add --depend-file/--depend-xml optinos to all Slice compilers
Diffstat (limited to 'cpp/src/slice2cpp')
-rw-r--r-- | cpp/src/slice2cpp/Main.cpp | 42 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Makefile | 2 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Makefile.mak | 2 |
3 files changed, 40 insertions, 6 deletions
diff --git a/cpp/src/slice2cpp/Main.cpp b/cpp/src/slice2cpp/Main.cpp index 5fa6d6d247d..ec4cf798797 100644 --- a/cpp/src/slice2cpp/Main.cpp +++ b/cpp/src/slice2cpp/Main.cpp @@ -11,11 +11,15 @@ #include <IceUtil/CtrlCHandler.h> #include <IceUtil/Mutex.h> #include <IceUtil/MutexPtrLock.h> +#include <IceUtil/FileUtil.h> #include <Slice/Preprocessor.h> #include <Slice/FileTracker.h> #include <Slice/Util.h> #include "Gen.h" +#include <iostream> +#include <fstream> + using namespace std; using namespace Slice; @@ -74,6 +78,8 @@ usage(const char* n) "--dll-export SYMBOL Use SYMBOL for DLL exports.\n" "--impl Generate sample implementations.\n" "--depend Generate Makefile dependencies.\n" + "--depend-xml Generate dependencies in XML format.\n" + "--depend-file FILE Write dependencies to FILE instead of standard output.\n" "-d, --debug Print debug messages.\n" "--ice Permit `Ice' prefix (for building Ice source code only).\n" "--underscore Permit underscores in Slice identifiers.\n" @@ -100,7 +106,8 @@ compile(int argc, char* argv[]) opts.addOpt("", "dll-export", IceUtilInternal::Options::NeedArg); opts.addOpt("", "impl"); opts.addOpt("", "depend"); - opts.addOpt("", "depend-header"); + opts.addOpt("", "depend-xml"); + opts.addOpt("", "depend-file", IceUtilInternal::Options::NeedArg, ""); opts.addOpt("d", "debug"); opts.addOpt("", "ice"); opts.addOpt("", "underscore"); @@ -168,6 +175,10 @@ compile(int argc, char* argv[]) bool depend = opts.isSet("depend"); + bool dependxml = opts.isSet("depend-xml"); + + string dependFile = opts.optArg("depend-file"); + bool debug = opts.isSet("debug"); bool ice = opts.isSet("ice"); @@ -185,11 +196,24 @@ compile(int argc, char* argv[]) return EXIT_FAILURE; } + if(depend && dependxml) + { + getErrorStream() << argv[0] << ": error: cannot specify both --depend and --dependxml" << endl; + usage(argv[0]); + return EXIT_FAILURE; + } + int status = EXIT_SUCCESS; IceUtil::CtrlCHandler ctrlCHandler; ctrlCHandler.setCallback(interruptedCallback); + DependOutputUtil out(dependFile); + if(dependxml) + { + out.os() << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<dependencies>" << endl; + } + for(vector<string>::const_iterator i = args.begin(); i != args.end(); ++i) { // @@ -201,13 +225,14 @@ compile(int argc, char* argv[]) continue; } - if(depend) + if(depend || dependxml) { PreprocessorPtr icecpp = Preprocessor::create(argv[0], *i, cppArgs); FILE* cppHandle = icecpp->preprocess(false, "-D__SLICE2CPP__"); if(cppHandle == 0) { + out.cleanup(); return EXIT_FAILURE; } @@ -217,17 +242,20 @@ compile(int argc, char* argv[]) if(parseStatus == EXIT_FAILURE) { + out.cleanup(); return EXIT_FAILURE; } - if(!icecpp->printMakefileDependencies(Preprocessor::CPlusPlus, includePaths, - "-D__SLICE2CPP__", sourceExtension, headerExtension)) + if(!icecpp->printMakefileDependencies(out.os(), depend ? Preprocessor::CPlusPlus : Preprocessor::SliceXML, + includePaths, "-D__SLICE2CPP__", sourceExtension, headerExtension)) { + out.cleanup(); return EXIT_FAILURE; } if(!icecpp->close()) { + out.cleanup(); return EXIT_FAILURE; } } @@ -299,12 +327,18 @@ compile(int argc, char* argv[]) if(interrupted) { + out.cleanup(); FileTracker::instance()->cleanup(); return EXIT_FAILURE; } } } + if(dependxml) + { + out.os() << "</dependencies>\n"; + } + return status; } diff --git a/cpp/src/slice2cpp/Makefile b/cpp/src/slice2cpp/Makefile index 531ab86d408..c774b2ab70e 100644 --- a/cpp/src/slice2cpp/Makefile +++ b/cpp/src/slice2cpp/Makefile @@ -20,7 +20,7 @@ RPATH_DIR = $(LOADER_PATH)/../$(libsubdir) include $(top_srcdir)/config/Make.rules -CPPFLAGS := -I. $(CPPFLAGS) +CPPFLAGS := -I. -I.. $(CPPFLAGS) $(NAME): $(OBJS) rm -f $@ diff --git a/cpp/src/slice2cpp/Makefile.mak b/cpp/src/slice2cpp/Makefile.mak index 94610b26905..91f7c77e160 100644 --- a/cpp/src/slice2cpp/Makefile.mak +++ b/cpp/src/slice2cpp/Makefile.mak @@ -18,7 +18,7 @@ OBJS = .\Gen.obj \ !include $(top_srcdir)/config/Make.rules.mak -CPPFLAGS = -I. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN +CPPFLAGS = -I. -I.. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN !if "$(GENERATE_PDB)" == "yes" PDBFLAGS = /pdb:$(NAME:.exe=.pdb) |