summaryrefslogtreecommitdiff
path: root/qmake/generators/win32/msvc_objectmodel.cpp
Side-by-side diff
Diffstat (limited to 'qmake/generators/win32/msvc_objectmodel.cpp') (more/less context) (show whitespace changes)
-rw-r--r--qmake/generators/win32/msvc_objectmodel.cpp155
1 files changed, 96 insertions, 59 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
@@ -383,7 +383,7 @@ QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool )
strm << _begTool3;
strm << _VCCLCompilerToolName;
strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories );
- strm << XPair( _AdditionalOptions, tool.AdditionalOptions );
+ strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " );
strm << XPair( _AdditionalUsingDirectories, tool.AdditionalUsingDirectories );
strm << SPair( _AssemblerListingLocation, tool.AssemblerListingLocation );
if ( tool.AssemblerOutput != asmListingNone ) strm << EPair( _AssemblerOutput, tool.AssemblerOutput );
@@ -454,22 +454,26 @@ bool VCCLCompilerTool::parseOption( const char* option )
char second = option[2];
char third = option[3];
char fourth = option[4];
+ bool found = TRUE;
switch ( first ) {
case '?':
case 'h':
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;
break;
case 'C':
@@ -487,7 +491,7 @@ bool VCCLCompilerTool::parseOption( const char* option )
AdditionalOptions += option;
break;
}
- return FALSE;
+ found = FALSE; break;
}
GeneratePreprocessedFile = preprocessYes;
break;
@@ -544,7 +548,7 @@ bool VCCLCompilerTool::parseOption( const char* option )
ExpandAttributedSource = _True;
break;
default:
- return FALSE;
+ found = FALSE; break;
}
}
break;
@@ -553,7 +557,7 @@ bool VCCLCompilerTool::parseOption( const char* option )
case '3':
case '4':
qWarning( "Option '/G3' and '/G4' were phased out in Visual C++ 5.0" );
- return FALSE;
+ found = FALSE; break;
case '5':
OptimizeForProcessor = procOptimizePentium;
break;
@@ -619,7 +623,7 @@ bool VCCLCompilerTool::parseOption( const char* option )
CallingConvention = callConventionStdCall;
break;
default:
- return FALSE;
+ found = FALSE; break;
}
break;
case 'H':
@@ -633,7 +637,7 @@ bool VCCLCompilerTool::parseOption( const char* option )
AdditionalOptions += option;
break;
}
- return FALSE;
+ found = FALSE; break;
case 'M':
if ( second == 'D' ) {
RuntimeLibrary = rtMultiThreadedDLL;
@@ -651,7 +655,7 @@ bool VCCLCompilerTool::parseOption( const char* option )
RuntimeLibrary = rtMultiThreadedDebug;
break;
}
- return FALSE;
+ found = FALSE; break;
case 'O':
switch ( second ) {
case '1':
@@ -671,7 +675,7 @@ bool VCCLCompilerTool::parseOption( const char* option )
else if ( third == '2' )
InlineFunctionExpansion = expandAnySuitable;
else
- return FALSE;
+ found = FALSE;
break;
case 'd':
Optimization = optimizeDisabled;
@@ -705,7 +709,7 @@ bool VCCLCompilerTool::parseOption( const char* option )
OmitFramePointers = _False;
break;
default:
- return FALSE;
+ found = FALSE; break;
}
break;
case 'P':
@@ -716,7 +720,7 @@ bool VCCLCompilerTool::parseOption( const char* option )
AdditionalOptions += option;
break;
}
- return FALSE;
+ found = FALSE; break;
case 'R':
if ( second == 'T' && third == 'C' ) {
if ( fourth == '1' )
@@ -728,7 +732,7 @@ bool VCCLCompilerTool::parseOption( const char* option )
else if ( fourth == 'u' )
BasicRuntimeChecks = runtimeCheckUninitVariables;
else
- return FALSE;
+ found = FALSE; break;
}
break;
case 'T':
@@ -738,7 +742,7 @@ bool VCCLCompilerTool::parseOption( const char* option )
CompileAs = compileAsCPlusPlus;
} else {
qWarning( "Generator: Options '/Tp<filename>' and '/Tc<filename>' are not supported by qmake" );
- return FALSE;
+ found = FALSE; break;
}
break;
case 'U':
@@ -778,7 +782,7 @@ bool VCCLCompilerTool::parseOption( const char* option )
}
// Fallthrough
default:
- return FALSE;
+ found = FALSE; break;
}
break;
case 'X':
@@ -807,7 +811,7 @@ bool VCCLCompilerTool::parseOption( const char* option )
PrecompiledHeaderFile = option+3;
break;
default:
- return FALSE;
+ found = FALSE; break;
}
break;
case 'Z':
@@ -840,9 +844,9 @@ bool VCCLCompilerTool::parseOption( const char* option )
else if ( fourth == 'w' )
TreatWChar_tAsBuiltInType = _True;
else
- return FALSE;
+ found = FALSE;
} else {
- return FALSE;
+ found = FALSE; break;
}
break;
case 'g':
@@ -869,11 +873,11 @@ bool VCCLCompilerTool::parseOption( const char* option )
StructMemberAlignment = alignEightBytes;
break;
default:
- return FALSE;
+ found = FALSE; break;
}
break;
default:
- return FALSE;
+ found = FALSE; break;
}
break;
case 'c':
@@ -887,12 +891,13 @@ bool VCCLCompilerTool::parseOption( const char* option )
CompileAsManaged = managedAssembly;
}
} else {
- return FALSE;
+ found = FALSE; break;
}
break;
case 'd':
- if ( second != 'r' )
- return FALSE;
+ if ( second != 'r' ) {
+ found = FALSE; break;
+ }
CompileAsManaged = managedAssembly;
break;
case 'n':
@@ -904,13 +909,13 @@ bool VCCLCompilerTool::parseOption( const char* option )
SuppressStartupBanner = _True;
break;
}
- return FALSE;
+ found = FALSE; break;
case 's':
if ( second == 'h' && third == 'o' && fourth == 'w' ) {
ShowIncludes = _True;
break;
}
- return FALSE;
+ found = FALSE; break;
case 'u':
UndefineAllPreprocessorDefinitions = _True;
break;
@@ -919,7 +924,7 @@ bool VCCLCompilerTool::parseOption( const char* option )
AdditionalOptions += option;
break;
}
- return FALSE;
+ found = FALSE; break;
case 'w':
switch ( second ) {
case '\0':
@@ -933,8 +938,10 @@ bool VCCLCompilerTool::parseOption( const char* option )
}
break;
default:
- return FALSE;
+ found = FALSE; break;
}
+ if( !found )
+ warn_msg( WarnLogic, "Could not parse Compiler option: %s", option );
return TRUE;
}
@@ -980,7 +987,7 @@ QTextStream &operator<<( QTextStream &strm, const VCLinkerTool &tool )
strm << _VCLinkerToolName;
strm << XPair( _AdditionalDependencies4, tool.AdditionalDependencies, " " );
strm << XPair( _AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories );
- strm << XPair( _AdditionalOptions, tool.AdditionalOptions );
+ strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " );
strm << XPair( _AddModuleNamesToAssembly, tool.AddModuleNamesToAssembly );
strm << SPair( _BaseAddress, tool.BaseAddress );
strm << XPair( _DelayLoadDLLs, tool.DelayLoadDLLs );
@@ -1060,14 +1067,18 @@ static uint elfHash( const char* name )
h = 1;
return h;
}
+
+//#define USE_DISPLAY_HASH
+#ifdef USE_DISPLAY_HASH
static void displayHash( const char* str )
{
printf( "case 0x%07x: // %s\n break;\n", elfHash(str), str );
}
+#endif
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" );
@@ -1088,7 +1099,7 @@ bool VCLinkerTool::parseOption( const char* option )
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" );
@@ -1098,7 +1109,7 @@ bool VCLinkerTool::parseOption( const char* option )
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) ) {
case 0x3360dbe: // /ALIGN[:number]
case 0x1485c34: // /ALLOWBIND[:NO]
@@ -1216,7 +1227,7 @@ bool VCLinkerTool::parseOption( const char* option )
TargetMachine = machineX86;
break;
default:
- return FALSE;
+ found = FALSE;
}
break;
case 0x0034160: // /MAP[:filename]
@@ -1275,7 +1286,7 @@ bool VCLinkerTool::parseOption( const char* option )
OptimizeForWindows98 = optWin98No;
break;
default:
- return FALSE;
+ found = FALSE;
}
}
break;
@@ -1324,7 +1335,7 @@ bool VCLinkerTool::parseOption( const char* option )
AdditionalOptions += option;
break;
default:
- return FALSE;
+ found = FALSE;
}
}
break;
@@ -1334,7 +1345,7 @@ bool VCLinkerTool::parseOption( const char* option )
else if ( *(option+9) == 'C' )
SwapRunFromCD = _True;
else
- return FALSE;
+ found = FALSE;
break;
case 0x34906d4: // /TLBID:id
TypeLibraryResourceID = QString( option+7 ).toLong();
@@ -1360,9 +1371,11 @@ bool VCLinkerTool::parseOption( const char* option )
Version = option+9;
break;
default:
- return FALSE;
+ found = FALSE;
}
- return TRUE;
+ if( !found )
+ warn_msg( WarnLogic, "Could not parse Linker options: %s", option );
+ return found;
}
// VCMIDLTool -------------------------------------------------------
@@ -1392,7 +1405,7 @@ QTextStream &operator<<( QTextStream &strm, const VCMIDLTool &tool )
strm << _begTool3;
strm << _VCMIDLToolName;
strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories );
- strm << XPair( _AdditionalOptions, tool.AdditionalOptions );
+ strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " );
strm << XPair( _CPreprocessOptions, tool.CPreprocessOptions );
strm << EPair( _DefaultCharType, tool.DefaultCharType );
strm << SPair( _DLLDataFileName, tool.DLLDataFileName );
@@ -1427,7 +1440,7 @@ QTextStream &operator<<( QTextStream &strm, const VCMIDLTool &tool )
bool VCMIDLTool::parseOption( const char* option )
{
-#if 0
+#ifdef USE_DISPLAY_HASH
displayHash( "/D name[=def]" ); displayHash( "/I directory-list" ); displayHash( "/Oi" );
displayHash( "/Oic" ); displayHash( "/Oicf" ); displayHash( "/Oif" ); displayHash( "/Os" );
displayHash( "/U name" ); displayHash( "/WX" ); displayHash( "/W{0|1|2|3|4}" );
@@ -1455,6 +1468,7 @@ bool VCMIDLTool::parseOption( const char* option )
displayHash( "/target {system}" ); displayHash( "/tlb filename" ); displayHash( "/use_epv" );
displayHash( "/win32" ); displayHash( "/win64" );
#endif
+ bool found = TRUE;
int offset = 0;
switch( elfHash(option) ) {
case 0x0000334: // /D name[=def]
@@ -1490,7 +1504,7 @@ bool VCMIDLTool::parseOption( const char* option )
StructMemberAlignment = midlAlignEightBytes;
break;
default:
- return FALSE;
+ found = FALSE;
}
break;
case 0x0359e82: // /char {ascii7|signed|unsigned}
@@ -1505,7 +1519,7 @@ bool VCMIDLTool::parseOption( const char* option )
DefaultCharType = midlCharUnsigned;
break;
default:
- return FALSE;
+ found = FALSE;
}
break;
case 0xa766524: // /cpp_opt options
@@ -1536,13 +1550,13 @@ bool VCMIDLTool::parseOption( const char* option )
EnableErrorChecks = midlDisableAll;
break;
case 'r':
- break;
ErrorCheckRefPointers = _True;
- case 's':
break;
+ case 's':
ErrorCheckStubData = _True;
+ break;
default:
- return FALSE;
+ found = FALSE;
}
break;
case 0x5eb7af2: // /header filename
@@ -1647,11 +1661,13 @@ bool VCMIDLTool::parseOption( const char* option )
WarningLevel = midlWarningLevel_4;
break;
default:
- return FALSE;
+ found = FALSE;
}
}
break;
}
+ if( !found )
+ warn_msg( WarnLogic, "Could not parse MIDL option: %s", option );
return TRUE;
}
@@ -1668,7 +1684,7 @@ QTextStream &operator<<( QTextStream &strm, const VCLibrarianTool &tool )
strm << SPair( _ToolName, QString( "VCLibrarianTool" ) );
strm << XPair( _AdditionalDependencies4, tool.AdditionalDependencies );
strm << XPair( _AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories );
- strm << XPair( _AdditionalOptions, tool.AdditionalOptions );
+ strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " );
strm << XPair( _ExportNamedFunctions, tool.ExportNamedFunctions );
strm << XPair( _ForceSymbolReferences, tool.ForceSymbolReferences );
strm << TPair( _IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries );
@@ -1714,7 +1730,7 @@ QTextStream &operator<<( QTextStream &strm, const VCResourceCompilerTool &tool )
strm << _VCResourceCompilerToolName;
strm << SPair( _ToolPath, tool.ToolPath );
strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories );
- strm << XPair( _AdditionalOptions, tool.AdditionalOptions );
+ strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " );
if ( tool.Culture != rcUseDefault ) strm << EPair( _Culture, tool.Culture );
strm << XPair( _FullIncludePath, tool.FullIncludePath );
strm << TPair( _IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath );
@@ -1851,12 +1867,33 @@ void VCFilter::generateUIC( QTextStream &strm, const QString& str ) const
QString mocApp = Project->var( "QMAKE_MOC" );
QString fname = str.section( '\\', -1 );
QString mocDir = Project->var( "MOC_DIR" );
- int dot = fname.findRev( '.' );
- if( dot != -1 )
- fname.truncate( dot );
+ 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 )
+ fname.truncate( dot );
strm << _begFileConfiguration;
strm << _Name5;
@@ -1867,13 +1904,13 @@ void VCFilter::generateUIC( QTextStream &strm, const QString& str ) const
strm << _Description6;
strm << "Uic'ing " << str << "...\"";
strm << _CommandLine6;
- strm << uicApp << " " << str << " -o " << pname << fname << ".h &amp;&amp; "; // Create .h from .ui file
- strm << uicApp << " " << str << " -i " << fname << ".h -o " << pname << fname << ".cpp &amp;&amp; "; // Create .cpp from .ui file
- strm << mocApp << " " << pname << fname << ".h -o " << mocDir << "moc_" << fname << ".cpp\"";
+ strm << uicApp << " " << str << " -o " << uiHeaders << fname << ".h &amp;&amp; "; // Create .h from .ui file
+ strm << uicApp << " " << str << " -i " << fname << ".h -o " << uiSources << fname << ".cpp &amp;&amp; "; // Create .cpp from .ui file
+ strm << mocApp << " " << uiHeaders << fname << ".h -o " << mocDir << "moc_" << fname << ".cpp\"";
strm << _AdditionalDependencies6;
strm << mocApp << ";" << uicApp << "\"";
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 << "/>";
strm << _endFileConfiguration;
}
@@ -1906,9 +1943,9 @@ QTextStream &operator<<( QTextStream &strm, const VCFilter &tool )
// VCProject --------------------------------------------------------
VCProject::VCProject()
{
- QUuid uniqueId;
#if defined(Q_WS_WIN32)
GUID guid;
+ QUuid uniqueId;
HRESULT h = CoCreateGuid( &guid );
if ( h == S_OK )
uniqueId = QUuid( guid );