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,9 +1,9 @@ | |||
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 | ** |
@@ -39,17 +39,3 @@ | |||
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 | ||
@@ -283,3 +269,2 @@ struct XPair { | |||
283 | 269 | ||
284 | |||
285 | // Streaming operators for property Pairs --------------------------- | 270 | // Streaming operators for property Pairs --------------------------- |
@@ -320,3 +305,3 @@ QTextStream &operator<<( QTextStream &strm, const SPair &prop ) | |||
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; |
@@ -336,3 +321,3 @@ VCCLCompilerTool::VCCLCompilerTool() | |||
336 | BrowseInformation( brInfoNone ), | 321 | BrowseInformation( brInfoNone ), |
337 | BufferSecurityCheck( unset ), | 322 | BufferSecurityCheck( _False ), |
338 | CallingConvention( callConventionDefault ), | 323 | CallingConvention( callConventionDefault ), |
@@ -348,3 +333,3 @@ VCCLCompilerTool::VCCLCompilerTool() | |||
348 | EnableIntrinsicFunctions( unset ), | 333 | EnableIntrinsicFunctions( unset ), |
349 | ExceptionHandling( unset ), | 334 | ExceptionHandling( _False ), |
350 | ExpandAttributedSource( unset ), | 335 | ExpandAttributedSource( unset ), |
@@ -356,3 +341,3 @@ VCCLCompilerTool::VCCLCompilerTool() | |||
356 | ImproveFloatingPointConsistency( unset ), | 341 | ImproveFloatingPointConsistency( unset ), |
357 | InlineFunctionExpansion( expandOnlyInline ), | 342 | InlineFunctionExpansion( expandDefault ), |
358 | KeepComments( unset ), | 343 | KeepComments( unset ), |
@@ -360,5 +345,6 @@ VCCLCompilerTool::VCCLCompilerTool() | |||
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 ), |
@@ -373,3 +359,3 @@ VCCLCompilerTool::VCCLCompilerTool() | |||
373 | UndefineAllPreprocessorDefinitions( unset ), | 359 | UndefineAllPreprocessorDefinitions( unset ), |
374 | UsePrecompiledHeader( pchGenerateAuto ), | 360 | UsePrecompiledHeader( pchNone ), |
375 | WarnAsError( unset ), | 361 | WarnAsError( unset ), |
@@ -397,3 +383,3 @@ QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool ) | |||
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 ); |
@@ -411,3 +397,3 @@ QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool ) | |||
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 ); |
@@ -415,3 +401,3 @@ QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool ) | |||
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 ); |
@@ -420,3 +406,3 @@ QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool ) | |||
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 ); |
@@ -427,4 +413,4 @@ QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool ) | |||
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 ); |
@@ -443,3 +429,3 @@ QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool ) | |||
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 ); |
@@ -476,3 +462,3 @@ bool VCCLCompilerTool::parseOption( const char* option ) | |||
476 | } | 462 | } |
477 | AdditionalUsingDirectories += option+2; | 463 | AdditionalUsingDirectories += option+3; |
478 | break; | 464 | break; |
@@ -482,3 +468,3 @@ bool VCCLCompilerTool::parseOption( const char* option ) | |||
482 | case 'D': | 468 | case 'D': |
483 | PreprocessorDefinitions += option+1; | 469 | PreprocessorDefinitions += option+2; |
484 | break; | 470 | break; |
@@ -486,3 +472,5 @@ bool VCCLCompilerTool::parseOption( const char* option ) | |||
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 |
@@ -492,2 +480,7 @@ bool VCCLCompilerTool::parseOption( const char* 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 | } |
@@ -593,2 +586,5 @@ bool VCCLCompilerTool::parseOption( const char* option ) | |||
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': |
@@ -956,6 +952,6 @@ VCLinkerTool::VCLinkerTool() | |||
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 ), |
@@ -1021,3 +1017,3 @@ QTextStream &operator<<( QTextStream &strm, const VCLinkerTool &tool ) | |||
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 ); |
@@ -1709,5 +1705,5 @@ QTextStream &operator<<( QTextStream &strm, const VCCustomBuildTool &tool ) | |||
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 ); |
@@ -1828,39 +1824,35 @@ VCFilter::VCFilter() | |||
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"); |
@@ -1897,23 +1889,99 @@ void VCFilter::generateUIC( QTextStream &strm, const QString& str ) const | |||
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 | { |
@@ -1927,3 +1995,49 @@ QTextStream &operator<<( QTextStream &strm, const VCFilter &tool ) | |||
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; |
@@ -1931,9 +2045,23 @@ QTextStream &operator<<( QTextStream &strm, const VCFilter &tool ) | |||
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; |
@@ -1945,13 +2073,5 @@ 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 | } |
@@ -1975,13 +2095,14 @@ QTextStream &operator<<( QTextStream &strm, const VCProject &tool ) | |||
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; |