Diffstat (limited to 'qmake/generators/win32/msvc_dsp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | qmake/generators/win32/msvc_dsp.cpp | 171 |
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 | |||
@@ -499,24 +499,48 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) | |||
499 | } | 499 | } |
500 | 500 | ||
501 | 501 | ||
502 | 502 | ||
503 | void | 503 | void |
504 | DspMakefileGenerator::init() | 504 | DspMakefileGenerator::init() |
505 | { | 505 | { |
506 | if(init_flag) | 506 | if(init_flag) |
507 | return; | 507 | return; |
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"); |
514 | else if(project->first("TEMPLATE") == "vclib") | 538 | else if(project->first("TEMPLATE") == "vclib") |
515 | project->variables()["QMAKE_LIB_FLAG"].append("1"); | 539 | project->variables()["QMAKE_LIB_FLAG"].append("1"); |
516 | if ( project->variables()["QMAKESPEC"].isEmpty() ) | 540 | if ( project->variables()["QMAKESPEC"].isEmpty() ) |
517 | project->variables()["QMAKESPEC"].append( getenv("QMAKESPEC") ); | 541 | project->variables()["QMAKESPEC"].append( getenv("QMAKESPEC") ); |
518 | 542 | ||
519 | bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qt-mt"QTDLL_POSTFIX); | 543 | bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qt-mt"QTDLL_POSTFIX); |
520 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; | 544 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; |
521 | 545 | ||
522 | QStringList &configs = project->variables()["CONFIG"]; | 546 | QStringList &configs = project->variables()["CONFIG"]; |
@@ -559,35 +583,35 @@ DspMakefileGenerator::init() | |||
559 | 583 | ||
560 | if ( project->isActiveConfig("qt") ) { | 584 | if ( project->isActiveConfig("qt") ) { |
561 | project->variables()["CONFIG"].append("moc"); | 585 | project->variables()["CONFIG"].append("moc"); |
562 | project->variables()["INCLUDEPATH"] +=project->variables()["QMAKE_INCDIR_QT"]; | 586 | project->variables()["INCLUDEPATH"] +=project->variables()["QMAKE_INCDIR_QT"]; |
563 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; | 587 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; |
564 | 588 | ||
565 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { | 589 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { |
566 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { | 590 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { |
567 | project->variables()["DEFINES"].append("QT_MAKEDLL"); | 591 | project->variables()["DEFINES"].append("QT_MAKEDLL"); |
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"]; |
575 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { | 599 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { |
576 | int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt"); | 600 | int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt"); |
577 | if ( hver == -1 ) | 601 | if ( hver == -1 ) |
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); |
585 | } | 609 | } |
586 | } | 610 | } |
587 | if ( project->isActiveConfig( "activeqt" ) ) { | 611 | if ( project->isActiveConfig( "activeqt" ) ) { |
588 | project->variables().remove("QMAKE_LIBS_QT_ENTRY"); | 612 | project->variables().remove("QMAKE_LIBS_QT_ENTRY"); |
589 | project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib"; | 613 | project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib"; |
590 | if ( project->isActiveConfig( "dll" ) ) | 614 | if ( project->isActiveConfig( "dll" ) ) |
591 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; | 615 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; |
592 | } | 616 | } |
593 | if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) { | 617 | if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) { |
@@ -613,25 +637,25 @@ DspMakefileGenerator::init() | |||
613 | project->variables()["MSVCDSP_OBJECTSDIRDEB"] = "Debug"; | 637 | project->variables()["MSVCDSP_OBJECTSDIRDEB"] = "Debug"; |
614 | if ( !project->first("DESTDIR").isEmpty() ) | 638 | if ( !project->first("DESTDIR").isEmpty() ) |
615 | project->variables()["MSVCDSP_TARGETDIRREL"] = project->first("DESTDIR"); | 639 | project->variables()["MSVCDSP_TARGETDIRREL"] = project->first("DESTDIR"); |
616 | else | 640 | else |
617 | project->variables()["MSVCDSP_TARGETDIRREL"] = "Release"; | 641 | project->variables()["MSVCDSP_TARGETDIRREL"] = "Release"; |
618 | project->variables()["MSVCDSP_TARGETDIRDEB"] = "Debug"; | 642 | project->variables()["MSVCDSP_TARGETDIRDEB"] = "Debug"; |
619 | } | 643 | } |
620 | 644 | ||
621 | if ( project->isActiveConfig("opengl") ) { | 645 | if ( project->isActiveConfig("opengl") ) { |
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" |
629 | || !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { | 653 | || !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { |
630 | project->variables()["MSVCDSP_MTDEFD"] += project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"]; | 654 | project->variables()["MSVCDSP_MTDEFD"] += project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"]; |
631 | project->variables()["MSVCDSP_MTDEF"] += project->variables()["QMAKE_CXXFLAGS_MT_DLL"]; | 655 | project->variables()["MSVCDSP_MTDEF"] += project->variables()["QMAKE_CXXFLAGS_MT_DLL"]; |
632 | } else { | 656 | } else { |
633 | // YES we want to use the DLL even in a static build | 657 | // YES we want to use the DLL even in a static build |
634 | project->variables()["MSVCDSP_MTDEFD"] += project->variables()["QMAKE_CXXFLAGS_MT_DBG"]; | 658 | project->variables()["MSVCDSP_MTDEFD"] += project->variables()["QMAKE_CXXFLAGS_MT_DBG"]; |
635 | project->variables()["MSVCDSP_MTDEF"] += project->variables()["QMAKE_CXXFLAGS_MT"]; | 659 | project->variables()["MSVCDSP_MTDEF"] += project->variables()["QMAKE_CXXFLAGS_MT"]; |
636 | } | 660 | } |
637 | if ( !project->variables()["DEFINES"].contains("QT_DLL") && is_qt | 661 | if ( !project->variables()["DEFINES"].contains("QT_DLL") && is_qt |
@@ -723,137 +747,155 @@ DspMakefileGenerator::init() | |||
723 | } | 747 | } |
724 | } | 748 | } |
725 | 749 | ||
726 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; | 750 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; |
727 | 751 | ||
728 | project->variables()["MSVCDSP_LFLAGS" ] += project->variables()["QMAKE_LFLAGS"]; | 752 | project->variables()["MSVCDSP_LFLAGS" ] += project->variables()["QMAKE_LFLAGS"]; |
729 | if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) | 753 | if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) |
730 | project->variables()["MSVCDSP_LFLAGS" ].append(varGlue("QMAKE_LIBDIR","/LIBPATH:\"","\" /LIBPATH:\"","\"")); | 754 | project->variables()["MSVCDSP_LFLAGS" ].append(varGlue("QMAKE_LIBDIR","/LIBPATH:\"","\" /LIBPATH:\"","\"")); |
731 | project->variables()["MSVCDSP_CXXFLAGS" ] += project->variables()["QMAKE_CXXFLAGS"]; | 755 | project->variables()["MSVCDSP_CXXFLAGS" ] += project->variables()["QMAKE_CXXFLAGS"]; |
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); |
738 | lib.replace(QRegExp("\""), ""); | 763 | lib.replace(QRegExp("\""), ""); |
739 | project->variables()["MSVCDSP_LIBS"].append(" \"" + lib + "\""); | 764 | project->variables()["MSVCDSP_LIBS"].append(" \"" + lib + "\""); |
740 | } | 765 | } |
741 | 766 | ||
742 | QStringList &incs = project->variables()["INCLUDEPATH"]; | 767 | QStringList &incs = project->variables()["INCLUDEPATH"]; |
743 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { | 768 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { |
744 | QString inc = (*incit); | 769 | QString inc = (*incit); |
745 | inc.replace("\"", ""); | 770 | inc.replace("\"", ""); |
746 | project->variables()["MSVCDSP_INCPATH"].append("/I \"" + inc + "\""); | 771 | project->variables()["MSVCDSP_INCPATH"].append("/I \"" + inc + "\""); |
747 | } | 772 | } |
748 | 773 | ||
749 | project->variables()["MSVCDSP_INCPATH"].append("/I \"" + specdir() + "\""); | 774 | project->variables()["MSVCDSP_INCPATH"].append("/I \"" + specdir() + "\""); |
750 | if ( project->isActiveConfig("qt") ) { | 775 | if ( project->isActiveConfig("qt") ) { |
751 | project->variables()["MSVCDSP_RELDEFS"].append("/D \"QT_NO_DEBUG\""); | 776 | project->variables()["MSVCDSP_RELDEFS"].append("/D \"QT_NO_DEBUG\""); |
752 | } else { | 777 | } else { |
753 | project->variables()["MSVCDSP_RELDEFS"].clear(); | 778 | project->variables()["MSVCDSP_RELDEFS"].clear(); |
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")); |
760 | dest = project->first("TARGET"); | 797 | dest = project->first("TARGET"); |
761 | if ( project->first("TARGET").startsWith("$(QTDIR)") ) | 798 | if ( project->first("TARGET").startsWith("$(QTDIR)") ) |
762 | dest.replace( "$(QTDIR)", getenv("QTDIR") ); | 799 | dest.replace( "$(QTDIR)", getenv("QTDIR") ); |
763 | project->variables()["MSVCDSP_TARGET"].append( | 800 | project->variables()["MSVCDSP_TARGET"].append( |
764 | QString("/out:\"") + dest + "\""); | 801 | QString("/out:\"") + dest + "\""); |
765 | if ( project->isActiveConfig("dll") ) { | 802 | if ( project->isActiveConfig("dll") ) { |
766 | QString imp = dest; | 803 | QString imp = dest; |
767 | imp.replace(".dll", ".lib"); | 804 | imp.replace(".dll", ".lib"); |
768 | project->variables()["MSVCDSP_TARGET"].append(QString(" /implib:\"") + imp + "\""); | 805 | project->variables()["MSVCDSP_TARGET"].append(QString(" /implib:\"") + imp + "\""); |
769 | } | 806 | } |
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(); |
790 | QString version = project->variables()["VERSION"].first(); | 820 | QString version = project->variables()["VERSION"].first(); |
791 | if ( version.isEmpty() ) | 821 | if ( version.isEmpty() ) |
792 | version = "1.0"; | 822 | version = "1.0"; |
793 | 823 | ||
794 | project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".idl" ); | 824 | project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".idl" ); |
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 | } |
837 | QStringList &list = project->variables()["FORMS"]; | 879 | QStringList &list = project->variables()["FORMS"]; |
838 | for( it = list.begin(); it != list.end(); ++it ) { | 880 | for( it = list.begin(); it != list.end(); ++it ) { |
839 | if ( QFile::exists( *it + ".h" ) ) | 881 | if ( QFile::exists( *it + ".h" ) ) |
840 | project->variables()["SOURCES"].append( *it + ".h" ); | 882 | project->variables()["SOURCES"].append( *it + ".h" ); |
841 | } | 883 | } |
842 | project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "MSVCDSP_LIBS"; | 884 | project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "MSVCDSP_LIBS"; |
843 | } | 885 | } |
844 | 886 | ||
845 | 887 | ||
846 | QString | 888 | QString |
847 | DspMakefileGenerator::findTemplate(QString file) | 889 | DspMakefileGenerator::findTemplate(const QString &file) |
848 | { | 890 | { |
849 | QString ret; | 891 | QString ret; |
850 | if(!QFile::exists((ret = file)) && | 892 | if(!QFile::exists((ret = file)) && |
851 | !QFile::exists((ret = QString(Option::mkfile::qmakespec + "/" + file))) && | 893 | !QFile::exists((ret = QString(Option::mkfile::qmakespec + "/" + file))) && |
852 | !QFile::exists((ret = QString(getenv("QTDIR")) + "/mkspecs/win32-msvc/" + file)) && | 894 | !QFile::exists((ret = QString(getenv("QTDIR")) + "/mkspecs/win32-msvc/" + file)) && |
853 | !QFile::exists((ret = (QString(getenv("HOME")) + "/.tmake/" + file)))) | 895 | !QFile::exists((ret = (QString(getenv("HOME")) + "/.tmake/" + file)))) |
854 | return ""; | 896 | return ""; |
855 | return ret; | 897 | return ret; |
856 | } | 898 | } |
857 | 899 | ||
858 | 900 | ||
859 | void | 901 | void |
@@ -862,76 +904,77 @@ DspMakefileGenerator::processPrlVariable(const QString &var, const QStringList & | |||
862 | if(var == "QMAKE_PRL_DEFINES") { | 904 | if(var == "QMAKE_PRL_DEFINES") { |
863 | QStringList &out = project->variables()["MSVCDSP_DEFINES"]; | 905 | QStringList &out = project->variables()["MSVCDSP_DEFINES"]; |
864 | for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { | 906 | for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { |
865 | if(out.findIndex((*it)) == -1) | 907 | if(out.findIndex((*it)) == -1) |
866 | out.append((" /D \"" + *it + "\"")); | 908 | out.append((" /D \"" + *it + "\"")); |
867 | } | 909 | } |
868 | } else { | 910 | } else { |
869 | MakefileGenerator::processPrlVariable(var, l); | 911 | MakefileGenerator::processPrlVariable(var, l); |
870 | } | 912 | } |
871 | } | 913 | } |
872 | 914 | ||
873 | 915 | ||
874 | int | 916 | void |
875 | DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t, | 917 | DspMakefileGenerator::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 | ||
912 | int | 956 | void |
913 | DspMakefileGenerator::endGroups(QTextStream &t) | 957 | DspMakefileGenerator::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 | ||
928 | bool | 971 | bool |
929 | DspMakefileGenerator::openOutput(QFile &file) const | 972 | DspMakefileGenerator::openOutput(QFile &file) const |
930 | { | 973 | { |
931 | QString outdir; | 974 | QString outdir; |
932 | if(!file.name().isEmpty()) { | 975 | if(!file.name().isEmpty()) { |
933 | QFileInfo fi(file); | 976 | QFileInfo fi(file); |
934 | if(fi.isDir()) | 977 | if(fi.isDir()) |
935 | outdir = file.name() + QDir::separator(); | 978 | outdir = file.name() + QDir::separator(); |
936 | } | 979 | } |
937 | if(!outdir.isEmpty() || file.name().isEmpty()) | 980 | if(!outdir.isEmpty() || file.name().isEmpty()) |