Diffstat (limited to 'qmake/generators/win32/msvc_objectmodel.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | qmake/generators/win32/msvc_objectmodel.cpp | 243 |
1 files changed, 140 insertions, 103 deletions
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index c2b9e30..7ffe4f7 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -256,23 +256,23 @@ struct TPair { TPair( const char* n, const triState v ) : name(n), value(v) {}; - const char* name; - const triState value; + const char* name; + const triState value; }; -struct EPair { +struct EPair { EPair( const char* n, const int v ) : name(n), value(v) {}; - const char* name; + const char* name; const int value; }; -struct LPair { +struct LPair { LPair( const char* n, const long v ) : name(n), value(v) {}; - const char* name; - const long value; + const char* name; + const long value; }; -struct SPair { +struct SPair { SPair( const char* n, const QString& v ) : name(n), value(v) {}; - const char* name; - const QString& value; + const char* name; + const QString& value; }; -struct XPair { +struct XPair { XPair( const char* n, const QStringList& v, const char* s = "," ) : name(n), value(v), sep(s) {}; - const char* name; + const char* name; const QStringList& value; @@ -385,3 +385,3 @@ QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool ) strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories ); - strm << XPair( _AdditionalOptions, tool.AdditionalOptions ); + strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " ); strm << XPair( _AdditionalUsingDirectories, tool.AdditionalUsingDirectories ); @@ -444,3 +444,3 @@ QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool ) strm << EPair( _WarningLevel, tool.WarningLevel ); - strm << TPair( _WholeProgramOptimization, tool.WholeProgramOptimization ); + strm << TPair( _WholeProgramOptimization, tool.WholeProgramOptimization ); strm << "/>"; @@ -452,3 +452,3 @@ bool VCCLCompilerTool::parseOption( const char* option ) // skip index 0 ('/' or '-') - char first = option[1]; + char first = option[1]; char second = option[2]; @@ -456,2 +456,3 @@ bool VCCLCompilerTool::parseOption( const char* option ) char fourth = option[4]; + bool found = TRUE; @@ -461,13 +462,16 @@ bool VCCLCompilerTool::parseOption( const char* option ) qWarning( "Generator: Option '/?', '/help': MSVC.NET projects do not support outputting help info" ); - return FALSE; + found = FALSE; + break; case '@': qWarning( "Generator: Option '/@': MSVC.NET projects do not support the use of a response file" ); - return FALSE; + found = FALSE; + break; case 'l': qWarning( "Generator: Option '/link': qmake generator does not support passing link options through the compiler tool" ); - return FALSE; - + found = FALSE; + break; case 'A': - if ( second != 'I' ) - return FALSE; + if ( second != 'I' ) { + found = FALSE; break; + } AdditionalUsingDirectories += option+2; @@ -489,3 +493,3 @@ bool VCCLCompilerTool::parseOption( const char* option ) } - return FALSE; + found = FALSE; break; } @@ -546,3 +550,3 @@ bool VCCLCompilerTool::parseOption( const char* option ) default: - return FALSE; + found = FALSE; break; } @@ -555,3 +559,3 @@ bool VCCLCompilerTool::parseOption( const char* option ) qWarning( "Option '/G3' and '/G4' were phased out in Visual C++ 5.0" ); - return FALSE; + found = FALSE; break; case '5': @@ -621,3 +625,3 @@ bool VCCLCompilerTool::parseOption( const char* option ) default: - return FALSE; + found = FALSE; break; } @@ -635,3 +639,3 @@ bool VCCLCompilerTool::parseOption( const char* option ) } - return FALSE; + found = FALSE; break; case 'M': @@ -653,3 +657,3 @@ bool VCCLCompilerTool::parseOption( const char* option ) } - return FALSE; + found = FALSE; break; case 'O': @@ -673,3 +677,3 @@ bool VCCLCompilerTool::parseOption( const char* option ) else - return FALSE; + found = FALSE; break; @@ -707,3 +711,3 @@ bool VCCLCompilerTool::parseOption( const char* option ) default: - return FALSE; + found = FALSE; break; } @@ -718,3 +722,3 @@ bool VCCLCompilerTool::parseOption( const char* option ) } - return FALSE; + found = FALSE; break; case 'R': @@ -730,3 +734,3 @@ bool VCCLCompilerTool::parseOption( const char* option ) else - return FALSE; + found = FALSE; break; } @@ -740,3 +744,3 @@ bool VCCLCompilerTool::parseOption( const char* option ) qWarning( "Generator: Options '/Tp<filename>' and '/Tc<filename>' are not supported by qmake" ); - return FALSE; + found = FALSE; break; } @@ -780,3 +784,3 @@ bool VCCLCompilerTool::parseOption( const char* option ) default: - return FALSE; + found = FALSE; break; } @@ -809,3 +813,3 @@ bool VCCLCompilerTool::parseOption( const char* option ) default: - return FALSE; + found = FALSE; break; } @@ -842,5 +846,5 @@ bool VCCLCompilerTool::parseOption( const char* option ) else - return FALSE; + found = FALSE; } else { - return FALSE; + found = FALSE; break; } @@ -871,3 +875,3 @@ bool VCCLCompilerTool::parseOption( const char* option ) default: - return FALSE; + found = FALSE; break; } @@ -875,3 +879,3 @@ bool VCCLCompilerTool::parseOption( const char* option ) default: - return FALSE; + found = FALSE; break; } @@ -889,3 +893,3 @@ bool VCCLCompilerTool::parseOption( const char* option ) } else { - return FALSE; + found = FALSE; break; } @@ -893,4 +897,5 @@ bool VCCLCompilerTool::parseOption( const char* option ) case 'd': - if ( second != 'r' ) - return FALSE; + if ( second != 'r' ) { + found = FALSE; break; + } CompileAsManaged = managedAssembly; @@ -906,3 +911,3 @@ bool VCCLCompilerTool::parseOption( const char* option ) } - return FALSE; + found = FALSE; break; case 's': @@ -912,3 +917,3 @@ bool VCCLCompilerTool::parseOption( const char* option ) } - return FALSE; + found = FALSE; break; case 'u': @@ -921,3 +926,3 @@ bool VCCLCompilerTool::parseOption( const char* option ) } - return FALSE; + found = FALSE; break; case 'w': @@ -935,4 +940,6 @@ bool VCCLCompilerTool::parseOption( const char* option ) default: - return FALSE; + found = FALSE; break; } + if( !found ) + warn_msg( WarnLogic, "Could not parse Compiler option: %s", option ); return TRUE; @@ -982,3 +989,3 @@ QTextStream &operator<<( QTextStream &strm, const VCLinkerTool &tool ) strm << XPair( _AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories ); - strm << XPair( _AdditionalOptions, tool.AdditionalOptions ); + strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " ); strm << XPair( _AddModuleNamesToAssembly, tool.AddModuleNamesToAssembly ); @@ -1048,4 +1055,4 @@ static uint elfHash( const char* name ) k = (const uchar *) name; - while ( (*k) && - (*k)!= ':' && + while ( (*k) && + (*k)!= ':' && (*k)!=',' && @@ -1062,2 +1069,5 @@ static uint elfHash( const char* name ) } + +//#define USE_DISPLAY_HASH +#ifdef USE_DISPLAY_HASH static void displayHash( const char* str ) @@ -1066,2 +1076,3 @@ static void displayHash( const char* str ) } +#endif @@ -1069,34 +1080,34 @@ bool VCLinkerTool::parseOption( const char* option ) { -#if 0 +#ifdef USE_DISPLAY_HASH // Main options - displayHash( "/ALIGN" ); displayHash( "/ALLOWBIND" ); displayHash( "/ASSEMBLYMODULE" ); - displayHash( "/ASSEMBLYRESOURCE" ); displayHash( "/BASE" ); displayHash( "/DEBUG" ); - displayHash( "/DEF" ); displayHash( "/DEFAULTLIB" ); displayHash( "/DELAY" ); - displayHash( "/DELAYLOAD" ); displayHash( "/DLL" ); displayHash( "/DRIVER" ); - displayHash( "/ENTRY" ); displayHash( "/EXETYPE" ); displayHash( "/EXPORT" ); - displayHash( "/FIXED" ); displayHash( "/FORCE" ); displayHash( "/HEAP" ); - displayHash( "/IDLOUT" ); displayHash( "/IGNOREIDL" ); displayHash( "/IMPLIB" ); - displayHash( "/INCLUDE" ); displayHash( "/INCREMENTAL" ); displayHash( "/LARGEADDRESSAWARE" ); - displayHash( "/LIBPATH" ); displayHash( "/LTCG" ); displayHash( "/MACHINE" ); - displayHash( "/MAP" ); displayHash( "/MAPINFO" ); displayHash( "/MERGE" ); - displayHash( "/MIDL" ); displayHash( "/NOASSEMBLY" ); displayHash( "/NODEFAULTLIB" ); - displayHash( "/NOENTRY" ); displayHash( "/NOLOGO" ); displayHash( "/OPT" ); - displayHash( "/ORDER" ); displayHash( "/OUT" ); displayHash( "/PDB" ); - displayHash( "/PDBSTRIPPED" ); displayHash( "/RELEASE" ); displayHash( "/SECTION" ); - displayHash( "/STACK" ); displayHash( "/STUB" ); displayHash( "/SUBSYSTEM" ); - displayHash( "/SWAPRUN" ); displayHash( "/TLBID" ); displayHash( "/TLBOUT" ); - displayHash( "/TSAWARE" ); displayHash( "/VERBOSE" ); displayHash( "/VERSION" ); + displayHash( "/ALIGN" ); displayHash( "/ALLOWBIND" ); displayHash( "/ASSEMBLYMODULE" ); + displayHash( "/ASSEMBLYRESOURCE" ); displayHash( "/BASE" ); displayHash( "/DEBUG" ); + displayHash( "/DEF" ); displayHash( "/DEFAULTLIB" ); displayHash( "/DELAY" ); + displayHash( "/DELAYLOAD" ); displayHash( "/DLL" ); displayHash( "/DRIVER" ); + displayHash( "/ENTRY" ); displayHash( "/EXETYPE" ); displayHash( "/EXPORT" ); + displayHash( "/FIXED" ); displayHash( "/FORCE" ); displayHash( "/HEAP" ); + displayHash( "/IDLOUT" ); displayHash( "/IGNOREIDL" ); displayHash( "/IMPLIB" ); + displayHash( "/INCLUDE" ); displayHash( "/INCREMENTAL" ); displayHash( "/LARGEADDRESSAWARE" ); + displayHash( "/LIBPATH" ); displayHash( "/LTCG" ); displayHash( "/MACHINE" ); + displayHash( "/MAP" ); displayHash( "/MAPINFO" ); displayHash( "/MERGE" ); + displayHash( "/MIDL" ); displayHash( "/NOASSEMBLY" ); displayHash( "/NODEFAULTLIB" ); + displayHash( "/NOENTRY" ); displayHash( "/NOLOGO" ); displayHash( "/OPT" ); + displayHash( "/ORDER" ); displayHash( "/OUT" ); displayHash( "/PDB" ); + displayHash( "/PDBSTRIPPED" ); displayHash( "/RELEASE" ); displayHash( "/SECTION" ); + displayHash( "/STACK" ); displayHash( "/STUB" ); displayHash( "/SUBSYSTEM" ); + displayHash( "/SWAPRUN" ); displayHash( "/TLBID" ); displayHash( "/TLBOUT" ); + displayHash( "/TSAWARE" ); displayHash( "/VERBOSE" ); displayHash( "/VERSION" ); displayHash( "/VXD" ); displayHash( "/WS " ); #endif -#if 0 +#ifdef USE_DISPLAY_HASH // Sub options displayHash( "UNLOAD" ); displayHash( "NOBIND" ); displayHash( "no" ); displayHash( "NOSTATUS" ); displayHash( "STATUS" ); - displayHash( "AM33" ); displayHash( "ARM" ); displayHash( "CEE" ); displayHash( "IA64" ); displayHash( "X86" ); displayHash( "M32R" ); - displayHash( "MIPS" ); displayHash( "MIPS16" ); displayHash( "MIPSFPU" ); displayHash( "MIPSFPU16" ); displayHash( "MIPSR41XX" ); displayHash( "PPC" ); - displayHash( "SH3" ); displayHash( "SH4" ); displayHash( "SH5" ); displayHash( "THUMB" ); displayHash( "TRICORE" ); displayHash( "EXPORTS" ); - displayHash( "LINES" ); displayHash( "REF" ); displayHash( "NOREF" ); displayHash( "ICF" ); displayHash( "WIN98" ); displayHash( "NOWIN98" ); - displayHash( "CONSOLE" ); displayHash( "EFI_APPLICATION" ); displayHash( "EFI_BOOT_SERVICE_DRIVER" ); displayHash( "EFI_ROM" ); displayHash( "EFI_RUNTIME_DRIVER" ); displayHash( "NATIVE" ); - displayHash( "POSIX" ); displayHash( "WINDOWS" ); displayHash( "WINDOWSCE" ); displayHash( "NET" ); displayHash( "CD" ); displayHash( "NO" ); + displayHash( "AM33" ); displayHash( "ARM" ); displayHash( "CEE" ); displayHash( "IA64" ); displayHash( "X86" ); displayHash( "M32R" ); + displayHash( "MIPS" ); displayHash( "MIPS16" ); displayHash( "MIPSFPU" ); displayHash( "MIPSFPU16" ); displayHash( "MIPSR41XX" ); displayHash( "PPC" ); + displayHash( "SH3" ); displayHash( "SH4" ); displayHash( "SH5" ); displayHash( "THUMB" ); displayHash( "TRICORE" ); displayHash( "EXPORTS" ); + displayHash( "LINES" ); displayHash( "REF" ); displayHash( "NOREF" ); displayHash( "ICF" ); displayHash( "WIN98" ); displayHash( "NOWIN98" ); + displayHash( "CONSOLE" ); displayHash( "EFI_APPLICATION" ); displayHash( "EFI_BOOT_SERVICE_DRIVER" ); displayHash( "EFI_ROM" ); displayHash( "EFI_RUNTIME_DRIVER" ); displayHash( "NATIVE" ); + displayHash( "POSIX" ); displayHash( "WINDOWS" ); displayHash( "WINDOWSCE" ); displayHash( "NET" ); displayHash( "CD" ); displayHash( "NO" ); #endif - + bool found = TRUE; switch ( elfHash(option) ) { @@ -1143,3 +1154,3 @@ bool VCLinkerTool::parseOption( const char* option ) // case 0x003390c: // /DLL - // This option is not used for vcproj files + // This option is not used for vcproj files // break; @@ -1194,3 +1205,3 @@ bool VCLinkerTool::parseOption( const char* option ) switch ( elfHash(option+9) ) { - // Very limited documentation on all options but X86, + // Very limited documentation on all options but X86, // so we put the others in AdditionalOptions... @@ -1218,3 +1229,3 @@ bool VCLinkerTool::parseOption( const char* option ) default: - return FALSE; + found = FALSE; } @@ -1277,3 +1288,3 @@ bool VCLinkerTool::parseOption( const char* option ) default: - return FALSE; + found = FALSE; } @@ -1326,3 +1337,3 @@ bool VCLinkerTool::parseOption( const char* option ) default: - return FALSE; + found = FALSE; } @@ -1336,3 +1347,3 @@ bool VCLinkerTool::parseOption( const char* option ) else - return FALSE; + found = FALSE; break; @@ -1362,5 +1373,7 @@ bool VCLinkerTool::parseOption( const char* option ) default: - return FALSE; + found = FALSE; } - return TRUE; + if( !found ) + warn_msg( WarnLogic, "Could not parse Linker options: %s", option ); + return found; } @@ -1394,3 +1407,3 @@ QTextStream &operator<<( QTextStream &strm, const VCMIDLTool &tool ) strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories ); - strm << XPair( _AdditionalOptions, tool.AdditionalOptions ); + strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " ); strm << XPair( _CPreprocessOptions, tool.CPreprocessOptions ); @@ -1429,3 +1442,3 @@ bool VCMIDLTool::parseOption( const char* option ) { -#if 0 +#ifdef USE_DISPLAY_HASH displayHash( "/D name[=def]" ); displayHash( "/I directory-list" ); displayHash( "/Oi" ); @@ -1437,3 +1450,3 @@ bool VCMIDLTool::parseOption( const char* option ) displayHash( "/client none" ); displayHash( "/client stub" ); displayHash( "/confirm" ); - displayHash( "/cpp_cmd cmd_line" ); displayHash( "/cpp_opt options" ); + displayHash( "/cpp_cmd cmd_line" ); displayHash( "/cpp_opt options" ); displayHash( "/cstub filename" ); displayHash( "/dlldata filename" ); displayHash( "/env win32" ); @@ -1447,3 +1460,3 @@ bool VCMIDLTool::parseOption( const char* option ) displayHash( "/no_warn" ); displayHash( "/nocpp" ); displayHash( "/nologo" ); displayHash( "/notlb" ); - displayHash( "/o filename" ); displayHash( "/oldnames" ); displayHash( "/oldtlb" ); + displayHash( "/o filename" ); displayHash( "/oldnames" ); displayHash( "/oldtlb" ); displayHash( "/osf" ); displayHash( "/out directory" ); displayHash( "/pack {N}" ); @@ -1457,2 +1470,3 @@ bool VCMIDLTool::parseOption( const char* option ) #endif + bool found = TRUE; int offset = 0; @@ -1492,3 +1506,3 @@ bool VCMIDLTool::parseOption( const char* option ) default: - return FALSE; + found = FALSE; } @@ -1507,3 +1521,3 @@ bool VCMIDLTool::parseOption( const char* option ) default: - return FALSE; + found = FALSE; } @@ -1538,9 +1552,9 @@ bool VCMIDLTool::parseOption( const char* option ) case 'r': - break; ErrorCheckRefPointers = _True; - case 's': break; + case 's': ErrorCheckStubData = _True; + break; default: - return FALSE; + found = FALSE; } @@ -1649,3 +1663,3 @@ bool VCMIDLTool::parseOption( const char* option ) default: - return FALSE; + found = FALSE; } @@ -1654,2 +1668,4 @@ bool VCMIDLTool::parseOption( const char* option ) } + if( !found ) + warn_msg( WarnLogic, "Could not parse MIDL option: %s", option ); return TRUE; @@ -1670,3 +1686,3 @@ QTextStream &operator<<( QTextStream &strm, const VCLibrarianTool &tool ) strm << XPair( _AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories ); - strm << XPair( _AdditionalOptions, tool.AdditionalOptions ); + strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " ); strm << XPair( _ExportNamedFunctions, tool.ExportNamedFunctions ); @@ -1716,3 +1732,3 @@ QTextStream &operator<<( QTextStream &strm, const VCResourceCompilerTool &tool ) strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories ); - strm << XPair( _AdditionalOptions, tool.AdditionalOptions ); + strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " ); if ( tool.Culture != rcUseDefault ) strm << EPair( _Culture, tool.Culture ); @@ -1853,9 +1869,30 @@ void VCFilter::generateUIC( QTextStream &strm, const QString& str ) const QString mocDir = Project->var( "MOC_DIR" ); + QString uiDir = Project->var( "UI_DIR" ); + QString uiHeaders; + QString uiSources; + + // Determining the paths for the output files. + int slash = str.findRev( '\\' ); + QString pname = ( slash != -1 ) ? str.left( slash+1 ) : QString( ".\\" ); + if( !uiDir.isEmpty() ) { + uiHeaders = uiDir; + uiSources = uiDir; + } else { + uiHeaders = Project->var( "UI_HEADERS_DIR" ); + uiSources = Project->var( "UI_SOURCES_DIR" ); + if( uiHeaders.isEmpty() ) + uiHeaders = pname; + if( uiSources.isEmpty() ) + uiSources = pname; + } + if( !uiHeaders.endsWith( "\\" ) ) + uiHeaders += "\\"; + if( !uiSources.endsWith( "\\" ) ) + uiSources += "\\"; + + // Determine the file name. int dot = fname.findRev( '.' ); - if( dot != -1 ) + if( dot != -1 ) fname.truncate( dot ); - int slash = str.findRev( '\\' ); - QString pname = ( slash != -1 ) ? str.left( slash+1 ) : QString(".\\"); - strm << _begFileConfiguration; @@ -1869,5 +1906,5 @@ void VCFilter::generateUIC( QTextStream &strm, const QString& str ) const strm << _CommandLine6; - strm << uicApp << " " << str << " -o " << pname << fname << ".h && "; // Create .h from .ui file - strm << uicApp << " " << str << " -i " << fname << ".h -o " << pname << fname << ".cpp && "; // Create .cpp from .ui file - strm << mocApp << " " << pname << fname << ".h -o " << mocDir << "moc_" << fname << ".cpp\""; + strm << uicApp << " " << str << " -o " << uiHeaders << fname << ".h && "; // Create .h from .ui file + strm << uicApp << " " << str << " -i " << fname << ".h -o " << uiSources << fname << ".cpp && "; // Create .cpp from .ui file + strm << mocApp << " " << uiHeaders << fname << ".h -o " << mocDir << "moc_" << fname << ".cpp\""; strm << _AdditionalDependencies6; @@ -1875,3 +1912,3 @@ void VCFilter::generateUIC( QTextStream &strm, const QString& str ) const strm << _Outputs6; - strm << pname << fname << ".h;" << pname << fname << ".cpp;" << mocDir << "moc_" << fname << ".cpp\""; + strm << uiHeaders << fname << ".h;" << uiSources << fname << ".cpp;" << mocDir << "moc_" << fname << ".cpp\""; strm << "/>"; @@ -1908,5 +1945,5 @@ VCProject::VCProject() { - QUuid uniqueId; #if defined(Q_WS_WIN32) GUID guid; + QUuid uniqueId; HRESULT h = CoCreateGuid( &guid ); |