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,11 +1,11 @@ | |||
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 |
@@ -37,21 +37,7 @@ | |||
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\"?>"; |
@@ -281,7 +267,6 @@ struct XPair { | |||
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 | { |
@@ -318,7 +303,7 @@ QTextStream &operator<<( QTextStream &strm, const LPair &prop ) | |||
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 | ||
@@ -334,7 +319,7 @@ 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 ), |
@@ -346,7 +331,7 @@ VCCLCompilerTool::VCCLCompilerTool() | |||
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 ), |
@@ -354,13 +339,14 @@ VCCLCompilerTool::VCCLCompilerTool() | |||
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 ), |
@@ -371,7 +357,7 @@ VCCLCompilerTool::VCCLCompilerTool() | |||
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 ) |
@@ -395,7 +381,7 @@ QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool ) | |||
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 ); |
@@ -409,24 +395,24 @@ QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool ) | |||
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 ); |
@@ -441,7 +427,7 @@ QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool ) | |||
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; |
@@ -474,22 +460,29 @@ bool VCCLCompilerTool::parseOption( const char* option ) | |||
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 | } |
@@ -591,6 +584,9 @@ bool VCCLCompilerTool::parseOption( const char* option ) | |||
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': |
@@ -954,10 +950,10 @@ VCLinkerTool::VCLinkerTool() | |||
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 ), |
@@ -1019,7 +1015,7 @@ QTextStream &operator<<( QTextStream &strm, const VCLinkerTool &tool ) | |||
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 ); |
@@ -1707,9 +1703,9 @@ QTextStream &operator<<( QTextStream &strm, const VCCustomBuildTool &tool ) | |||
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; |
@@ -1826,43 +1822,39 @@ QTextStream &operator<<( QTextStream &strm, const VCConfiguration &tool ) | |||
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 ); |
@@ -1895,27 +1887,103 @@ void VCFilter::generateUIC( QTextStream &strm, const QString& str ) const | |||
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; |
@@ -1925,17 +1993,77 @@ QTextStream &operator<<( QTextStream &strm, const VCFilter &tool ) | |||
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 | } |
@@ -1943,17 +2071,9 @@ QTextStream &operator<<( QTextStream &strm, const VCFilter &tool ) | |||
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 ) |
@@ -1973,17 +2093,18 @@ QTextStream &operator<<( QTextStream &strm, const VCProject &tool ) | |||
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; |