summaryrefslogtreecommitdiff
path: root/qmake/generators/win32/msvc_dsp.cpp
Unidiff
Diffstat (limited to 'qmake/generators/win32/msvc_dsp.cpp') (more/less context) (show whitespace changes)
-rw-r--r--qmake/generators/win32/msvc_dsp.cpp163
1 files changed, 103 insertions, 60 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
@@ -510,2 +510,26 @@ DspMakefileGenerator::init()
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 */
@@ -570,3 +594,3 @@ DspMakefileGenerator::init()
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"];
@@ -580,3 +604,3 @@ DspMakefileGenerator::init()
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"];
@@ -624,3 +648,3 @@ DspMakefileGenerator::init()
624 } 648 }
625 if ( project->isActiveConfig("thread") ) { 649 if ( thread ) {
626 if(project->isActiveConfig("qt")) 650 if(project->isActiveConfig("qt"))
@@ -734,2 +758,3 @@ DspMakefileGenerator::init()
734 758
759 processPrlFiles();
735 QStringList &libs = project->variables()["QMAKE_LIBS"]; 760 QStringList &libs = project->variables()["QMAKE_LIBS"];
@@ -756,2 +781,14 @@ DspMakefileGenerator::init()
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() ) {
@@ -772,16 +809,9 @@ DspMakefileGenerator::init()
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") ) {
@@ -797,38 +827,50 @@ DspMakefileGenerator::init()
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";
849 QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + targetfilename + ".exe";
850 activeQtStepPreCopyDllRelease = activeQtStepPreCopyDll.arg(executable).arg(executable);
851 activeQtStepPostCopyDllRelease = activeQtStepPostCopyDll.arg(executable);
825 852
826 QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + project->variables()["TARGET"].first(); 853 executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + targetfilename + ".exe";
827 project->variables()["MSVCDSP_REGSVR_REL"].append( regcmd.arg(executable).arg(executable).arg(executable) ); 854 activeQtStepPreCopyDllDebug = activeQtStepPreCopyDll.arg(executable).arg(executable);
855 activeQtStepPostCopyDllDebug = activeQtStepPostCopyDll.arg(executable);
856 }
828 857
829 executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + project->variables()["TARGET"].first();
830 project->variables()["MSVCDSP_REGSVR_DBG"].append( regcmd.arg(executable).arg(executable).arg(executable) );
831 } 858 }
832 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" );
833 } 874 }
875
834 if ( !project->variables()["SOURCES"].isEmpty() || !project->variables()["RC_FILE"].isEmpty() ) { 876 if ( !project->variables()["SOURCES"].isEmpty() || !project->variables()["RC_FILE"].isEmpty() ) {
@@ -846,3 +888,3 @@ DspMakefileGenerator::init()
846QString 888QString
847DspMakefileGenerator::findTemplate(QString file) 889DspMakefileGenerator::findTemplate(const QString &file)
848{ 890{
@@ -873,8 +915,8 @@ DspMakefileGenerator::processPrlVariable(const QString &var, const QStringList &
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
@@ -885,3 +927,3 @@ DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t,
885 if(file == currentGroup) 927 if(file == currentGroup)
886 return 0; 928 return;
887 929
@@ -889,3 +931,3 @@ DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t,
889 endGroups(t); 931 endGroups(t);
890 return 0; 932 return;
891 } 933 }
@@ -893,7 +935,14 @@ DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t,
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 )
941 t << "\n# End Group\n";
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() ) );
899 for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) { 948 for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) {
@@ -902,8 +951,3 @@ DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t,
902 } 951 }
903 } else {
904 for(int x = old_lvl - lvl; x; x--)
905 t << "\n# End Group\n";
906 }
907 currentGroup = file; 952 currentGroup = file;
908 return lvl - old_lvl;
909} 953}
@@ -911,3 +955,3 @@ DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t,
911 955
912int 956void
913DspMakefileGenerator::endGroups(QTextStream &t) 957DspMakefileGenerator::endGroups(QTextStream &t)
@@ -915,5 +959,5 @@ DspMakefileGenerator::endGroups(QTextStream &t)
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
@@ -924,3 +968,2 @@ DspMakefileGenerator::endGroups(QTextStream &t)
924 currentGroup = ""; 968 currentGroup = "";
925 return dirs.count();
926} 969}