summaryrefslogtreecommitdiff
path: root/qmake/generators/win32/msvc_dsp.cpp
Unidiff
Diffstat (limited to 'qmake/generators/win32/msvc_dsp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/generators/win32/msvc_dsp.cpp171
1 files changed, 107 insertions, 64 deletions
diff --git a/qmake/generators/win32/msvc_dsp.cpp b/qmake/generators/win32/msvc_dsp.cpp
index 8b08c78..3fa0496 100644
--- a/qmake/generators/win32/msvc_dsp.cpp
+++ b/qmake/generators/win32/msvc_dsp.cpp
@@ -508,6 +508,30 @@ DspMakefileGenerator::init()
508 QStringList::Iterator it; 508 QStringList::Iterator it;
509 init_flag = TRUE; 509 init_flag = TRUE;
510 510
511 const bool thread = project->isActiveConfig("thread");
512
513 if ( project->isActiveConfig("stl") ) {
514 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"];
515 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"];
516 } else {
517 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"];
518 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"];
519 }
520 if ( project->isActiveConfig("exceptions") ) {
521 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"];
522 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"];
523 } else {
524 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"];
525 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"];
526 }
527 if ( project->isActiveConfig("rtti") ) {
528 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"];
529 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"];
530 } else {
531 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"];
532 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"];
533 }
534
511 /* this should probably not be here, but I'm using it to wrap the .t files */ 535 /* this should probably not be here, but I'm using it to wrap the .t files */
512 if(project->first("TEMPLATE") == "vcapp" ) 536 if(project->first("TEMPLATE") == "vcapp" )
513 project->variables()["QMAKE_APP_FLAG"].append("1"); 537 project->variables()["QMAKE_APP_FLAG"].append("1");
@@ -568,7 +592,7 @@ DspMakefileGenerator::init()
568 project->variables()["QMAKE_LFLAGS"].append("/base:\"0x39D00000\""); 592 project->variables()["QMAKE_LFLAGS"].append("/base:\"0x39D00000\"");
569 } 593 }
570 } else { 594 } else {
571 if(project->isActiveConfig("thread")) 595 if( thread )
572 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; 596 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"];
573 else 597 else
574 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; 598 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"];
@@ -578,7 +602,7 @@ DspMakefileGenerator::init()
578 hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt-mt"); 602 hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt-mt");
579 if(hver != -1) { 603 if(hver != -1) {
580 QString ver; 604 QString ver;
581 ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (project->isActiveConfig("thread") ? "-mt" : ""), hver); 605 ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (thread ? "-mt" : ""), hver);
582 QStringList &libs = project->variables()["QMAKE_LIBS"]; 606 QStringList &libs = project->variables()["QMAKE_LIBS"];
583 for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) 607 for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit)
584 (*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver); 608 (*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver);
@@ -622,7 +646,7 @@ DspMakefileGenerator::init()
622 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; 646 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"];
623 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; 647 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"];
624 } 648 }
625 if ( project->isActiveConfig("thread") ) { 649 if ( thread ) {
626 if(project->isActiveConfig("qt")) 650 if(project->isActiveConfig("qt"))
627 project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT" ); 651 project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT" );
628 if ( project->isActiveConfig("dll") || project->first("TARGET") == "qtmain" 652 if ( project->isActiveConfig("dll") || project->first("TARGET") == "qtmain"
@@ -732,6 +756,7 @@ DspMakefileGenerator::init()
732 project->variables()["MSVCDSP_DEFINES"].append(varGlue("DEFINES","/D ","" " /D ","")); 756 project->variables()["MSVCDSP_DEFINES"].append(varGlue("DEFINES","/D ","" " /D ",""));
733 project->variables()["MSVCDSP_DEFINES"].append(varGlue("PRL_EXPORT_DEFINES","/D ","" " /D ","")); 757 project->variables()["MSVCDSP_DEFINES"].append(varGlue("PRL_EXPORT_DEFINES","/D ","" " /D ",""));
734 758
759 processPrlFiles();
735 QStringList &libs = project->variables()["QMAKE_LIBS"]; 760 QStringList &libs = project->variables()["QMAKE_LIBS"];
736 for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) { 761 for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) {
737 QString lib = (*libit); 762 QString lib = (*libit);
@@ -754,6 +779,18 @@ DspMakefileGenerator::init()
754 } 779 }
755 780
756 QString dest; 781 QString dest;
782 QString postLinkStep;
783 QString copyDllStep;
784 QString activeQtStepPreCopyDll;
785 QString activeQtStepPostCopyDll;
786 QString activeQtStepPreCopyDllDebug;
787 QString activeQtStepPostCopyDllDebug;
788 QString activeQtStepPreCopyDllRelease;
789 QString activeQtStepPostCopyDllRelease;
790
791 if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() )
792 postLinkStep += var("QMAKE_POST_LINK");
793
757 if ( !project->variables()["DESTDIR"].isEmpty() ) { 794 if ( !project->variables()["DESTDIR"].isEmpty() ) {
758 project->variables()["TARGET"].first().prepend(project->first("DESTDIR")); 795 project->variables()["TARGET"].first().prepend(project->first("DESTDIR"));
759 Option::fixPathToTargetOS(project->first("TARGET")); 796 Option::fixPathToTargetOS(project->first("TARGET"));
@@ -770,20 +807,13 @@ DspMakefileGenerator::init()
770 } 807 }
771 if ( project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty() ) { 808 if ( project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty() ) {
772 QStringList dlldirs = project->variables()["DLLDESTDIR"]; 809 QStringList dlldirs = project->variables()["DLLDESTDIR"];
773 QString copydll = "# Begin Special Build Tool\n" 810 if ( dlldirs.count() )
774 "TargetPath=" + dest + "\n" 811 copyDllStep += "\t";
775 "SOURCE=$(InputPath)\n"
776 "PostBuild_Desc=Copy DLL to " + project->first("DLLDESTDIR") + "\n"
777 "PostBuild_Cmds=";
778
779 for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { 812 for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) {
780 copydll += "copy \"" + dest + "\" \"" + *dlldir + "\"\t"; 813 copyDllStep += "copy \"$(TargetPath)\" \"" + *dlldir + "\"\t";
781 } 814 }
782
783 copydll += "\n# End Special Build Tool";
784 project->variables()["MSVCDSP_COPY_DLL_REL"].append( copydll );
785 project->variables()["MSVCDSP_COPY_DLL_DBG"].append( copydll );
786 } 815 }
816
787 if ( project->isActiveConfig("activeqt") ) { 817 if ( project->isActiveConfig("activeqt") ) {
788 QString idl = project->variables()["QMAKE_IDL"].first(); 818 QString idl = project->variables()["QMAKE_IDL"].first();
789 QString idc = project->variables()["QMAKE_IDC"].first(); 819 QString idc = project->variables()["QMAKE_IDC"].first();
@@ -795,42 +825,54 @@ DspMakefileGenerator::init()
795 project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".tlb" ); 825 project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".tlb" );
796 project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".midl" ); 826 project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".midl" );
797 if ( project->isActiveConfig( "dll" ) ) { 827 if ( project->isActiveConfig( "dll" ) ) {
798 QString regcmd = "# Begin Special Build Tool\n" 828 activeQtStepPreCopyDll +=
799 "TargetPath=" + targetfilename + "\n" 829 "\t" + idc + " %1 -idl tmp\\" + targetfilename + ".idl -version " + version +
800 "SOURCE=$(InputPath)\n"
801 "PostBuild_Desc=Finalizing ActiveQt server...\n"
802 "PostBuild_Cmds=" +
803 idc + " %1 -idl tmp\\" + targetfilename + ".idl -version " + version +
804 "\t" + idl + " tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl" 830 "\t" + idl + " tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl"
805 "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb" 831 "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb";
806 "\t" + idc + " %1 /regserver\n" 832 activeQtStepPostCopyDll +=
807 "# End Special Build Tool"; 833 "\t" + idc + " %1 /regserver\n";
808 834
809 QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + project->variables()["TARGET"].first(); 835 QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + targetfilename + ".dll";
810 project->variables()["MSVCDSP_COPY_DLL_REL"].append( regcmd.arg(executable).arg(executable).arg(executable) ); 836 activeQtStepPreCopyDllRelease = activeQtStepPreCopyDll.arg(executable).arg(executable);
837 activeQtStepPostCopyDllRelease = activeQtStepPostCopyDll.arg(executable);
811 838
812 executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + project->variables()["TARGET"].first(); 839 executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + targetfilename + ".dll";
813 project->variables()["MSVCDSP_COPY_DLL_DBG"].append( regcmd.arg(executable).arg(executable).arg(executable) ); 840 activeQtStepPreCopyDllDebug = activeQtStepPreCopyDll.arg(executable).arg(executable);
841 activeQtStepPostCopyDllDebug = activeQtStepPostCopyDll.arg(executable);
814 } else { 842 } else {
815 QString regcmd = "# Begin Special Build Tool\n" 843 activeQtStepPreCopyDll +=
816 "TargetPath=" + targetfilename + "\n" 844 "\t%1 -dumpidl tmp\\" + targetfilename + ".idl -version " + version +
817 "SOURCE=$(InputPath)\n"
818 "PostBuild_Desc=Finalizing ActiveQt server...\n"
819 "PostBuild_Cmds="
820 "%1 -dumpidl tmp\\" + targetfilename + ".idl -version " + version +
821 "\t" + idl + " tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl" 845 "\t" + idl + " tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl"
822 "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb" 846 "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb";
823 "\t%1 -regserver\n" 847 activeQtStepPostCopyDll +=
824 "# End Special Build Tool"; 848 "\t%1 -regserver\n";
825 849 QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + targetfilename + ".exe";
826 QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + project->variables()["TARGET"].first(); 850 activeQtStepPreCopyDllRelease = activeQtStepPreCopyDll.arg(executable).arg(executable);
827 project->variables()["MSVCDSP_REGSVR_REL"].append( regcmd.arg(executable).arg(executable).arg(executable) ); 851 activeQtStepPostCopyDllRelease = activeQtStepPostCopyDll.arg(executable);
828 852
829 executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + project->variables()["TARGET"].first(); 853 executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + targetfilename + ".exe";
830 project->variables()["MSVCDSP_REGSVR_DBG"].append( regcmd.arg(executable).arg(executable).arg(executable) ); 854 activeQtStepPreCopyDllDebug = activeQtStepPreCopyDll.arg(executable).arg(executable);
855 activeQtStepPostCopyDllDebug = activeQtStepPostCopyDll.arg(executable);
831 } 856 }
832 857
833 } 858 }
859
860
861 if ( !postLinkStep.isEmpty() || !copyDllStep.isEmpty() || !activeQtStepPreCopyDllDebug.isEmpty() || !activeQtStepPreCopyDllRelease.isEmpty() ) {
862 project->variables()["MSVCDSP_POST_LINK_DBG"].append(
863 "# Begin Special Build Tool\n"
864 "SOURCE=$(InputPath)\n"
865 "PostBuild_Desc=Post Build Step\n"
866 "PostBuild_Cmds=" + postLinkStep + activeQtStepPreCopyDllDebug + copyDllStep + activeQtStepPostCopyDllDebug + "\n"
867 "# End Special Build Tool\n" );
868 project->variables()["MSVCDSP_POST_LINK_REL"].append(
869 "# Begin Special Build Tool\n"
870 "SOURCE=$(InputPath)\n"
871 "PostBuild_Desc=Post Build Step\n"
872 "PostBuild_Cmds=" + postLinkStep + activeQtStepPreCopyDllRelease + copyDllStep + activeQtStepPostCopyDllRelease + "\n"
873 "# End Special Build Tool\n" );
874 }
875
834 if ( !project->variables()["SOURCES"].isEmpty() || !project->variables()["RC_FILE"].isEmpty() ) { 876 if ( !project->variables()["SOURCES"].isEmpty() || !project->variables()["RC_FILE"].isEmpty() ) {
835 project->variables()["SOURCES"] += project->variables()["RC_FILE"]; 877 project->variables()["SOURCES"] += project->variables()["RC_FILE"];
836 } 878 }
@@ -844,7 +886,7 @@ DspMakefileGenerator::init()
844 886
845 887
846QString 888QString
847DspMakefileGenerator::findTemplate(QString file) 889DspMakefileGenerator::findTemplate(const QString &file)
848{ 890{
849 QString ret; 891 QString ret;
850 if(!QFile::exists((ret = file)) && 892 if(!QFile::exists((ret = file)) &&
@@ -871,58 +913,59 @@ DspMakefileGenerator::processPrlVariable(const QString &var, const QStringList &
871} 913}
872 914
873 915
874int 916void
875DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t, 917DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t,
876 QString filter) 918 const QString& filter)
877{ 919{
878 if(project->isActiveConfig("flat")) 920 if(project->isActiveConfig("flat"))
879 return 0; 921 return;
880 922
881 fileFixify(file, QDir::currentDirPath(), QDir::currentDirPath(), TRUE); 923 fileFixify(file, QDir::currentDirPath(), QDir::currentDirPath(), TRUE);
882 file = file.section(Option::dir_sep, 0, -2); 924 file = file.section(Option::dir_sep, 0, -2);
883 if(file.right(Option::dir_sep.length()) != Option::dir_sep) 925 if(file.right(Option::dir_sep.length()) != Option::dir_sep)
884 file += Option::dir_sep; 926 file += Option::dir_sep;
885 if(file == currentGroup) 927 if(file == currentGroup)
886 return 0; 928 return;
887 929
888 if(file.isEmpty() || !QDir::isRelativePath(file)) { 930 if(file.isEmpty() || !QDir::isRelativePath(file)) {
889 endGroups(t); 931 endGroups(t);
890 return 0; 932 return;
891 } 933 }
892 if(file.startsWith(currentGroup)) 934 if(file.startsWith(currentGroup))
893 file = file.mid(currentGroup.length()); 935 file = file.mid(currentGroup.length());
894 else 936 int dirSep = currentGroup.findRev( Option::dir_sep );
895 endGroups(t); 937 while( !file.startsWith( currentGroup ) && dirSep != -1 ) {
896 int lvl = file.contains(Option::dir_sep), old_lvl = currentGroup.contains(Option::dir_sep); 938 currentGroup.truncate( dirSep );
897 if(lvl > old_lvl) { 939 dirSep = currentGroup.findRev( Option::dir_sep );
898 QStringList dirs = QStringList::split(Option::dir_sep, file); 940 if ( !file.startsWith( currentGroup ) && dirSep != -1 )
899 for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) {
900 t << "# Begin Group \"" << (*dir_it) << "\"\n"
901 << "# Prop Default_Filter \"" << filter << "\"\n";
902 }
903 } else {
904 for(int x = old_lvl - lvl; x; x--)
905 t << "\n# End Group\n"; 941 t << "\n# End Group\n";
906 } 942 }
943 if ( !file.startsWith( currentGroup ) ) {
944 t << "\n# End Group\n";
945 currentGroup = "";
946 }
947 QStringList dirs = QStringList::split(Option::dir_sep, file.right( file.length() - currentGroup.length() ) );
948 for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) {
949 t << "# Begin Group \"" << (*dir_it) << "\"\n"
950 << "# Prop Default_Filter \"" << filter << "\"\n";
951 }
907 currentGroup = file; 952 currentGroup = file;
908 return lvl - old_lvl;
909} 953}
910 954
911 955
912int 956void
913DspMakefileGenerator::endGroups(QTextStream &t) 957DspMakefileGenerator::endGroups(QTextStream &t)
914{ 958{
915 if(project->isActiveConfig("flat")) 959 if(project->isActiveConfig("flat"))
916 return 0; 960 return;
917 else if(currentGroup.isEmpty()) 961 else if(currentGroup.isEmpty())
918 return 0; 962 return;
919 963
920 QStringList dirs = QStringList::split(Option::dir_sep, currentGroup); 964 QStringList dirs = QStringList::split(Option::dir_sep, currentGroup);
921 for(QStringList::Iterator dir_it = dirs.end(); dir_it != dirs.begin(); --dir_it) { 965 for(QStringList::Iterator dir_it = dirs.end(); dir_it != dirs.begin(); --dir_it) {
922 t << "\n# End Group\n"; 966 t << "\n# End Group\n";
923 } 967 }
924 currentGroup = ""; 968 currentGroup = "";
925 return dirs.count();
926} 969}
927 970
928bool 971bool