qmake/generators/win32/msvc_vcproj.cpp
changeset 30 5dc02b23752f
parent 18 2f34d5167611
child 33 3e2da88830cd
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
    75     DotNET version;
    75     DotNET version;
    76     const char *versionStr;
    76     const char *versionStr;
    77     const char *regKey;
    77     const char *regKey;
    78 } dotNetCombo[] = {
    78 } dotNetCombo[] = {
    79 #ifdef Q_OS_WIN64
    79 #ifdef Q_OS_WIN64
       
    80     {NET2010, "MSVC.NET 2010 (10.0)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\10.0\\Setup\\VC\\ProductDir"},
       
    81     {NET2010, "MSVC.NET 2010 Express Edition (10.0)", "Software\\Wow6432Node\\Microsoft\\VCExpress\\10.0\\Setup\\VC\\ProductDir"},
    80     {NET2008, "MSVC.NET 2008 (9.0)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\9.0\\Setup\\VC\\ProductDir"},
    82     {NET2008, "MSVC.NET 2008 (9.0)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\9.0\\Setup\\VC\\ProductDir"},
    81     {NET2008, "MSVC.NET 2008 Express Edition (9.0)", "Software\\Wow6432Node\\Microsoft\\VCExpress\\9.0\\Setup\\VC\\ProductDir"},
    83     {NET2008, "MSVC.NET 2008 Express Edition (9.0)", "Software\\Wow6432Node\\Microsoft\\VCExpress\\9.0\\Setup\\VC\\ProductDir"},
    82     {NET2005, "MSVC.NET 2005 (8.0)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\8.0\\Setup\\VC\\ProductDir"},
    84     {NET2005, "MSVC.NET 2005 (8.0)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\8.0\\Setup\\VC\\ProductDir"},
    83     {NET2005, "MSVC.NET 2005 Express Edition (8.0)", "Software\\Wow6432Node\\Microsoft\\VCExpress\\8.0\\Setup\\VC\\ProductDir"},
    85     {NET2005, "MSVC.NET 2005 Express Edition (8.0)", "Software\\Wow6432Node\\Microsoft\\VCExpress\\8.0\\Setup\\VC\\ProductDir"},
    84     {NET2003, "MSVC.NET 2003 (7.1)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\7.1\\Setup\\VC\\ProductDir"},
    86     {NET2003, "MSVC.NET 2003 (7.1)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\7.1\\Setup\\VC\\ProductDir"},
    85     {NET2002, "MSVC.NET 2002 (7.0)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\7.0\\Setup\\VC\\ProductDir"},
    87     {NET2002, "MSVC.NET 2002 (7.0)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\7.0\\Setup\\VC\\ProductDir"},
    86 #else
    88 #else
       
    89     {NET2010, "MSVC.NET 2010 (10.0)", "Software\\Microsoft\\VisualStudio\\10.0\\Setup\\VC\\ProductDir"},
       
    90     {NET2010, "MSVC.NET 2010 Express Edition (10.0)", "Software\\Microsoft\\VCExpress\\10.0\\Setup\\VC\\ProductDir"},
    87     {NET2008, "MSVC.NET 2008 (9.0)", "Software\\Microsoft\\VisualStudio\\9.0\\Setup\\VC\\ProductDir"},
    91     {NET2008, "MSVC.NET 2008 (9.0)", "Software\\Microsoft\\VisualStudio\\9.0\\Setup\\VC\\ProductDir"},
    88     {NET2008, "MSVC.NET 2008 Express Edition (9.0)", "Software\\Microsoft\\VCExpress\\9.0\\Setup\\VC\\ProductDir"},
    92     {NET2008, "MSVC.NET 2008 Express Edition (9.0)", "Software\\Microsoft\\VCExpress\\9.0\\Setup\\VC\\ProductDir"},
    89     {NET2005, "MSVC.NET 2005 (8.0)", "Software\\Microsoft\\VisualStudio\\8.0\\Setup\\VC\\ProductDir"},
    93     {NET2005, "MSVC.NET 2005 (8.0)", "Software\\Microsoft\\VisualStudio\\8.0\\Setup\\VC\\ProductDir"},
    90     {NET2005, "MSVC.NET 2005 Express Edition (8.0)", "Software\\Microsoft\\VCExpress\\8.0\\Setup\\VC\\ProductDir"},
    94     {NET2005, "MSVC.NET 2005 Express Edition (8.0)", "Software\\Microsoft\\VCExpress\\8.0\\Setup\\VC\\ProductDir"},
    91     {NET2003, "MSVC.NET 2003 (7.1)", "Software\\Microsoft\\VisualStudio\\7.1\\Setup\\VC\\ProductDir"},
    95     {NET2003, "MSVC.NET 2003 (7.1)", "Software\\Microsoft\\VisualStudio\\7.1\\Setup\\VC\\ProductDir"},
   163 };
   167 };
   164 
   168 
   165 // Flatfile Tags ----------------------------------------------------
   169 // Flatfile Tags ----------------------------------------------------
   166 const char _slnHeader70[]       = "Microsoft Visual Studio Solution File, Format Version 7.00";
   170 const char _slnHeader70[]       = "Microsoft Visual Studio Solution File, Format Version 7.00";
   167 const char _slnHeader71[]       = "Microsoft Visual Studio Solution File, Format Version 8.00";
   171 const char _slnHeader71[]       = "Microsoft Visual Studio Solution File, Format Version 8.00";
   168 const char _slnHeader80[]       = "Microsoft Visual Studio Solution File, Format Version 9.00";
   172 const char _slnHeader80[]       = "Microsoft Visual Studio Solution File, Format Version 9.00"
   169 const char _slnHeader90[]       = "Microsoft Visual Studio Solution File, Format Version 10.00";
   173                                   "\n# Visual Studio 2005";
       
   174 const char _slnHeader90[]       = "Microsoft Visual Studio Solution File, Format Version 10.00"
       
   175                                   "\n# Visual Studio 2008";
       
   176 const char _slnHeader100[]      = "Microsoft Visual Studio Solution File, Format Version 11.00"
       
   177                                   "\n# Visual Studio 2010";
   170                                   // The following UUID _may_ change for later servicepacks...
   178                                   // The following UUID _may_ change for later servicepacks...
   171                                   // If so we need to search through the registry at
   179                                   // If so we need to search through the registry at
   172                                   // HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.0\Projects
   180                                   // HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.0\Projects
   173                                   // to find the subkey that contains a "PossibleProjectExtension"
   181                                   // to find the subkey that contains a "PossibleProjectExtension"
   174                                   // containing "vcproj"...
   182                                   // containing "vcproj"...
   352                 var("QMAKE_FAILED_REQUIREMENTS").toLatin1().constData());
   360                 var("QMAKE_FAILED_REQUIREMENTS").toLatin1().constData());
   353         return;
   361         return;
   354     }
   362     }
   355 
   363 
   356     switch(which_dotnet_version()) {
   364     switch(which_dotnet_version()) {
       
   365     case NET2010:
       
   366         t << _slnHeader100;
       
   367         break;
   357     case NET2008:
   368     case NET2008:
   358         t << _slnHeader90;
   369         t << _slnHeader90;
   359         break;
   370         break;
   360     case NET2005:
   371     case NET2005:
   361         t << _slnHeader80;
   372         t << _slnHeader80;
   904     }
   915     }
   905 
   916 
   906     conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS"));
   917     conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS"));
   907     if(project->isActiveConfig("debug")){
   918     if(project->isActiveConfig("debug")){
   908         // Debug version
   919         // Debug version
   909         conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS_DEBUG"));
       
   910         if((projectTarget == Application) || (projectTarget == StaticLib))
   920         if((projectTarget == Application) || (projectTarget == StaticLib))
   911             conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS_MT_DBG"));
   921             conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS_MT_DBG"));
   912         else
   922         else
   913             conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS_MT_DLLDBG"));
   923             conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS_MT_DLLDBG"));
   914     } else {
   924     } else {
   915         // Release version
   925         // Release version
   916         conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS_RELEASE"));
       
   917         conf.compiler.PreprocessorDefinitions += "QT_NO_DEBUG";
   926         conf.compiler.PreprocessorDefinitions += "QT_NO_DEBUG";
   918         conf.compiler.PreprocessorDefinitions += "NDEBUG";
   927         conf.compiler.PreprocessorDefinitions += "NDEBUG";
   919         if((projectTarget == Application) || (projectTarget == StaticLib))
   928         if((projectTarget == Application) || (projectTarget == StaticLib))
   920             conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS_MT"));
   929             conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS_MT"));
   921         else
   930         else
   922             conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS_MT_DLL"));
   931             conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS_MT_DLL"));
   923     }
   932     }
   924 
   933 
   925     // Common for both release and debug
   934     // Common for both release and debug
   926     if(project->isActiveConfig("warn_off"))
       
   927         conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS_WARN_OFF"));
       
   928     else if(project->isActiveConfig("warn_on"))
       
   929         conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS_WARN_ON"));
       
   930     if(project->isActiveConfig("windows"))
   935     if(project->isActiveConfig("windows"))
   931         conf.compiler.PreprocessorDefinitions += project->values("MSVCPROJ_WINCONDEF");
   936         conf.compiler.PreprocessorDefinitions += project->values("MSVCPROJ_WINCONDEF");
   932 
   937 
   933     // Can this be set for ALL configs?
   938     // Can this be set for ALL configs?
   934     // If so, use qmake.conf!
   939     // If so, use qmake.conf!
   987     if(!conf.linker.OutputFile.endsWith("\\"))
   992     if(!conf.linker.OutputFile.endsWith("\\"))
   988         conf.linker.OutputFile += '\\';
   993         conf.linker.OutputFile += '\\';
   989 
   994 
   990     conf.linker.OutputFile += project->first("MSVCPROJ_TARGET");
   995     conf.linker.OutputFile += project->first("MSVCPROJ_TARGET");
   991 
   996 
   992     if(project->isActiveConfig("debug")){
       
   993         conf.linker.parseOptions(project->values("QMAKE_LFLAGS_DEBUG"));
       
   994     } else {
       
   995         conf.linker.parseOptions(project->values("QMAKE_LFLAGS_RELEASE"));
       
   996     }
       
   997 
       
   998     if(project->isActiveConfig("dll")){
   997     if(project->isActiveConfig("dll")){
   999         conf.linker.parseOptions(project->values("QMAKE_LFLAGS_QT_DLL"));
   998         conf.linker.parseOptions(project->values("QMAKE_LFLAGS_QT_DLL"));
  1000     }
   999     }
  1001 
       
  1002     if(project->isActiveConfig("console")){
       
  1003         conf.linker.parseOptions(project->values("QMAKE_LFLAGS_CONSOLE"));
       
  1004     } else {
       
  1005         conf.linker.parseOptions(project->values("QMAKE_LFLAGS_WINDOWS"));
       
  1006     }
       
  1007 
       
  1008 }
  1000 }
  1009 
  1001 
  1010 void VcprojGenerator::initResourceTool()
  1002 void VcprojGenerator::initResourceTool()
  1011 {
  1003 {
  1012     VCConfiguration &conf = vcProject.Configuration;
  1004     VCConfiguration &conf = vcProject.Configuration;
  1624        !exists((ret = QString(Option::mkfile::qmakespec + "/" + file))) &&
  1616        !exists((ret = QString(Option::mkfile::qmakespec + "/" + file))) &&
  1625        !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::DataPath) + "/win32-msvc.net/" + file))) &&
  1617        !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::DataPath) + "/win32-msvc.net/" + file))) &&
  1626        !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::DataPath) + "/win32-msvc2002/" + file))) &&
  1618        !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::DataPath) + "/win32-msvc2002/" + file))) &&
  1627        !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::DataPath) + "/win32-msvc2003/" + file))) &&
  1619        !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::DataPath) + "/win32-msvc2003/" + file))) &&
  1628        !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::DataPath) + "/win32-msvc2005/" + file))) &&
  1620        !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::DataPath) + "/win32-msvc2005/" + file))) &&
  1629        !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::DataPath) + "/win32-msvc2008/" + file))) &&
  1621        !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::DataPath) + "/win32-msvc2008/" + file))))
  1630        !exists((ret = (QString(qgetenv("HOME")) + "/.tmake/" + file))))
       
  1631         return "";
  1622         return "";
  1632     debug_msg(1, "Generator: MSVC.NET: Found template \'%s\'", ret.toLatin1().constData());
  1623     debug_msg(1, "Generator: MSVC.NET: Found template \'%s\'", ret.toLatin1().constData());
  1633     return ret;
  1624     return ret;
  1634 }
  1625 }
  1635 
  1626