author | zecke <zecke> | 2004-07-15 17:36:57 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-07-15 17:36:57 (UTC) |
commit | 323e9a7472a110b4befba7320540263147505bae (patch) (unidiff) | |
tree | 14c810bdb9c0603a30356b17b4bdf9ccb72741c6 /qmake/generators/win32/msvc_objectmodel.cpp | |
parent | aa292b322f1ecb43dd8f4e3cd295855730dd9f59 (diff) | |
download | opie-323e9a7472a110b4befba7320540263147505bae.zip opie-323e9a7472a110b4befba7320540263147505bae.tar.gz opie-323e9a7472a110b4befba7320540263147505bae.tar.bz2 |
Manually updatet to qmake1.06a which includes support for precompiled
headers.
Opies 'PRO' keyword was already reintroduced
Diffstat (limited to 'qmake/generators/win32/msvc_objectmodel.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | qmake/generators/win32/msvc_objectmodel.cpp | 341 |
1 files changed, 231 insertions, 110 deletions
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 7ffe4f7..a672c2d 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp | |||
@@ -1,20 +1,20 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Implementation of VCProject class. |
5 | ** | 5 | ** |
6 | ** Copyright (C) 2002 Trolltech AS. All rights reserved. | 6 | ** Copyright (C) 2002-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** This file is part of the network module of the Qt GUI Toolkit. | 8 | ** This file is part of qmake. |
9 | ** | 9 | ** |
10 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
11 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
12 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
13 | ** | 13 | ** |
14 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
15 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
16 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
17 | ** packaging of this file. | 17 | ** packaging of this file. |
18 | ** | 18 | ** |
19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
20 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
@@ -28,39 +28,25 @@ | |||
28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
30 | ** | 30 | ** |
31 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
32 | ** not clear to you. | 32 | ** not clear to you. |
33 | ** | 33 | ** |
34 | **********************************************************************/ | 34 | **********************************************************************/ |
35 | 35 | ||
36 | #include "msvc_objectmodel.h" | 36 | #include "msvc_objectmodel.h" |
37 | #include "msvc_vcproj.h" | 37 | #include "msvc_vcproj.h" |
38 | #include <qtextstream.h> | 38 | #include <qtextstream.h> |
39 | #include <qstringlist.h> | 39 | #include <qstringlist.h> |
40 | #include <quuid.h> | 40 | #include <qfileinfo.h> |
41 | |||
42 | #if defined(Q_OS_WIN32) | ||
43 | #include <objbase.h> | ||
44 | #ifndef GUID_DEFINED | ||
45 | #define GUID_DEFINED | ||
46 | typedef struct _GUID | ||
47 | { | ||
48 | ulong Data1; | ||
49 | ushort Data2; | ||
50 | ushort Data3; | ||
51 | uchar Data4[8]; | ||
52 | } GUID; | ||
53 | #endif | ||
54 | #endif | ||
55 | 41 | ||
56 | // XML Tags --------------------------------------------------------- | 42 | // XML Tags --------------------------------------------------------- |
57 | const char* _xmlInit = "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>"; | 43 | const char* _xmlInit = "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>"; |
58 | const char* _begConfiguration = "\n\t\t<Configuration"; | 44 | const char* _begConfiguration = "\n\t\t<Configuration"; |
59 | const char* _begConfigurations = "\n\t<Configurations>"; | 45 | const char* _begConfigurations = "\n\t<Configurations>"; |
60 | const char* _begFile = "\n\t\t\t<File"; | 46 | const char* _begFile = "\n\t\t\t<File"; |
61 | const char* _begFileConfiguration = "\n\t\t\t\t<FileConfiguration"; | 47 | const char* _begFileConfiguration = "\n\t\t\t\t<FileConfiguration"; |
62 | const char* _begFiles = "\n\t<Files>"; | 48 | const char* _begFiles = "\n\t<Files>"; |
63 | const char* _begFilter = "\n\t\t<Filter"; | 49 | const char* _begFilter = "\n\t\t<Filter"; |
64 | const char* _begGlobals = "\n\t<Globals>"; | 50 | const char* _begGlobals = "\n\t<Globals>"; |
65 | const char* _begPlatform = "\n\t\t<Platform"; | 51 | const char* _begPlatform = "\n\t\t<Platform"; |
66 | const char* _begPlatforms = "\n\t<Platforms>"; | 52 | const char* _begPlatforms = "\n\t<Platforms>"; |
@@ -272,25 +258,24 @@ struct SPair { | |||
272 | const char* name; | 258 | const char* name; |
273 | const QString& value; | 259 | const QString& value; |
274 | }; | 260 | }; |
275 | struct XPair { | 261 | struct XPair { |
276 | XPair( const char* n, const QStringList& v, const char* s = "," ) : name(n), value(v), sep(s) {}; | 262 | XPair( const char* n, const QStringList& v, const char* s = "," ) : name(n), value(v), sep(s) {}; |
277 | const char* name; | 263 | const char* name; |
278 | const QStringList& value; | 264 | const QStringList& value; |
279 | const char* sep; | 265 | const char* sep; |
280 | }; | 266 | }; |
281 | 267 | ||
282 | // void streamSPair( QTextStream &strm, const char *n, const QString &s ) | 268 | // void streamSPair( QTextStream &strm, const char *n, const QString &s ) |
283 | 269 | ||
284 | |||
285 | // Streaming operators for property Pairs --------------------------- | 270 | // Streaming operators for property Pairs --------------------------- |
286 | QTextStream &operator<<( QTextStream &strm, const TPair &prop ) | 271 | QTextStream &operator<<( QTextStream &strm, const TPair &prop ) |
287 | { | 272 | { |
288 | switch( prop.value ) { | 273 | switch( prop.value ) { |
289 | case _False: | 274 | case _False: |
290 | strm << prop.name << "FALSE\""; | 275 | strm << prop.name << "FALSE\""; |
291 | break; | 276 | break; |
292 | case _True: | 277 | case _True: |
293 | strm << prop.name << "TRUE\""; | 278 | strm << prop.name << "TRUE\""; |
294 | break; | 279 | break; |
295 | case unset: | 280 | case unset: |
296 | default: | 281 | default: |
@@ -309,148 +294,149 @@ QTextStream &operator<<( QTextStream &strm, const EPair &prop ) | |||
309 | return strm; | 294 | return strm; |
310 | } | 295 | } |
311 | 296 | ||
312 | QTextStream &operator<<( QTextStream &strm, const LPair &prop ) | 297 | QTextStream &operator<<( QTextStream &strm, const LPair &prop ) |
313 | { | 298 | { |
314 | strm << prop.name << prop.value << "\""; | 299 | strm << prop.name << prop.value << "\""; |
315 | return strm; | 300 | return strm; |
316 | } | 301 | } |
317 | 302 | ||
318 | QTextStream &operator<<( QTextStream &strm, const SPair &prop ) | 303 | QTextStream &operator<<( QTextStream &strm, const SPair &prop ) |
319 | { | 304 | { |
320 | if ( !prop.value.isEmpty() ) | 305 | if ( !prop.value.isEmpty() ) |
321 | strm << prop.name << prop.value.latin1() << "\""; | 306 | strm << prop.name << QString(prop.value).remove("\"") << "\""; |
322 | return strm; | 307 | return strm; |
323 | } | 308 | } |
324 | 309 | ||
325 | QTextStream &operator<<( QTextStream &strm, const XPair &prop ) | 310 | QTextStream &operator<<( QTextStream &strm, const XPair &prop ) |
326 | { | 311 | { |
327 | if ( !prop.value.isEmpty() ) | 312 | if ( !prop.value.isEmpty() ) |
328 | strm << prop.name << prop.value.join(prop.sep).latin1() << "\""; | 313 | strm << prop.name << prop.value.join(prop.sep).latin1() << "\""; |
329 | return strm; | 314 | return strm; |
330 | } | 315 | } |
331 | 316 | ||
332 | // VCCLCompilerTool ------------------------------------------------- | 317 | // VCCLCompilerTool ------------------------------------------------- |
333 | VCCLCompilerTool::VCCLCompilerTool() | 318 | VCCLCompilerTool::VCCLCompilerTool() |
334 | :AssemblerOutput( asmListingNone ), | 319 | :AssemblerOutput( asmListingNone ), |
335 | BasicRuntimeChecks( runtimeBasicCheckNone ), | 320 | BasicRuntimeChecks( runtimeBasicCheckNone ), |
336 | BrowseInformation( brInfoNone ), | 321 | BrowseInformation( brInfoNone ), |
337 | BufferSecurityCheck( unset ), | 322 | BufferSecurityCheck( _False ), |
338 | CallingConvention( callConventionDefault ), | 323 | CallingConvention( callConventionDefault ), |
339 | CompileAs( compileAsDefault ), | 324 | CompileAs( compileAsDefault ), |
340 | CompileAsManaged( managedDefault ), | 325 | CompileAsManaged( managedDefault ), |
341 | CompileOnly( unset ), | 326 | CompileOnly( unset ), |
342 | DebugInformationFormat( debugDisabled ), | 327 | DebugInformationFormat( debugDisabled ), |
343 | DefaultCharIsUnsigned( unset ), | 328 | DefaultCharIsUnsigned( unset ), |
344 | Detect64BitPortabilityProblems( unset ), | 329 | Detect64BitPortabilityProblems( unset ), |
345 | DisableLanguageExtensions( unset ), | 330 | DisableLanguageExtensions( unset ), |
346 | EnableFiberSafeOptimizations( unset ), | 331 | EnableFiberSafeOptimizations( unset ), |
347 | EnableFunctionLevelLinking( unset ), | 332 | EnableFunctionLevelLinking( unset ), |
348 | EnableIntrinsicFunctions( unset ), | 333 | EnableIntrinsicFunctions( unset ), |
349 | ExceptionHandling( unset ), | 334 | ExceptionHandling( _False ), |
350 | ExpandAttributedSource( unset ), | 335 | ExpandAttributedSource( unset ), |
351 | FavorSizeOrSpeed( favorNone ), | 336 | FavorSizeOrSpeed( favorNone ), |
352 | ForceConformanceInForLoopScope( unset ), | 337 | ForceConformanceInForLoopScope( unset ), |
353 | GeneratePreprocessedFile( preprocessNo ), | 338 | GeneratePreprocessedFile( preprocessNo ), |
354 | GlobalOptimizations( unset ), | 339 | GlobalOptimizations( unset ), |
355 | IgnoreStandardIncludePath( unset ), | 340 | IgnoreStandardIncludePath( unset ), |
356 | ImproveFloatingPointConsistency( unset ), | 341 | ImproveFloatingPointConsistency( unset ), |
357 | InlineFunctionExpansion( expandOnlyInline ), | 342 | InlineFunctionExpansion( expandDefault ), |
358 | KeepComments( unset ), | 343 | KeepComments( unset ), |
359 | MinimalRebuild( unset ), | 344 | MinimalRebuild( unset ), |
360 | OmitFramePointers( unset ), | 345 | OmitFramePointers( unset ), |
361 | Optimization( optimizeDisabled ), | 346 | Optimization( optimizeCustom ), |
362 | OptimizeForProcessor( procOptimizeBlended ), | 347 | OptimizeForProcessor( procOptimizeBlended ), |
363 | OptimizeForWindowsApplication( unset ), | 348 | OptimizeForWindowsApplication( unset ), |
349 | ProgramDataBaseFileName( "" ), | ||
364 | RuntimeLibrary( rtMultiThreaded ), | 350 | RuntimeLibrary( rtMultiThreaded ), |
365 | RuntimeTypeInfo( unset ), | 351 | RuntimeTypeInfo( unset ), |
366 | ShowIncludes( unset ), | 352 | ShowIncludes( unset ), |
367 | SmallerTypeCheck( unset ), | 353 | SmallerTypeCheck( unset ), |
368 | StringPooling( unset ), | 354 | StringPooling( unset ), |
369 | StructMemberAlignment( alignNotSet ), | 355 | StructMemberAlignment( alignNotSet ), |
370 | SuppressStartupBanner( unset ), | 356 | SuppressStartupBanner( unset ), |
371 | TreatWChar_tAsBuiltInType( unset ), | 357 | TreatWChar_tAsBuiltInType( unset ), |
372 | TurnOffAssemblyGeneration( unset ), | 358 | TurnOffAssemblyGeneration( unset ), |
373 | UndefineAllPreprocessorDefinitions( unset ), | 359 | UndefineAllPreprocessorDefinitions( unset ), |
374 | UsePrecompiledHeader( pchGenerateAuto ), | 360 | UsePrecompiledHeader( pchNone ), |
375 | WarnAsError( unset ), | 361 | WarnAsError( unset ), |
376 | WarningLevel( warningLevel_0 ), | 362 | WarningLevel( warningLevel_0 ), |
377 | WholeProgramOptimization( unset ) | 363 | WholeProgramOptimization( unset ) |
378 | { | 364 | { |
379 | } | 365 | } |
380 | 366 | ||
381 | QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool ) | 367 | QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool ) |
382 | { | 368 | { |
383 | strm << _begTool3; | 369 | strm << _begTool3; |
384 | strm << _VCCLCompilerToolName; | 370 | strm << _VCCLCompilerToolName; |
385 | strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories ); | 371 | strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories ); |
386 | strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " ); | 372 | strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " ); |
387 | strm << XPair( _AdditionalUsingDirectories, tool.AdditionalUsingDirectories ); | 373 | strm << XPair( _AdditionalUsingDirectories, tool.AdditionalUsingDirectories ); |
388 | strm << SPair( _AssemblerListingLocation, tool.AssemblerListingLocation ); | 374 | strm << SPair( _AssemblerListingLocation, tool.AssemblerListingLocation ); |
389 | if ( tool.AssemblerOutput != asmListingNone ) strm << EPair( _AssemblerOutput, tool.AssemblerOutput ); | 375 | if ( tool.AssemblerOutput != asmListingNone ) strm << EPair( _AssemblerOutput, tool.AssemblerOutput ); |
390 | if ( tool.BasicRuntimeChecks != runtimeBasicCheckNone ) strm << EPair( _BasicRuntimeChecks, tool.BasicRuntimeChecks ); | 376 | if ( tool.BasicRuntimeChecks != runtimeBasicCheckNone ) strm << EPair( _BasicRuntimeChecks, tool.BasicRuntimeChecks ); |
391 | if ( tool.BrowseInformation != brInfoNone ) strm << EPair( _BrowseInformation, tool.BrowseInformation ); | 377 | if ( tool.BrowseInformation != brInfoNone ) strm << EPair( _BrowseInformation, tool.BrowseInformation ); |
392 | strm << SPair( _BrowseInformationFile, tool.BrowseInformationFile ); | 378 | strm << SPair( _BrowseInformationFile, tool.BrowseInformationFile ); |
393 | strm << TPair( _BufferSecurityCheck, tool.BufferSecurityCheck ); | 379 | strm << TPair( _BufferSecurityCheck, tool.BufferSecurityCheck ); |
394 | if ( tool.CallingConvention != callConventionDefault ) strm << EPair( _CallingConvention, tool.CallingConvention ); | 380 | if ( tool.CallingConvention != callConventionDefault ) strm << EPair( _CallingConvention, tool.CallingConvention ); |
395 | if ( tool.CompileAs != compileAsDefault ) strm << EPair( _CompileAs, tool.CompileAs ); | 381 | if ( tool.CompileAs != compileAsDefault ) strm << EPair( _CompileAs, tool.CompileAs ); |
396 | if ( tool.CompileAsManaged != managedDefault ) strm << EPair( _CompileAsManaged, tool.CompileAsManaged ); | 382 | if ( tool.CompileAsManaged != managedDefault ) strm << EPair( _CompileAsManaged, tool.CompileAsManaged ); |
397 | strm << TPair( _CompileOnly, tool.CompileOnly ); | 383 | strm << TPair( _CompileOnly, tool.CompileOnly ); |
398 | strm << EPair( _DebugInformationFormat, tool.DebugInformationFormat ); | 384 | if ( tool.DebugInformationFormat != debugUnknown ) strm << EPair( _DebugInformationFormat, tool.DebugInformationFormat ); |
399 | strm << TPair( _DefaultCharIsUnsigned, tool.DefaultCharIsUnsigned ); | 385 | strm << TPair( _DefaultCharIsUnsigned, tool.DefaultCharIsUnsigned ); |
400 | strm << TPair( _Detect64BitPortabilityProblems, tool.Detect64BitPortabilityProblems ); | 386 | strm << TPair( _Detect64BitPortabilityProblems, tool.Detect64BitPortabilityProblems ); |
401 | strm << TPair( _DisableLanguageExtensions, tool.DisableLanguageExtensions ); | 387 | strm << TPair( _DisableLanguageExtensions, tool.DisableLanguageExtensions ); |
402 | strm << XPair( _DisableSpecificWarnings, tool.DisableSpecificWarnings ); | 388 | strm << XPair( _DisableSpecificWarnings, tool.DisableSpecificWarnings ); |
403 | strm << TPair( _EnableFiberSafeOptimizations, tool.EnableFiberSafeOptimizations ); | 389 | strm << TPair( _EnableFiberSafeOptimizations, tool.EnableFiberSafeOptimizations ); |
404 | strm << TPair( _EnableFunctionLevelLinking, tool.EnableFunctionLevelLinking ); | 390 | strm << TPair( _EnableFunctionLevelLinking, tool.EnableFunctionLevelLinking ); |
405 | strm << TPair( _EnableIntrinsicFunctions, tool.EnableIntrinsicFunctions ); | 391 | strm << TPair( _EnableIntrinsicFunctions, tool.EnableIntrinsicFunctions ); |
406 | strm << TPair( _ExceptionHandling, tool.ExceptionHandling ); | 392 | strm << TPair( _ExceptionHandling, tool.ExceptionHandling ); |
407 | strm << TPair( _ExpandAttributedSource, tool.ExpandAttributedSource ); | 393 | strm << TPair( _ExpandAttributedSource, tool.ExpandAttributedSource ); |
408 | if ( tool.FavorSizeOrSpeed != favorNone ) strm << EPair( _FavorSizeOrSpeed, tool.FavorSizeOrSpeed ); | 394 | if ( tool.FavorSizeOrSpeed != favorNone ) strm << EPair( _FavorSizeOrSpeed, tool.FavorSizeOrSpeed ); |
409 | strm << TPair( _ForceConformanceInForLoopScope, tool.ForceConformanceInForLoopScope ); | 395 | strm << TPair( _ForceConformanceInForLoopScope, tool.ForceConformanceInForLoopScope ); |
410 | strm << XPair( _ForcedIncludeFiles, tool.ForcedIncludeFiles ); | 396 | strm << XPair( _ForcedIncludeFiles, tool.ForcedIncludeFiles ); |
411 | strm << XPair( _ForcedUsingFiles, tool.ForcedUsingFiles ); | 397 | strm << XPair( _ForcedUsingFiles, tool.ForcedUsingFiles ); |
412 | strm << EPair( _GeneratePreprocessedFile, tool.GeneratePreprocessedFile ); | 398 | if ( tool.GeneratePreprocessedFile != preprocessUnknown)strm << EPair( _GeneratePreprocessedFile, tool.GeneratePreprocessedFile ); |
413 | strm << TPair( _GlobalOptimizations, tool.GlobalOptimizations ); | 399 | strm << TPair( _GlobalOptimizations, tool.GlobalOptimizations ); |
414 | strm << TPair( _IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath ); | 400 | strm << TPair( _IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath ); |
415 | strm << TPair( _ImproveFloatingPointConsistency, tool.ImproveFloatingPointConsistency ); | 401 | strm << TPair( _ImproveFloatingPointConsistency, tool.ImproveFloatingPointConsistency ); |
416 | strm << EPair( _InlineFunctionExpansion, tool.InlineFunctionExpansion ); | 402 | if ( tool.InlineFunctionExpansion != expandDefault ) strm << EPair( _InlineFunctionExpansion, tool.InlineFunctionExpansion ); |
417 | strm << TPair( _KeepComments, tool.KeepComments ); | 403 | strm << TPair( _KeepComments, tool.KeepComments ); |
418 | strm << TPair( _MinimalRebuild, tool.MinimalRebuild ); | 404 | strm << TPair( _MinimalRebuild, tool.MinimalRebuild ); |
419 | strm << SPair( _ObjectFile, tool.ObjectFile ); | 405 | strm << SPair( _ObjectFile, tool.ObjectFile ); |
420 | strm << TPair( _OmitFramePointers, tool.OmitFramePointers ); | 406 | strm << TPair( _OmitFramePointers, tool.OmitFramePointers ); |
421 | strm << EPair( _Optimization, tool.Optimization ); | 407 | if ( tool.Optimization != optimizeDefault ) strm << EPair( _Optimization, tool.Optimization ); |
422 | if ( tool.OptimizeForProcessor != procOptimizeBlended ) strm << EPair( _OptimizeForProcessor, tool.OptimizeForProcessor ); | 408 | if ( tool.OptimizeForProcessor != procOptimizeBlended ) strm << EPair( _OptimizeForProcessor, tool.OptimizeForProcessor ); |
423 | strm << TPair( _OptimizeForWindowsApplication, tool.OptimizeForWindowsApplication ); | 409 | strm << TPair( _OptimizeForWindowsApplication, tool.OptimizeForWindowsApplication ); |
424 | strm << SPair( _OutputFile, tool.OutputFile ); | 410 | strm << SPair( _OutputFile, tool.OutputFile ); |
425 | strm << SPair( _PrecompiledHeaderFile, tool.PrecompiledHeaderFile ); | 411 | strm << SPair( _PrecompiledHeaderFile, tool.PrecompiledHeaderFile ); |
426 | strm << SPair( _PrecompiledHeaderThrough, tool.PrecompiledHeaderThrough ); | 412 | strm << SPair( _PrecompiledHeaderThrough, tool.PrecompiledHeaderThrough ); |
427 | strm << XPair( _PreprocessorDefinitions, tool.PreprocessorDefinitions ); | 413 | strm << XPair( _PreprocessorDefinitions, tool.PreprocessorDefinitions ); |
428 | strm << SPair( _ProgramDataBaseFileName, tool.ProgramDataBaseFileName ); | 414 | if ( !tool.ProgramDataBaseFileName.isNull() ) strm << _ProgramDataBaseFileName << tool.ProgramDataBaseFileName.latin1() << "\""; |
429 | strm << EPair( _RuntimeLibrary, tool.RuntimeLibrary ); | 415 | if ( tool.RuntimeLibrary != rtUnknown ) strm << EPair( _RuntimeLibrary, tool.RuntimeLibrary ); |
430 | strm << TPair( _RuntimeTypeInfo, tool.RuntimeTypeInfo ); | 416 | strm << TPair( _RuntimeTypeInfo, tool.RuntimeTypeInfo ); |
431 | strm << TPair( _ShowIncludes, tool.ShowIncludes ); | 417 | strm << TPair( _ShowIncludes, tool.ShowIncludes ); |
432 | strm << TPair( _SmallerTypeCheck, tool.SmallerTypeCheck ); | 418 | strm << TPair( _SmallerTypeCheck, tool.SmallerTypeCheck ); |
433 | strm << TPair( _StringPooling, tool.StringPooling ); | 419 | strm << TPair( _StringPooling, tool.StringPooling ); |
434 | if ( tool.StructMemberAlignment != alignNotSet ) strm << EPair( _StructMemberAlignment, tool.StructMemberAlignment ); | 420 | if ( tool.StructMemberAlignment != alignNotSet ) strm << EPair( _StructMemberAlignment, tool.StructMemberAlignment ); |
435 | strm << TPair( _SuppressStartupBanner, tool.SuppressStartupBanner ); | 421 | strm << TPair( _SuppressStartupBanner, tool.SuppressStartupBanner ); |
436 | strm << TPair( _TreatWChar_tAsBuiltInType, tool.TreatWChar_tAsBuiltInType ); | 422 | strm << TPair( _TreatWChar_tAsBuiltInType, tool.TreatWChar_tAsBuiltInType ); |
437 | strm << TPair( _TurnOffAssemblyGeneration, tool.TurnOffAssemblyGeneration ); | 423 | strm << TPair( _TurnOffAssemblyGeneration, tool.TurnOffAssemblyGeneration ); |
438 | strm << TPair( _UndefineAllPreprocessorDefinitions, tool.UndefineAllPreprocessorDefinitions ); | 424 | strm << TPair( _UndefineAllPreprocessorDefinitions, tool.UndefineAllPreprocessorDefinitions ); |
439 | strm << XPair( _UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions ); | 425 | strm << XPair( _UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions ); |
440 | if ( !tool.PrecompiledHeaderFile.isEmpty() || | 426 | if ( !tool.PrecompiledHeaderFile.isEmpty() || |
441 | !tool.PrecompiledHeaderThrough.isEmpty() ) | 427 | !tool.PrecompiledHeaderThrough.isEmpty() ) |
442 | strm << EPair( _UsePrecompiledHeader, tool.UsePrecompiledHeader ); | 428 | strm << EPair( _UsePrecompiledHeader, tool.UsePrecompiledHeader ); |
443 | strm << TPair( _WarnAsError, tool.WarnAsError ); | 429 | strm << TPair( _WarnAsError, tool.WarnAsError ); |
444 | strm << EPair( _WarningLevel, tool.WarningLevel ); | 430 | if ( tool.WarningLevel != warningLevelUnknown ) strm << EPair( _WarningLevel, tool.WarningLevel ); |
445 | strm << TPair( _WholeProgramOptimization, tool.WholeProgramOptimization ); | 431 | strm << TPair( _WholeProgramOptimization, tool.WholeProgramOptimization ); |
446 | strm << "/>"; | 432 | strm << "/>"; |
447 | return strm; | 433 | return strm; |
448 | } | 434 | } |
449 | 435 | ||
450 | bool VCCLCompilerTool::parseOption( const char* option ) | 436 | bool VCCLCompilerTool::parseOption( const char* option ) |
451 | { | 437 | { |
452 | // skip index 0 ('/' or '-') | 438 | // skip index 0 ('/' or '-') |
453 | char first = option[1]; | 439 | char first = option[1]; |
454 | char second = option[2]; | 440 | char second = option[2]; |
455 | char third = option[3]; | 441 | char third = option[3]; |
456 | char fourth = option[4]; | 442 | char fourth = option[4]; |
@@ -465,40 +451,47 @@ bool VCCLCompilerTool::parseOption( const char* option ) | |||
465 | case '@': | 451 | case '@': |
466 | qWarning( "Generator: Option '/@': MSVC.NET projects do not support the use of a response file" ); | 452 | qWarning( "Generator: Option '/@': MSVC.NET projects do not support the use of a response file" ); |
467 | found = FALSE; | 453 | found = FALSE; |
468 | break; | 454 | break; |
469 | case 'l': | 455 | case 'l': |
470 | qWarning( "Generator: Option '/link': qmake generator does not support passing link options through the compiler tool" ); | 456 | qWarning( "Generator: Option '/link': qmake generator does not support passing link options through the compiler tool" ); |
471 | found = FALSE; | 457 | found = FALSE; |
472 | break; | 458 | break; |
473 | case 'A': | 459 | case 'A': |
474 | if ( second != 'I' ) { | 460 | if ( second != 'I' ) { |
475 | found = FALSE; break; | 461 | found = FALSE; break; |
476 | } | 462 | } |
477 | AdditionalUsingDirectories += option+2; | 463 | AdditionalUsingDirectories += option+3; |
478 | break; | 464 | break; |
479 | case 'C': | 465 | case 'C': |
480 | KeepComments = _True; | 466 | KeepComments = _True; |
481 | break; | 467 | break; |
482 | case 'D': | 468 | case 'D': |
483 | PreprocessorDefinitions += option+1; | 469 | PreprocessorDefinitions += option+2; |
484 | break; | 470 | break; |
485 | case 'E': | 471 | case 'E': |
486 | if ( second == 'H' ) { | 472 | if ( second == 'H' ) { |
487 | if ( third == 'a' || third == 'c' || third == 's' ) { | 473 | if ( third == 'a' |
474 | || (third == 'c' && fourth != 's') | ||
475 | || (third == 's' && fourth != 'c') ) { | ||
488 | // ExceptionHandling must be false, or it will override | 476 | // ExceptionHandling must be false, or it will override |
489 | // with an /EHsc option | 477 | // with an /EHsc option |
490 | ExceptionHandling = _False; | 478 | ExceptionHandling = _False; |
491 | AdditionalOptions += option; | 479 | AdditionalOptions += option; |
492 | break; | 480 | break; |
481 | } else if ( (third == 'c' && fourth == 's') | ||
482 | || (third == 's' && fourth == 'c') ) { | ||
483 | ExceptionHandling = _True; | ||
484 | AdditionalOptions += option; | ||
485 | break; | ||
493 | } | 486 | } |
494 | found = FALSE; break; | 487 | found = FALSE; break; |
495 | } | 488 | } |
496 | GeneratePreprocessedFile = preprocessYes; | 489 | GeneratePreprocessedFile = preprocessYes; |
497 | break; | 490 | break; |
498 | case 'F': | 491 | case 'F': |
499 | if ( second <= '9' && second >= '0' ) { | 492 | if ( second <= '9' && second >= '0' ) { |
500 | AdditionalOptions += option; | 493 | AdditionalOptions += option; |
501 | break; | 494 | break; |
502 | } else { | 495 | } else { |
503 | switch ( second ) { | 496 | switch ( second ) { |
504 | case 'A': | 497 | case 'A': |
@@ -582,24 +575,27 @@ bool VCCLCompilerTool::parseOption( const char* option ) | |||
582 | case 'R': | 575 | case 'R': |
583 | RuntimeTypeInfo = _True; | 576 | RuntimeTypeInfo = _True; |
584 | if ( third == '-' ) | 577 | if ( third == '-' ) |
585 | RuntimeTypeInfo = _False; | 578 | RuntimeTypeInfo = _False; |
586 | break; | 579 | break; |
587 | case 'S': | 580 | case 'S': |
588 | BufferSecurityCheck = _True; | 581 | BufferSecurityCheck = _True; |
589 | break; | 582 | break; |
590 | case 'T': | 583 | case 'T': |
591 | EnableFiberSafeOptimizations = _True; | 584 | EnableFiberSafeOptimizations = _True; |
592 | break; | 585 | break; |
593 | case 'X': | 586 | case 'X': |
587 | // ExceptionHandling == true will override with | ||
588 | // an /EHsc option, which is correct with /GX | ||
589 | ExceptionHandling = _True; // Fall-through | ||
594 | case 'Z': | 590 | case 'Z': |
595 | case 'e': | 591 | case 'e': |
596 | case 'h': | 592 | case 'h': |
597 | AdditionalOptions += option; | 593 | AdditionalOptions += option; |
598 | break; | 594 | break; |
599 | case 'd': | 595 | case 'd': |
600 | CallingConvention = callConventionCDecl; | 596 | CallingConvention = callConventionCDecl; |
601 | break; | 597 | break; |
602 | case 'f': | 598 | case 'f': |
603 | StringPooling = _True; | 599 | StringPooling = _True; |
604 | AdditionalOptions += option; | 600 | AdditionalOptions += option; |
605 | break; | 601 | break; |
@@ -945,28 +941,28 @@ bool VCCLCompilerTool::parseOption( const char* option ) | |||
945 | return TRUE; | 941 | return TRUE; |
946 | } | 942 | } |
947 | 943 | ||
948 | // VCLinkerTool ----------------------------------------------------- | 944 | // VCLinkerTool ----------------------------------------------------- |
949 | VCLinkerTool::VCLinkerTool() | 945 | VCLinkerTool::VCLinkerTool() |
950 | :EnableCOMDATFolding( optFoldingDefault ), | 946 | :EnableCOMDATFolding( optFoldingDefault ), |
951 | GenerateDebugInformation( unset ), | 947 | GenerateDebugInformation( unset ), |
952 | GenerateMapFile( unset ), | 948 | GenerateMapFile( unset ), |
953 | HeapCommitSize( -1 ), | 949 | HeapCommitSize( -1 ), |
954 | HeapReserveSize( -1 ), | 950 | HeapReserveSize( -1 ), |
955 | IgnoreAllDefaultLibraries( unset ), | 951 | IgnoreAllDefaultLibraries( unset ), |
956 | IgnoreEmbeddedIDL( unset ), | 952 | IgnoreEmbeddedIDL( unset ), |
957 | IgnoreImportLibrary( unset ), | 953 | IgnoreImportLibrary( _True ), |
958 | LargeAddressAware( addrAwareDefault ), | 954 | LargeAddressAware( addrAwareDefault ), |
959 | LinkDLL( unset ), | 955 | LinkDLL( unset ), |
960 | LinkIncremental( linkIncrementalYes ), | 956 | LinkIncremental( linkIncrementalDefault ), |
961 | LinkTimeCodeGeneration( unset ), | 957 | LinkTimeCodeGeneration( unset ), |
962 | MapExports( unset ), | 958 | MapExports( unset ), |
963 | MapLines( unset ), | 959 | MapLines( unset ), |
964 | OptimizeForWindows98( optWin98Default ), | 960 | OptimizeForWindows98( optWin98Default ), |
965 | OptimizeReferences( optReferencesDefault ), | 961 | OptimizeReferences( optReferencesDefault ), |
966 | RegisterOutput( unset ), | 962 | RegisterOutput( unset ), |
967 | ResourceOnlyDLL( unset ), | 963 | ResourceOnlyDLL( unset ), |
968 | SetChecksum( unset ), | 964 | SetChecksum( unset ), |
969 | ShowProgress( linkProgressNotSet ), | 965 | ShowProgress( linkProgressNotSet ), |
970 | StackCommitSize( -1 ), | 966 | StackCommitSize( -1 ), |
971 | StackReserveSize( -1 ), | 967 | StackReserveSize( -1 ), |
972 | SubSystem( subSystemNotSet ), | 968 | SubSystem( subSystemNotSet ), |
@@ -1010,25 +1006,25 @@ QTextStream &operator<<( QTextStream &strm, const VCLinkerTool &tool ) | |||
1010 | strm << TPair( _LinkTimeCodeGeneration, tool.LinkTimeCodeGeneration ); | 1006 | strm << TPair( _LinkTimeCodeGeneration, tool.LinkTimeCodeGeneration ); |
1011 | strm << SPair( _LinkToManagedResourceFile, tool.LinkToManagedResourceFile ); | 1007 | strm << SPair( _LinkToManagedResourceFile, tool.LinkToManagedResourceFile ); |
1012 | strm << TPair( _MapExports, tool.MapExports ); | 1008 | strm << TPair( _MapExports, tool.MapExports ); |
1013 | strm << SPair( _MapFileName, tool.MapFileName ); | 1009 | strm << SPair( _MapFileName, tool.MapFileName ); |
1014 | strm << TPair( _MapLines, tool.MapLines ); | 1010 | strm << TPair( _MapLines, tool.MapLines ); |
1015 | strm << SPair( _MergedIDLBaseFileName, tool.MergedIDLBaseFileName ); | 1011 | strm << SPair( _MergedIDLBaseFileName, tool.MergedIDLBaseFileName ); |
1016 | strm << SPair( _MergeSections, tool.MergeSections ); | 1012 | strm << SPair( _MergeSections, tool.MergeSections ); |
1017 | strm << SPair( _MidlCommandFile, tool.MidlCommandFile ); | 1013 | strm << SPair( _MidlCommandFile, tool.MidlCommandFile ); |
1018 | strm << SPair( _ModuleDefinitionFile, tool.ModuleDefinitionFile ); | 1014 | strm << SPair( _ModuleDefinitionFile, tool.ModuleDefinitionFile ); |
1019 | if ( tool.OptimizeForWindows98 != optWin98Default ) strm << EPair( _OptimizeForWindows98, tool.OptimizeForWindows98 ); | 1015 | if ( tool.OptimizeForWindows98 != optWin98Default ) strm << EPair( _OptimizeForWindows98, tool.OptimizeForWindows98 ); |
1020 | if ( tool.OptimizeReferences != optReferencesDefault ) strm << EPair( _OptimizeReferences, tool.OptimizeReferences ); | 1016 | if ( tool.OptimizeReferences != optReferencesDefault ) strm << EPair( _OptimizeReferences, tool.OptimizeReferences ); |
1021 | strm << SPair( _OutputFile, tool.OutputFile ); | 1017 | strm << SPair( _OutputFile, tool.OutputFile ); |
1022 | strm << SPair( _ProgramDatabaseFile, tool.ProgramDatabaseFile ); | 1018 | strm << _ProgramDatabaseFile << tool.ProgramDatabaseFile << "\""; |
1023 | strm << TPair( _RegisterOutput, tool.RegisterOutput ); | 1019 | strm << TPair( _RegisterOutput, tool.RegisterOutput ); |
1024 | strm << TPair( _ResourceOnlyDLL, tool.ResourceOnlyDLL ); | 1020 | strm << TPair( _ResourceOnlyDLL, tool.ResourceOnlyDLL ); |
1025 | strm << TPair( _SetChecksum, tool.SetChecksum ); | 1021 | strm << TPair( _SetChecksum, tool.SetChecksum ); |
1026 | if ( tool.ShowProgress != linkProgressNotSet ) strm << EPair( _ShowProgress, tool.ShowProgress ); | 1022 | if ( tool.ShowProgress != linkProgressNotSet ) strm << EPair( _ShowProgress, tool.ShowProgress ); |
1027 | if ( tool.StackCommitSize != -1 ) strm << LPair( _StackCommitSize, tool.StackCommitSize ); | 1023 | if ( tool.StackCommitSize != -1 ) strm << LPair( _StackCommitSize, tool.StackCommitSize ); |
1028 | if ( tool.StackReserveSize != -1 ) strm << LPair( _StackReserveSize, tool.StackReserveSize ); | 1024 | if ( tool.StackReserveSize != -1 ) strm << LPair( _StackReserveSize, tool.StackReserveSize ); |
1029 | strm << SPair( _StripPrivateSymbols, tool.StripPrivateSymbols ); | 1025 | strm << SPair( _StripPrivateSymbols, tool.StripPrivateSymbols ); |
1030 | strm << EPair( _SubSystem, tool.SubSystem ); | 1026 | strm << EPair( _SubSystem, tool.SubSystem ); |
1031 | strm << TPair( _SupportUnloadOfDelayLoadedDLL, tool.SupportUnloadOfDelayLoadedDLL ); | 1027 | strm << TPair( _SupportUnloadOfDelayLoadedDLL, tool.SupportUnloadOfDelayLoadedDLL ); |
1032 | strm << TPair( _SuppressStartupBanner, tool.SuppressStartupBanner ); | 1028 | strm << TPair( _SuppressStartupBanner, tool.SuppressStartupBanner ); |
1033 | strm << TPair( _SwapRunFromCD, tool.SwapRunFromCD ); | 1029 | strm << TPair( _SwapRunFromCD, tool.SwapRunFromCD ); |
1034 | strm << TPair( _SwapRunFromNet, tool.SwapRunFromNet ); | 1030 | strm << TPair( _SwapRunFromNet, tool.SwapRunFromNet ); |
@@ -1698,27 +1694,27 @@ QTextStream &operator<<( QTextStream &strm, const VCLibrarianTool &tool ) | |||
1698 | 1694 | ||
1699 | // VCCustomBuildTool ------------------------------------------------ | 1695 | // VCCustomBuildTool ------------------------------------------------ |
1700 | VCCustomBuildTool::VCCustomBuildTool() | 1696 | VCCustomBuildTool::VCCustomBuildTool() |
1701 | { | 1697 | { |
1702 | ToolName = "VCCustomBuildTool"; | 1698 | ToolName = "VCCustomBuildTool"; |
1703 | } | 1699 | } |
1704 | 1700 | ||
1705 | QTextStream &operator<<( QTextStream &strm, const VCCustomBuildTool &tool ) | 1701 | QTextStream &operator<<( QTextStream &strm, const VCCustomBuildTool &tool ) |
1706 | { | 1702 | { |
1707 | strm << _begTool3; | 1703 | strm << _begTool3; |
1708 | strm << SPair( _ToolName, tool.ToolName ); | 1704 | strm << SPair( _ToolName, tool.ToolName ); |
1709 | strm << XPair( _AdditionalDependencies4, tool.AdditionalDependencies, ";" ); | 1705 | strm << XPair( _AdditionalDependencies4, tool.AdditionalDependencies, ";" ); |
1710 | strm << SPair( _CommandLine4, tool.CommandLine ); | 1706 | strm << XPair( _CommandLine4, tool.CommandLine, "\n" ); |
1711 | strm << SPair( _Description4, tool.Description ); | 1707 | strm << SPair( _Description4, tool.Description ); |
1712 | strm << SPair( _Outputs4, tool.Outputs ); | 1708 | strm << XPair( _Outputs4, tool.Outputs, ";" ); |
1713 | strm << SPair( _ToolPath, tool.ToolPath ); | 1709 | strm << SPair( _ToolPath, tool.ToolPath ); |
1714 | strm << "/>"; | 1710 | strm << "/>"; |
1715 | return strm; | 1711 | return strm; |
1716 | } | 1712 | } |
1717 | 1713 | ||
1718 | // VCResourceCompilerTool ------------------------------------------- | 1714 | // VCResourceCompilerTool ------------------------------------------- |
1719 | VCResourceCompilerTool::VCResourceCompilerTool() | 1715 | VCResourceCompilerTool::VCResourceCompilerTool() |
1720 | : Culture( rcUseDefault ), | 1716 | : Culture( rcUseDefault ), |
1721 | IgnoreStandardIncludePath( unset ), | 1717 | IgnoreStandardIncludePath( unset ), |
1722 | ShowProgress( linkProgressNotSet ) | 1718 | ShowProgress( linkProgressNotSet ) |
1723 | { | 1719 | { |
1724 | PreprocessorDefinitions = "NDEBUG"; | 1720 | PreprocessorDefinitions = "NDEBUG"; |
@@ -1817,61 +1813,57 @@ QTextStream &operator<<( QTextStream &strm, const VCConfiguration &tool ) | |||
1817 | strm << tool.idl; | 1813 | strm << tool.idl; |
1818 | strm << tool.postBuild; | 1814 | strm << tool.postBuild; |
1819 | strm << tool.preBuild; | 1815 | strm << tool.preBuild; |
1820 | strm << tool.preLink; | 1816 | strm << tool.preLink; |
1821 | strm << tool.resource; | 1817 | strm << tool.resource; |
1822 | strm << _endConfiguration; | 1818 | strm << _endConfiguration; |
1823 | return strm; | 1819 | return strm; |
1824 | } | 1820 | } |
1825 | // VCFilter --------------------------------------------------------- | 1821 | // VCFilter --------------------------------------------------------- |
1826 | VCFilter::VCFilter() | 1822 | VCFilter::VCFilter() |
1827 | : ParseFiles( unset ) | 1823 | : ParseFiles( unset ) |
1828 | { | 1824 | { |
1825 | useCustomBuildTool = FALSE; | ||
1826 | useCompilerTool = FALSE; | ||
1829 | } | 1827 | } |
1830 | 1828 | ||
1831 | void VCFilter::generateMOC( QTextStream &strm, QString str ) const | 1829 | void VCFilter::addMOCstage( QTextStream &strm, QString filename ) |
1832 | { | 1830 | { |
1833 | QString mocOutput = Project->findMocDestination( str ); | 1831 | QString mocOutput = Project->findMocDestination( filename ); |
1834 | QString mocApp = Project->var( "QMAKE_MOC" ); | 1832 | QString mocApp = Project->var( "QMAKE_MOC" ); |
1835 | 1833 | ||
1836 | if( mocOutput.isEmpty() ) { | 1834 | if( mocOutput.isEmpty() && filename.endsWith(".moc") ) { |
1837 | // In specialcases we DO moc .cpp files | 1835 | // In specialcases we DO moc .cpp files |
1838 | // when the result is an .moc file | 1836 | // when the result is an .moc file |
1839 | if ( !str.endsWith(".moc") ) | 1837 | mocOutput = filename; |
1840 | return; | 1838 | filename = Project->findMocSource( mocOutput ); |
1841 | mocOutput = str; | ||
1842 | str = Project->findMocSource( mocOutput ); | ||
1843 | } | 1839 | } |
1844 | 1840 | ||
1845 | strm << _begFileConfiguration; | 1841 | if (mocOutput.isEmpty()) |
1846 | strm << _Name5; | 1842 | return; |
1847 | strm << Config->Name; | 1843 | |
1848 | strm << "\">"; | 1844 | CustomBuildTool = VCCustomBuildTool(); |
1849 | strm << _begTool5; | 1845 | useCustomBuildTool = TRUE; |
1850 | strm << _VCCustomBuildTool; | 1846 | CustomBuildTool.Description = "Moc'ing " + filename + "..."; |
1851 | strm << _Description6; | 1847 | CustomBuildTool.CommandLine += (mocApp + " " |
1852 | strm << "Moc'ing " << str << "...\""; | 1848 | + filename + " -o " + mocOutput); |
1853 | strm << _CommandLine6; | 1849 | CustomBuildTool.AdditionalDependencies = mocApp; |
1854 | strm << mocApp; | 1850 | CustomBuildTool.Outputs += mocOutput; |
1855 | strm << " " << str << " -o " << mocOutput << "\""; | ||
1856 | strm << _AdditionalDependencies6; | ||
1857 | strm << mocApp << "\""; | ||
1858 | strm << _Outputs6; | ||
1859 | strm << mocOutput << "\""; | ||
1860 | strm << "/>"; | ||
1861 | strm << _endFileConfiguration; | ||
1862 | } | 1851 | } |
1863 | 1852 | ||
1864 | void VCFilter::generateUIC( QTextStream &strm, const QString& str ) const | 1853 | void VCFilter::addUICstage( QTextStream &strm, QString str ) |
1865 | { | 1854 | { |
1855 | CustomBuildTool = VCCustomBuildTool(); | ||
1856 | useCustomBuildTool = TRUE; | ||
1857 | |||
1866 | QString uicApp = Project->var("QMAKE_UIC"); | 1858 | QString uicApp = Project->var("QMAKE_UIC"); |
1867 | QString mocApp = Project->var( "QMAKE_MOC" ); | 1859 | QString mocApp = Project->var( "QMAKE_MOC" ); |
1868 | QString fname = str.section( '\\', -1 ); | 1860 | QString fname = str.section( '\\', -1 ); |
1869 | QString mocDir = Project->var( "MOC_DIR" ); | 1861 | QString mocDir = Project->var( "MOC_DIR" ); |
1870 | QString uiDir = Project->var( "UI_DIR" ); | 1862 | QString uiDir = Project->var( "UI_DIR" ); |
1871 | QString uiHeaders; | 1863 | QString uiHeaders; |
1872 | QString uiSources; | 1864 | QString uiSources; |
1873 | 1865 | ||
1874 | // Determining the paths for the output files. | 1866 | // Determining the paths for the output files. |
1875 | int slash = str.findRev( '\\' ); | 1867 | int slash = str.findRev( '\\' ); |
1876 | QString pname = ( slash != -1 ) ? str.left( slash+1 ) : QString( ".\\" ); | 1868 | QString pname = ( slash != -1 ) ? str.left( slash+1 ) : QString( ".\\" ); |
1877 | if( !uiDir.isEmpty() ) { | 1869 | if( !uiDir.isEmpty() ) { |
@@ -1886,107 +1878,236 @@ void VCFilter::generateUIC( QTextStream &strm, const QString& str ) const | |||
1886 | uiSources = pname; | 1878 | uiSources = pname; |
1887 | } | 1879 | } |
1888 | if( !uiHeaders.endsWith( "\\" ) ) | 1880 | if( !uiHeaders.endsWith( "\\" ) ) |
1889 | uiHeaders += "\\"; | 1881 | uiHeaders += "\\"; |
1890 | if( !uiSources.endsWith( "\\" ) ) | 1882 | if( !uiSources.endsWith( "\\" ) ) |
1891 | uiSources += "\\"; | 1883 | uiSources += "\\"; |
1892 | 1884 | ||
1893 | // Determine the file name. | 1885 | // Determine the file name. |
1894 | int dot = fname.findRev( '.' ); | 1886 | int dot = fname.findRev( '.' ); |
1895 | if( dot != -1 ) | 1887 | if( dot != -1 ) |
1896 | fname.truncate( dot ); | 1888 | fname.truncate( dot ); |
1897 | 1889 | ||
1898 | strm << _begFileConfiguration; | 1890 | if ( mocDir.isEmpty() ) |
1899 | strm << _Name5; | 1891 | mocDir = pname; |
1900 | strm << Config->Name; | 1892 | |
1901 | strm << "\">"; | 1893 | CustomBuildTool.Description = ("Uic'ing " + str + "...\""); |
1902 | strm << _begTool5; | 1894 | CustomBuildTool.CommandLine += // Create .h from .ui file |
1903 | strm << _VCCustomBuildTool; | 1895 | uicApp + " " + str + " -o " + uiHeaders + fname + ".h"; |
1904 | strm << _Description6; | 1896 | CustomBuildTool.CommandLine += // Create .cpp from .ui file |
1905 | strm << "Uic'ing " << str << "...\""; | 1897 | uicApp + " " + str + " -i " + fname + ".h -o " + uiSources + fname + ".cpp"; |
1906 | strm << _CommandLine6; | 1898 | CustomBuildTool.CommandLine += // Moc the headerfile |
1907 | strm << uicApp << " " << str << " -o " << uiHeaders << fname << ".h && "; // Create .h from .ui file | 1899 | mocApp + " " + uiHeaders + fname + ".h -o " + mocDir + Option::h_moc_mod + fname + Option::h_moc_ext; |
1908 | strm << uicApp << " " << str << " -i " << fname << ".h -o " << uiSources << fname << ".cpp && ";// Create .cpp from .ui file | 1900 | |
1909 | strm << mocApp << " " << uiHeaders << fname << ".h -o " << mocDir << "moc_" << fname << ".cpp\""; | 1901 | CustomBuildTool.AdditionalDependencies += mocApp; |
1910 | strm << _AdditionalDependencies6; | 1902 | CustomBuildTool.AdditionalDependencies += uicApp; |
1911 | strm << mocApp << ";" << uicApp << "\""; | 1903 | CustomBuildTool.Outputs += |
1912 | strm << _Outputs6; | 1904 | uiHeaders + fname + ".h;" + uiSources + fname + ".cpp;" + mocDir + Option::h_moc_mod + fname + Option::h_moc_ext; |
1913 | strm << uiHeaders << fname << ".h;" << uiSources << fname << ".cpp;" << mocDir << "moc_" << fname << ".cpp\""; | ||
1914 | strm << "/>"; | ||
1915 | strm << _endFileConfiguration; | ||
1916 | } | 1905 | } |
1917 | 1906 | ||
1918 | QTextStream &operator<<( QTextStream &strm, const VCFilter &tool ) | 1907 | void VCFilter::modifyPCHstage( QTextStream &strm, QString str ) |
1908 | { | ||
1909 | bool isCFile = str.endsWith(".c"); | ||
1910 | bool isHFile = (str.endsWith(".h") && str == Project->precompH); | ||
1911 | |||
1912 | if (!isCFile && !isHFile) | ||
1913 | return; | ||
1914 | |||
1915 | CompilerTool = VCCLCompilerTool(); | ||
1916 | useCompilerTool = TRUE; | ||
1917 | |||
1918 | // Unset some default options | ||
1919 | CompilerTool.BufferSecurityCheck = unset; | ||
1920 | CompilerTool.DebugInformationFormat = debugUnknown; | ||
1921 | CompilerTool.ExceptionHandling = unset; | ||
1922 | CompilerTool.GeneratePreprocessedFile = preprocessUnknown; | ||
1923 | CompilerTool.Optimization = optimizeDefault; | ||
1924 | CompilerTool.ProgramDataBaseFileName = QString::null; | ||
1925 | CompilerTool.RuntimeLibrary = rtUnknown; | ||
1926 | CompilerTool.WarningLevel = warningLevelUnknown; | ||
1927 | |||
1928 | // Setup PCH options | ||
1929 | CompilerTool.UsePrecompiledHeader = (isCFile ? pchNone : pchCreateUsingSpecific); | ||
1930 | CompilerTool.PrecompiledHeaderThrough = "$(NOINHERIT)"; | ||
1931 | CompilerTool.ForcedIncludeFiles = "$(NOINHERIT)"; | ||
1932 | } | ||
1933 | |||
1934 | bool VCFilter::addIMGstage( QTextStream &strm, QString str ) | ||
1935 | { | ||
1936 | bool isCorH = FALSE; | ||
1937 | if (str.endsWith(".c") || str.endsWith(".rc")) | ||
1938 | isCorH = TRUE; | ||
1939 | QStringList::Iterator it; | ||
1940 | for(it = Option::cpp_ext.begin(); it != Option::cpp_ext.end(); ++it) | ||
1941 | if(str.endsWith(*it)) | ||
1942 | isCorH = TRUE; | ||
1943 | for(it = Option::h_ext.begin(); it != Option::h_ext.end(); ++it) | ||
1944 | if(str.endsWith(*it)) | ||
1945 | isCorH = TRUE; | ||
1946 | |||
1947 | QString collectionName = Project->project->first("QMAKE_IMAGE_COLLECTION"); | ||
1948 | if (str.isEmpty() || isCorH || collectionName.isEmpty()) | ||
1949 | return FALSE; | ||
1950 | |||
1951 | CustomBuildTool = VCCustomBuildTool(); | ||
1952 | useCustomBuildTool = TRUE; | ||
1953 | |||
1954 | // Some projects (like designer core) may have too many images to | ||
1955 | // call uic directly. Therefor we have to create a temporary | ||
1956 | // file, with the image list, and call uic with the -f option. | ||
1957 | QString tmpFileCmd = "echo "; | ||
1958 | QString tmpImageFilename = ".imgcol"; | ||
1959 | QStringList& list = Project->project->variables()["IMAGES"]; | ||
1960 | bool firstOutput = TRUE; | ||
1961 | it = list.begin(); | ||
1962 | while( it!=list.end() ) { | ||
1963 | tmpFileCmd += (*it) + " "; | ||
1964 | ++it; | ||
1965 | if (tmpFileCmd.length()>250 || it==list.end()) { | ||
1966 | CustomBuildTool.CommandLine += tmpFileCmd | ||
1967 | + (firstOutput?"> ":">> ") | ||
1968 | + tmpImageFilename; | ||
1969 | tmpFileCmd = "echo "; | ||
1970 | firstOutput = FALSE; | ||
1971 | } | ||
1972 | } | ||
1973 | |||
1974 | QString uicApp = Project->var("QMAKE_UIC"); | ||
1975 | CustomBuildTool.Description = ("Generate imagecollection"); | ||
1976 | CustomBuildTool.CommandLine += | ||
1977 | uicApp + " -embed " + Project->project->first("QMAKE_ORIG_TARGET") | ||
1978 | + " -f .imgcol -o " + collectionName; | ||
1979 | CustomBuildTool.AdditionalDependencies += uicApp; | ||
1980 | CustomBuildTool.AdditionalDependencies += list; | ||
1981 | CustomBuildTool.Outputs = collectionName; | ||
1982 | CustomBuildTool.Outputs += tmpImageFilename; | ||
1983 | return TRUE; | ||
1984 | } | ||
1985 | |||
1986 | QTextStream &operator<<( QTextStream &strm, VCFilter &tool ) | ||
1919 | { | 1987 | { |
1920 | if ( tool.Files.count() == 0 ) | 1988 | if ( tool.Files.count() == 0 ) |
1921 | return strm; | 1989 | return strm; |
1922 | 1990 | ||
1923 | strm << _begFilter; | 1991 | strm << _begFilter; |
1924 | strm << SPair( _Name3, tool.Name ); | 1992 | strm << SPair( _Name3, tool.Name ); |
1925 | strm << TPair( _ParseFiles, tool.ParseFiles ); | 1993 | strm << TPair( _ParseFiles, tool.ParseFiles ); |
1926 | strm << SPair( _Filter, tool.Filter ); | 1994 | strm << SPair( _Filter, tool.Filter ); |
1927 | strm << ">"; | 1995 | strm << ">"; |
1996 | |||
1997 | bool resourceBuild = FALSE; | ||
1998 | int currentLevels = 0; | ||
1999 | QStringList currentDirs; | ||
1928 | for ( QStringList::ConstIterator it = tool.Files.begin(); it != tool.Files.end(); ++it ) { | 2000 | for ( QStringList::ConstIterator it = tool.Files.begin(); it != tool.Files.end(); ++it ) { |
2001 | if ( !tool.flat_files ) { | ||
2002 | QStringList newDirs = QStringList::split('\\',(*it)); | ||
2003 | newDirs.pop_back(); // Skip the filename | ||
2004 | |||
2005 | int newLevels = int(newDirs.count()); | ||
2006 | int equalLevels = 0; | ||
2007 | for (int i = 0; i<currentLevels; i++, equalLevels++ ) | ||
2008 | if (currentDirs[i] != newDirs[i]) | ||
2009 | break; | ||
2010 | int closeFilters = currentLevels - equalLevels; | ||
2011 | int openFilters = newLevels - equalLevels; | ||
2012 | |||
2013 | // close previous non-equal filter | ||
2014 | while ( closeFilters-- ) | ||
2015 | strm << _endFilter; | ||
2016 | |||
2017 | // open new non-equal filters | ||
2018 | newLevels = 0; | ||
2019 | while ( openFilters-- ) { | ||
2020 | strm << _begFilter; | ||
2021 | strm << SPair( _Name3, newDirs[equalLevels + newLevels] ); | ||
2022 | strm << _Filter << "\">"; // Blank filter | ||
2023 | ++newLevels; | ||
2024 | } | ||
2025 | currentDirs = newDirs; | ||
2026 | currentLevels = int(newDirs.count()); | ||
2027 | } | ||
2028 | |||
2029 | tool.useCustomBuildTool = FALSE; | ||
2030 | tool.useCompilerTool = FALSE; | ||
2031 | // Add UIC, MOC and PCH stages to file | ||
2032 | if ( tool.CustomBuild == moc ) | ||
2033 | tool.addMOCstage( strm, *it ); | ||
2034 | else if ( tool.CustomBuild == uic ) | ||
2035 | tool.addUICstage( strm, *it ); | ||
2036 | else if ( tool.CustomBuild == resource ) { | ||
2037 | if (!resourceBuild) | ||
2038 | resourceBuild = tool.addIMGstage(strm, *it); | ||
2039 | } | ||
2040 | if (tool.Project->usePCH) | ||
2041 | tool.modifyPCHstage( strm, *it ); | ||
2042 | |||
1929 | strm << _begFile; | 2043 | strm << _begFile; |
1930 | strm << SPair( _RelativePath, *it ); | 2044 | strm << SPair( _RelativePath, *it ); |
1931 | strm << ">"; | 2045 | strm << ">"; |
1932 | if ( tool.CustomBuild == moc ) | 2046 | // Output custom build and compiler options |
1933 | tool.generateMOC( strm, *it ); | 2047 | // for all configurations |
1934 | else if ( tool.CustomBuild == uic ) | 2048 | if (tool.useCustomBuildTool || tool.useCompilerTool) { |
1935 | tool.generateUIC( strm, *it ); | 2049 | for ( uint i = 0; i < tool.Config->count(); i++ ) { |
2050 | strm << _begFileConfiguration; | ||
2051 | strm << _Name5; | ||
2052 | strm << (*tool.Config)[i].Name; | ||
2053 | strm << "\">"; | ||
2054 | if (tool.useCustomBuildTool) | ||
2055 | strm << tool.CustomBuildTool; | ||
2056 | if (tool.useCompilerTool) | ||
2057 | strm << tool.CompilerTool; | ||
2058 | strm << _endFileConfiguration; | ||
2059 | } | ||
2060 | } | ||
1936 | strm << _endFile; | 2061 | strm << _endFile; |
1937 | } | 2062 | } |
1938 | 2063 | // close remaining open filters, in non-flat mode | |
2064 | while ( !tool.flat_files && currentLevels-- ) { | ||
2065 | strm << _endFilter; | ||
2066 | } | ||
1939 | strm << _endFilter; | 2067 | strm << _endFilter; |
1940 | return strm; | 2068 | return strm; |
1941 | } | 2069 | } |
1942 | 2070 | ||
1943 | // VCProject -------------------------------------------------------- | 2071 | // VCProject -------------------------------------------------------- |
1944 | VCProject::VCProject() | 2072 | VCProject::VCProject() |
1945 | { | 2073 | { |
1946 | #if defined(Q_WS_WIN32) | 2074 | VCConfiguration conf; |
1947 | GUID guid; | 2075 | Configuration += conf ; // Release |
1948 | QUuid uniqueId; | 2076 | //Configuration += conf ; // Debug added later, after Release init |
1949 | HRESULT h = CoCreateGuid( &guid ); | ||
1950 | if ( h == S_OK ) | ||
1951 | uniqueId = QUuid( guid ); | ||
1952 | ProjectGUID = uniqueId.toString(); | ||
1953 | #else | ||
1954 | // Qt doesn't support GUID on other platforms yet | ||
1955 | ProjectGUID = ""; | ||
1956 | #endif | ||
1957 | } | 2077 | } |
1958 | 2078 | ||
1959 | QTextStream &operator<<( QTextStream &strm, const VCProject &tool ) | 2079 | QTextStream &operator<<( QTextStream &strm, const VCProject &tool ) |
1960 | { | 2080 | { |
1961 | strm << _xmlInit; | 2081 | strm << _xmlInit; |
1962 | strm << _begVisualStudioProject; | 2082 | strm << _begVisualStudioProject; |
1963 | strm << _ProjectType; | 2083 | strm << _ProjectType; |
1964 | strm << SPair( _Version1, tool.Version ); | 2084 | strm << SPair( _Version1, tool.Version ); |
1965 | strm << SPair( _Name1, tool.Name ); | 2085 | strm << SPair( _Name1, tool.Name ); |
1966 | strm << SPair( _ProjectGUID, tool.ProjectGUID ); | 2086 | strm << SPair( _ProjectGUID, tool.ProjectGUID ); |
1967 | strm << SPair( _SccProjectName, tool.SccProjectName ); | 2087 | strm << SPair( _SccProjectName, tool.SccProjectName ); |
1968 | strm << SPair( _SccLocalPath, tool.SccLocalPath ); | 2088 | strm << SPair( _SccLocalPath, tool.SccLocalPath ); |
1969 | strm << ">"; | 2089 | strm << ">"; |
1970 | strm << _begPlatforms; | 2090 | strm << _begPlatforms; |
1971 | strm << _begPlatform; | 2091 | strm << _begPlatform; |
1972 | strm << SPair( _Name3, tool.PlatformName ); | 2092 | strm << SPair( _Name3, tool.PlatformName ); |
1973 | strm << "/>"; | 2093 | strm << "/>"; |
1974 | strm << _endPlatforms; | 2094 | strm << _endPlatforms; |
1975 | strm << _begConfigurations; | 2095 | strm << _begConfigurations; |
1976 | strm << tool.Configuration; | 2096 | for ( uint i = 0; i < tool.Configuration.count(); i++ ) |
2097 | strm << tool.Configuration[i]; | ||
1977 | strm << _endConfigurations; | 2098 | strm << _endConfigurations; |
1978 | strm << _begFiles; | 2099 | strm << _begFiles; |
1979 | strm << tool.SourceFiles; | 2100 | strm << (VCFilter&)tool.SourceFiles; |
1980 | strm << tool.HeaderFiles; | 2101 | strm << (VCFilter&)tool.HeaderFiles; |
1981 | strm << tool.MOCFiles; | 2102 | strm << (VCFilter&)tool.MOCFiles; |
1982 | strm << tool.UICFiles; | 2103 | strm << (VCFilter&)tool.UICFiles; |
1983 | strm << tool.FormFiles; | 2104 | strm << (VCFilter&)tool.FormFiles; |
1984 | strm << tool.TranslationFiles; | 2105 | strm << (VCFilter&)tool.TranslationFiles; |
1985 | strm << tool.LexYaccFiles; | 2106 | strm << (VCFilter&)tool.LexYaccFiles; |
1986 | strm << tool.ResourceFiles; | 2107 | strm << (VCFilter&)tool.ResourceFiles; |
1987 | strm << _endFiles; | 2108 | strm << _endFiles; |
1988 | strm << _begGlobals; | 2109 | strm << _begGlobals; |
1989 | strm << _endGlobals; | 2110 | strm << _endGlobals; |
1990 | strm << _endVisualStudioProject; | 2111 | strm << _endVisualStudioProject; |
1991 | return strm; | 2112 | return strm; |
1992 | } | 2113 | } |