Mercurial > projects > qtd
comparison generator/main.cpp @ 4:0a29ce1ae854
CMake build script.
Small fixes in examples.
author | SokoL_SD |
---|---|
date | Wed, 13 May 2009 19:01:55 +0000 |
parents | e78566595089 |
children | 6cd923119ab1 |
comparison
equal
deleted
inserted
replaced
3:323efbe5c2f7 | 4:0a29ce1ae854 |
---|---|
73 | 73 |
74 QString fileName; | 74 QString fileName; |
75 QString typesystemFileName; | 75 QString typesystemFileName; |
76 QString pp_file = ".preprocessed.tmp"; | 76 QString pp_file = ".preprocessed.tmp"; |
77 QStringList rebuild_classes; | 77 QStringList rebuild_classes; |
78 QString source_dir; | |
78 | 79 |
79 QMap<QString, QString> args; | 80 QMap<QString, QString> args; |
80 | 81 |
81 int argNum = 0; | 82 int argNum = 0; |
82 for (int i=1; i<argc; ++i) { | 83 for (int i=1; i<argc; ++i) { |
148 fprintf(stderr, "D target '%s' is not recognized", qPrintable(dTarget)); | 149 fprintf(stderr, "D target '%s' is not recognized", qPrintable(dTarget)); |
149 return 1; | 150 return 1; |
150 } | 151 } |
151 } | 152 } |
152 | 153 |
154 source_dir = args.value("source-directory"); | |
153 fileName = args.value("arg-1"); | 155 fileName = args.value("arg-1"); |
156 if (!source_dir.isEmpty()) | |
157 { | |
158 fileName = source_dir + "/" + fileName; | |
159 } | |
154 | 160 |
155 typesystemFileName = args.value("arg-2"); | 161 typesystemFileName = args.value("arg-2"); |
156 if (args.contains("arg-3")) | 162 if (args.contains("arg-3")) |
157 displayHelp(gs); | 163 displayHelp(gs); |
158 | 164 |
170 | 176 |
171 cpp_shared = args.contains("cpp_shared"); | 177 cpp_shared = args.contains("cpp_shared"); |
172 | 178 |
173 printf("Running the QtD Generator. Please wait while source files are being generated...\n"); | 179 printf("Running the QtD Generator. Please wait while source files are being generated...\n"); |
174 | 180 |
175 if (!TypeDatabase::instance()->parseFile(typesystemFileName)) | 181 if (!TypeDatabase::instance()->parseFile(typesystemFileName, source_dir)) |
176 qFatal("Cannot parse file: '%s'", qPrintable(typesystemFileName)); | 182 qFatal("Cannot parse file: '%s'", qPrintable(typesystemFileName)); |
177 | 183 |
178 | 184 if (!Preprocess::preprocess(fileName, pp_file, args.value("include-paths"), source_dir, args.value("qt-include-directory"))) { |
179 if (!Preprocess::preprocess(fileName, pp_file, args.value("include-paths"))) { | |
180 fprintf(stderr, "Preprocessor failed on file: '%s'\n", qPrintable(fileName)); | 185 fprintf(stderr, "Preprocessor failed on file: '%s'\n", qPrintable(fileName)); |
181 return 1; | 186 return 1; |
182 } | 187 } |
183 | 188 |
184 if (args.contains("ast-to-xml")) { | 189 if (args.contains("ast-to-xml")) { |
210 printf("Usage:\n generator [options] header-file typesystem-file\n\n"); | 215 printf("Usage:\n generator [options] header-file typesystem-file\n\n"); |
211 printf("Available options:\n\n"); | 216 printf("Available options:\n\n"); |
212 printf("General:\n"); | 217 printf("General:\n"); |
213 printf( | 218 printf( |
214 " --cpp-shared \n" | 219 " --cpp-shared \n" |
220 " --qt-include-directory \n" | |
221 " --qt-directory \n" | |
222 " --source-directory \n" | |
215 " --debug-level=[sparse|medium|full] \n" | 223 " --debug-level=[sparse|medium|full] \n" |
216 " --d-target=[d1-tango|d2-phobos] \n" | 224 " --d-target=[d1-tango|d2-phobos] \n" |
217 " --dump-object-tree \n" | 225 " --dump-object-tree \n" |
218 " --help, -h or -? \n" | 226 " --help, -h or -? \n" |
219 " --no-suppress-warnings \n" | 227 " --no-suppress-warnings \n" |
220 " --include-eclipse-warnings \n" | 228 " --include-eclipse-warnings \n" |
221 " --output-directory=[dir] \n" | 229 " --output-directory=[dir] \n" |