support for debug and opt libraries

This commit is contained in:
Ken Martin 2001-04-26 16:22:53 -04:00
parent 888e47ddb4
commit 41e1270413
16 changed files with 214 additions and 142 deletions

View File

@ -68,7 +68,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 CM_LIBRARIES kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 # ADD LINK32 CM_OPTIMIZED_LIBRARIES CM_LIBRARIES kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
!ELSEIF "$(CFG)" == "OUTPUT_LIBNAME - Win32 Debug" !ELSEIF "$(CFG)" == "OUTPUT_LIBNAME - Win32 Debug"
@ -95,7 +95,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 CM_LIBRARIES kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept # ADD LINK32 CM_DEBUG_LIBRARIES CM_LIBRARIES kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
!ENDIF !ENDIF

View File

@ -63,7 +63,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /IGNORE:4089 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /IGNORE:4089
# ADD LINK32 CM_LIBRARIES kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /IGNORE:4089 # ADD LINK32 CM_OPTIMIZED_LIBRARIES CM_LIBRARIES kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /IGNORE:4089
!ELSEIF "$(CFG)" == "OUTPUT_LIBNAME - Win32 Debug" !ELSEIF "$(CFG)" == "OUTPUT_LIBNAME - Win32 Debug"
@ -88,7 +88,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /IGNORE:4089 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /IGNORE:4089
# ADD LINK32 CM_LIBRARIES kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /IGNORE:4089 # ADD LINK32 CM_DEBUG_LIBRARIES CM_LIBRARIES kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /IGNORE:4089
!ELSEIF "$(CFG)" == "OUTPUT_LIBNAME - Win32 Release MinSize" !ELSEIF "$(CFG)" == "OUTPUT_LIBNAME - Win32 Release MinSize"
# PROP BASE Use_MFC 0 # PROP BASE Use_MFC 0
@ -110,7 +110,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /IGNORE:4089 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /IGNORE:4089
# ADD LINK32 CM_LIBRARIES kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /IGNORE:4089 # ADD LINK32 CM_OPTIMIZED_LIBRARIES CM_LIBRARIES kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /IGNORE:4089
!ENDIF !ENDIF

View File

@ -91,7 +91,7 @@ EXSTYLE WS_EX_APPWINDOW
CAPTION "CMakeSetupDialog" CAPTION "CMakeSetupDialog"
FONT 8, "MS Sans Serif" FONT 8, "MS Sans Serif"
BEGIN BEGIN
DEFPUSHBUTTON "Close",IDOK,319,39,50,14 DEFPUSHBUTTON "Close",IDOK,231,206,50,14
EDITTEXT IDC_WhereSource,129,4,135,13,ES_AUTOHSCROLL EDITTEXT IDC_WhereSource,129,4,135,13,ES_AUTOHSCROLL
PUSHBUTTON "Browse...",IDC_BUTTON2,269,5,43,13 PUSHBUTTON "Browse...",IDC_BUTTON2,269,5,43,13
LTEXT "Where is the source code:",IDC_STATIC,39,6,86,9 LTEXT "Where is the source code:",IDC_STATIC,39,6,86,9
@ -99,11 +99,13 @@ BEGIN
PUSHBUTTON "Browse...",IDC_BUTTON3,268,25,43,13 PUSHBUTTON "Browse...",IDC_BUTTON3,268,25,43,13
LTEXT "Where do you want to build the binaries:",IDC_STATIC,1, LTEXT "Where do you want to build the binaries:",IDC_STATIC,1,
27,128,9 27,128,9
PUSHBUTTON "Build Project Files",IDC_BuildProjects,6,39,67,15 PUSHBUTTON "Build Project Files",IDC_BuildProjects,81,205,67,15
GROUPBOX "Cache Values",IDC_STATIC,2,67,370,156 GROUPBOX "Cache Values",IDC_STATIC,9,43,356,141
LISTBOX IDC_LIST2,13,84,344,122,LBS_OWNERDRAWVARIABLE | LISTBOX IDC_LIST2,15,55,344,122,LBS_OWNERDRAWVARIABLE |
LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
WS_TABSTOP WS_TABSTOP
CTEXT "Right click on cache entries for additional options",
IDC_STATIC,19,190,333,11
END END
@ -165,11 +167,6 @@ BEGIN
TOPMARGIN, 7 TOPMARGIN, 7
BOTTOMMARGIN, 48 BOTTOMMARGIN, 48
END END
IDD_CMakeSetupDialog_DIALOG, DIALOG
BEGIN
BOTTOMMARGIN, 215
END
END END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED

View File

@ -13,6 +13,7 @@
#define IDC_BUTTON3 1004 #define IDC_BUTTON3 1004
#define IDC_BuildProjects 1006 #define IDC_BuildProjects 1006
#define IDC_LIST2 1007 #define IDC_LIST2 1007
#define IDC_LIST3 1010
// Next default values for new objects // Next default values for new objects
// //
@ -20,7 +21,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 131 #define _APS_NEXT_RESOURCE_VALUE 131
#define _APS_NEXT_COMMAND_VALUE 32771 #define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1008 #define _APS_NEXT_CONTROL_VALUE 1011
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif
#endif #endif

View File

@ -53,10 +53,8 @@ void cmDSPMakefile::OutputDSPFile()
} }
// Create the DSP or set of DSP's for libraries and executables // Create the DSP or set of DSP's for libraries and executables
const char* cacheValue
= cmCacheManager::GetInstance()->GetCacheValue("BUILD_SHARED_LIBS");
m_LibraryBuildType = STATIC_LIBRARY; m_LibraryBuildType = STATIC_LIBRARY;
if(cacheValue && strcmp(cacheValue,"0")) if(cmCacheManager::GetInstance()->IsOn("BUILD_SHARED_LIBS"))
{ {
m_LibraryBuildType = DLL; m_LibraryBuildType = DLL;
} }
@ -69,30 +67,6 @@ void cmDSPMakefile::OutputDSPFile()
for(cmTargets::iterator l = tgts.begin(); for(cmTargets::iterator l = tgts.begin();
l != tgts.end(); l++) l != tgts.end(); l++)
{ {
std::string libOptions;
std::vector<std::string>& libdirs = m_Makefile->GetLinkDirectories();
for(i = libdirs.begin(); i != libdirs.end(); ++i)
{
libOptions += " /LIBPATH:\"";
libOptions += *i;
libOptions += "/$(OUTDIR)\" ";
libOptions += " /LIBPATH:\"";
libOptions += *i;
libOptions += "\" ";
}
std::vector<std::string>& libs = m_Makefile->GetLinkLibraries();
for(i = libs.begin(); i != libs.end(); ++i)
{
// add libraries to executables and dlls (but never include
// a library in a library, bad recursion)
if (!l->second.IsALibrary() ||
(m_LibraryBuildType == DLL && l->first.c_str() != *i))
{
libOptions += " ";
libOptions += *i;
libOptions += ".lib ";
}
}
if (l->second.IsALibrary()) if (l->second.IsALibrary())
{ {
this->SetBuildType(m_LibraryBuildType, l->first.c_str()); this->SetBuildType(m_LibraryBuildType, l->first.c_str());
@ -101,13 +75,11 @@ void cmDSPMakefile::OutputDSPFile()
{ {
this->SetBuildType(EXECUTABLE,l->first.c_str()); this->SetBuildType(EXECUTABLE,l->first.c_str());
} }
libOptions += "/STACK:10000000 "; this->CreateSingleDSP(l->first.c_str(),l->second);
this->CreateSingleDSP(l->first.c_str(),l->second, libOptions);
} }
} }
void cmDSPMakefile::CreateSingleDSP(const char *lname, cmTarget &target, void cmDSPMakefile::CreateSingleDSP(const char *lname, cmTarget &target)
const std::string &libOptions)
{ {
std::string fname; std::string fname;
fname = m_Makefile->GetStartOutputDirectory(); fname = m_Makefile->GetStartOutputDirectory();
@ -121,7 +93,7 @@ void cmDSPMakefile::CreateSingleDSP(const char *lname, cmTarget &target,
{ {
cmSystemTools::Error("Error Writing ", fname.c_str()); cmSystemTools::Error("Error Writing ", fname.c_str());
} }
this->WriteDSPFile(fout,lname,target, libOptions); this->WriteDSPFile(fout,lname,target);
} }
void cmDSPMakefile::WriteDSPBuildRule(std::ostream& fout) void cmDSPMakefile::WriteDSPBuildRule(std::ostream& fout)
@ -189,11 +161,10 @@ void cmDSPMakefile::AddDSPBuildRule(cmSourceGroup& sourceGroup)
void cmDSPMakefile::WriteDSPFile(std::ostream& fout, void cmDSPMakefile::WriteDSPFile(std::ostream& fout,
const char *libName, const char *libName,
cmTarget &target, cmTarget &target)
const std::string &libOptions)
{ {
// Write the DSP file's header. // Write the DSP file's header.
this->WriteDSPHeader(fout, libName, libOptions); this->WriteDSPHeader(fout, libName, target);
// We may be modifying the source groups temporarily, so make a copy. // We may be modifying the source groups temporarily, so make a copy.
std::vector<cmSourceGroup> sourceGroups = m_Makefile->GetSourceGroups(); std::vector<cmSourceGroup> sourceGroups = m_Makefile->GetSourceGroups();
@ -405,8 +376,55 @@ void cmDSPMakefile::SetBuildType(BuildType b, const char *libName)
} }
void cmDSPMakefile::WriteDSPHeader(std::ostream& fout, const char *libName, void cmDSPMakefile::WriteDSPHeader(std::ostream& fout, const char *libName,
const std::string &libOptions) const cmTarget &target)
{ {
// determine the link directories
std::string libOptions;
std::string libDebugOptions;
std::string libOptimizedOptions;
std::vector<std::string>::iterator i;
std::vector<std::string>& libdirs = m_Makefile->GetLinkDirectories();
for(i = libdirs.begin(); i != libdirs.end(); ++i)
{
libOptions += " /LIBPATH:\"";
libOptions += *i;
libOptions += "/$(OUTDIR)\" ";
libOptions += " /LIBPATH:\"";
libOptions += *i;
libOptions += "\" ";
}
// find link libraries
cmMakefile::LinkLibraries& libs = m_Makefile->GetLinkLibraries();
cmMakefile::LinkLibraries::const_iterator j;
for(j = libs.begin(); j != libs.end(); ++j)
{
// add libraries to executables and dlls (but never include
// a library in a library, bad recursion)
if (!target.IsALibrary() ||
(m_LibraryBuildType == DLL && libName != j->first))
{
if (j->second == cmMakefile::GENERAL)
{
libOptions += " ";
libOptions += j->first;
libOptions += ".lib ";
}
if (j->second == cmMakefile::DEBUG)
{
libDebugOptions += " ";
libDebugOptions += j->first;
libDebugOptions += ".lib ";
}
if (j->second == cmMakefile::OPTIMIZED)
{
libOptimizedOptions += " ";
libOptimizedOptions += j->first;
libOptimizedOptions += ".lib ";
}
}
}
libOptions += "/STACK:10000000 ";
std::ifstream fin(m_DSPHeaderTemplate.c_str()); std::ifstream fin(m_DSPHeaderTemplate.c_str());
if(!fin) if(!fin)
{ {
@ -420,6 +438,10 @@ void cmDSPMakefile::WriteDSPHeader(std::ostream& fout, const char *libName,
std::string line = buffer; std::string line = buffer;
cmSystemTools::ReplaceString(line, "CM_LIBRARIES", cmSystemTools::ReplaceString(line, "CM_LIBRARIES",
libOptions.c_str()); libOptions.c_str());
cmSystemTools::ReplaceString(line, "CM_DEBUG_LIBRARIES",
libDebugOptions.c_str());
cmSystemTools::ReplaceString(line, "CM_OPTIMIZED_LIBRARIES",
libOptimizedOptions.c_str());
cmSystemTools::ReplaceString(line, "BUILD_INCLUDES", cmSystemTools::ReplaceString(line, "BUILD_INCLUDES",
m_IncludeOptions.c_str()); m_IncludeOptions.c_str());
cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME",libName); cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME",libName);

View File

@ -67,16 +67,15 @@ private:
std::string m_DSPFooterTemplate; std::string m_DSPFooterTemplate;
std::vector<std::string> m_CreatedProjectNames; std::vector<std::string> m_CreatedProjectNames;
void CreateSingleDSP(const char *lname, cmTarget &tgt, void CreateSingleDSP(const char *lname, cmTarget &tgt);
const std::string &libs);
void WriteDSPFile(std::ostream& fout, const char *libName, void WriteDSPFile(std::ostream& fout, const char *libName,
cmTarget &tgt, const std::string &libs); cmTarget &tgt);
void WriteDSPBeginGroup(std::ostream& fout, void WriteDSPBeginGroup(std::ostream& fout,
const char* group, const char* group,
const char* filter); const char* filter);
void WriteDSPEndGroup(std::ostream& fout); void WriteDSPEndGroup(std::ostream& fout);
void WriteDSPHeader(std::ostream& fout, const char *libName, void WriteDSPHeader(std::ostream& fout, const char *libName,
const std::string &libs); const cmTarget &tgt);
void WriteDSPBuildRule(std::ostream& fout, const char*); void WriteDSPBuildRule(std::ostream& fout, const char*);
void WriteDSPBuildRule(std::ostream& fout); void WriteDSPBuildRule(std::ostream& fout);
void WriteDSPFooter(std::ostream& fout); void WriteDSPFooter(std::ostream& fout);

View File

@ -53,10 +53,8 @@ void cmDSPMakefile::OutputDSPFile()
} }
// Create the DSP or set of DSP's for libraries and executables // Create the DSP or set of DSP's for libraries and executables
const char* cacheValue
= cmCacheManager::GetInstance()->GetCacheValue("BUILD_SHARED_LIBS");
m_LibraryBuildType = STATIC_LIBRARY; m_LibraryBuildType = STATIC_LIBRARY;
if(cacheValue && strcmp(cacheValue,"0")) if(cmCacheManager::GetInstance()->IsOn("BUILD_SHARED_LIBS"))
{ {
m_LibraryBuildType = DLL; m_LibraryBuildType = DLL;
} }
@ -69,30 +67,6 @@ void cmDSPMakefile::OutputDSPFile()
for(cmTargets::iterator l = tgts.begin(); for(cmTargets::iterator l = tgts.begin();
l != tgts.end(); l++) l != tgts.end(); l++)
{ {
std::string libOptions;
std::vector<std::string>& libdirs = m_Makefile->GetLinkDirectories();
for(i = libdirs.begin(); i != libdirs.end(); ++i)
{
libOptions += " /LIBPATH:\"";
libOptions += *i;
libOptions += "/$(OUTDIR)\" ";
libOptions += " /LIBPATH:\"";
libOptions += *i;
libOptions += "\" ";
}
std::vector<std::string>& libs = m_Makefile->GetLinkLibraries();
for(i = libs.begin(); i != libs.end(); ++i)
{
// add libraries to executables and dlls (but never include
// a library in a library, bad recursion)
if (!l->second.IsALibrary() ||
(m_LibraryBuildType == DLL && l->first.c_str() != *i))
{
libOptions += " ";
libOptions += *i;
libOptions += ".lib ";
}
}
if (l->second.IsALibrary()) if (l->second.IsALibrary())
{ {
this->SetBuildType(m_LibraryBuildType, l->first.c_str()); this->SetBuildType(m_LibraryBuildType, l->first.c_str());
@ -101,13 +75,11 @@ void cmDSPMakefile::OutputDSPFile()
{ {
this->SetBuildType(EXECUTABLE,l->first.c_str()); this->SetBuildType(EXECUTABLE,l->first.c_str());
} }
libOptions += "/STACK:10000000 "; this->CreateSingleDSP(l->first.c_str(),l->second);
this->CreateSingleDSP(l->first.c_str(),l->second, libOptions);
} }
} }
void cmDSPMakefile::CreateSingleDSP(const char *lname, cmTarget &target, void cmDSPMakefile::CreateSingleDSP(const char *lname, cmTarget &target)
const std::string &libOptions)
{ {
std::string fname; std::string fname;
fname = m_Makefile->GetStartOutputDirectory(); fname = m_Makefile->GetStartOutputDirectory();
@ -121,7 +93,7 @@ void cmDSPMakefile::CreateSingleDSP(const char *lname, cmTarget &target,
{ {
cmSystemTools::Error("Error Writing ", fname.c_str()); cmSystemTools::Error("Error Writing ", fname.c_str());
} }
this->WriteDSPFile(fout,lname,target, libOptions); this->WriteDSPFile(fout,lname,target);
} }
void cmDSPMakefile::WriteDSPBuildRule(std::ostream& fout) void cmDSPMakefile::WriteDSPBuildRule(std::ostream& fout)
@ -189,11 +161,10 @@ void cmDSPMakefile::AddDSPBuildRule(cmSourceGroup& sourceGroup)
void cmDSPMakefile::WriteDSPFile(std::ostream& fout, void cmDSPMakefile::WriteDSPFile(std::ostream& fout,
const char *libName, const char *libName,
cmTarget &target, cmTarget &target)
const std::string &libOptions)
{ {
// Write the DSP file's header. // Write the DSP file's header.
this->WriteDSPHeader(fout, libName, libOptions); this->WriteDSPHeader(fout, libName, target);
// We may be modifying the source groups temporarily, so make a copy. // We may be modifying the source groups temporarily, so make a copy.
std::vector<cmSourceGroup> sourceGroups = m_Makefile->GetSourceGroups(); std::vector<cmSourceGroup> sourceGroups = m_Makefile->GetSourceGroups();
@ -405,8 +376,55 @@ void cmDSPMakefile::SetBuildType(BuildType b, const char *libName)
} }
void cmDSPMakefile::WriteDSPHeader(std::ostream& fout, const char *libName, void cmDSPMakefile::WriteDSPHeader(std::ostream& fout, const char *libName,
const std::string &libOptions) const cmTarget &target)
{ {
// determine the link directories
std::string libOptions;
std::string libDebugOptions;
std::string libOptimizedOptions;
std::vector<std::string>::iterator i;
std::vector<std::string>& libdirs = m_Makefile->GetLinkDirectories();
for(i = libdirs.begin(); i != libdirs.end(); ++i)
{
libOptions += " /LIBPATH:\"";
libOptions += *i;
libOptions += "/$(OUTDIR)\" ";
libOptions += " /LIBPATH:\"";
libOptions += *i;
libOptions += "\" ";
}
// find link libraries
cmMakefile::LinkLibraries& libs = m_Makefile->GetLinkLibraries();
cmMakefile::LinkLibraries::const_iterator j;
for(j = libs.begin(); j != libs.end(); ++j)
{
// add libraries to executables and dlls (but never include
// a library in a library, bad recursion)
if (!target.IsALibrary() ||
(m_LibraryBuildType == DLL && libName != j->first))
{
if (j->second == cmMakefile::GENERAL)
{
libOptions += " ";
libOptions += j->first;
libOptions += ".lib ";
}
if (j->second == cmMakefile::DEBUG)
{
libDebugOptions += " ";
libDebugOptions += j->first;
libDebugOptions += ".lib ";
}
if (j->second == cmMakefile::OPTIMIZED)
{
libOptimizedOptions += " ";
libOptimizedOptions += j->first;
libOptimizedOptions += ".lib ";
}
}
}
libOptions += "/STACK:10000000 ";
std::ifstream fin(m_DSPHeaderTemplate.c_str()); std::ifstream fin(m_DSPHeaderTemplate.c_str());
if(!fin) if(!fin)
{ {
@ -420,6 +438,10 @@ void cmDSPMakefile::WriteDSPHeader(std::ostream& fout, const char *libName,
std::string line = buffer; std::string line = buffer;
cmSystemTools::ReplaceString(line, "CM_LIBRARIES", cmSystemTools::ReplaceString(line, "CM_LIBRARIES",
libOptions.c_str()); libOptions.c_str());
cmSystemTools::ReplaceString(line, "CM_DEBUG_LIBRARIES",
libDebugOptions.c_str());
cmSystemTools::ReplaceString(line, "CM_OPTIMIZED_LIBRARIES",
libOptimizedOptions.c_str());
cmSystemTools::ReplaceString(line, "BUILD_INCLUDES", cmSystemTools::ReplaceString(line, "BUILD_INCLUDES",
m_IncludeOptions.c_str()); m_IncludeOptions.c_str());
cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME",libName); cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME",libName);

View File

@ -67,16 +67,15 @@ private:
std::string m_DSPFooterTemplate; std::string m_DSPFooterTemplate;
std::vector<std::string> m_CreatedProjectNames; std::vector<std::string> m_CreatedProjectNames;
void CreateSingleDSP(const char *lname, cmTarget &tgt, void CreateSingleDSP(const char *lname, cmTarget &tgt);
const std::string &libs);
void WriteDSPFile(std::ostream& fout, const char *libName, void WriteDSPFile(std::ostream& fout, const char *libName,
cmTarget &tgt, const std::string &libs); cmTarget &tgt);
void WriteDSPBeginGroup(std::ostream& fout, void WriteDSPBeginGroup(std::ostream& fout,
const char* group, const char* group,
const char* filter); const char* filter);
void WriteDSPEndGroup(std::ostream& fout); void WriteDSPEndGroup(std::ostream& fout);
void WriteDSPHeader(std::ostream& fout, const char *libName, void WriteDSPHeader(std::ostream& fout, const char *libName,
const std::string &libs); const cmTarget &tgt);
void WriteDSPBuildRule(std::ostream& fout, const char*); void WriteDSPBuildRule(std::ostream& fout, const char*);
void WriteDSPBuildRule(std::ostream& fout); void WriteDSPBuildRule(std::ostream& fout);
void WriteDSPFooter(std::ostream& fout); void WriteDSPFooter(std::ostream& fout);

View File

@ -126,23 +126,24 @@ void cmDSWMakefile::WriteProject(std::ostream& fout,
fout << "{{{\n"; fout << "{{{\n";
// insert Begin Project Dependency Project_Dep_Name project stuff here // insert Begin Project Dependency Project_Dep_Name project stuff here
std::vector<std::string>::iterator i, end; cmMakefile::LinkLibraries::const_iterator j, jend;
i = project->GetMakefile()->GetLinkLibraries().begin(); j = project->GetMakefile()->GetLinkLibraries().begin();
end = project->GetMakefile()->GetLinkLibraries().end(); jend = project->GetMakefile()->GetLinkLibraries().end();
for(;i!= end; ++i) for(;j!= jend; ++j)
{ {
if(*i != dspname) if(j->first != dspname)
{ {
if (!l.IsALibrary() || if (!l.IsALibrary() ||
project->GetLibraryBuildType() == cmDSPMakefile::DLL) project->GetLibraryBuildType() == cmDSPMakefile::DLL)
{ {
fout << "Begin Project Dependency\n"; fout << "Begin Project Dependency\n";
fout << "Project_Dep_Name " << *i << "\n"; fout << "Project_Dep_Name " << j->first << "\n";
fout << "End Project Dependency\n"; fout << "End Project Dependency\n";
} }
} }
} }
std::vector<std::string>::iterator i, end;
// write utility dependencies. // write utility dependencies.
i = project->GetMakefile()->GetUtilities().begin(); i = project->GetMakefile()->GetUtilities().begin();
end = project->GetMakefile()->GetUtilities().end(); end = project->GetMakefile()->GetUtilities().end();

View File

@ -126,23 +126,24 @@ void cmDSWMakefile::WriteProject(std::ostream& fout,
fout << "{{{\n"; fout << "{{{\n";
// insert Begin Project Dependency Project_Dep_Name project stuff here // insert Begin Project Dependency Project_Dep_Name project stuff here
std::vector<std::string>::iterator i, end; cmMakefile::LinkLibraries::const_iterator j, jend;
i = project->GetMakefile()->GetLinkLibraries().begin(); j = project->GetMakefile()->GetLinkLibraries().begin();
end = project->GetMakefile()->GetLinkLibraries().end(); jend = project->GetMakefile()->GetLinkLibraries().end();
for(;i!= end; ++i) for(;j!= jend; ++j)
{ {
if(*i != dspname) if(j->first != dspname)
{ {
if (!l.IsALibrary() || if (!l.IsALibrary() ||
project->GetLibraryBuildType() == cmDSPMakefile::DLL) project->GetLibraryBuildType() == cmDSPMakefile::DLL)
{ {
fout << "Begin Project Dependency\n"; fout << "Begin Project Dependency\n";
fout << "Project_Dep_Name " << *i << "\n"; fout << "Project_Dep_Name " << j->first << "\n";
fout << "End Project Dependency\n"; fout << "End Project Dependency\n";
} }
} }
} }
std::vector<std::string>::iterator i, end;
// write utility dependencies. // write utility dependencies.
i = project->GetMakefile()->GetUtilities().begin(); i = project->GetMakefile()->GetUtilities().begin();
end = project->GetMakefile()->GetUtilities().end(); end = project->GetMakefile()->GetUtilities().end();

View File

@ -23,10 +23,27 @@ bool cmLinkLibrariesCommand::Invoke(std::vector<std::string>& args)
this->SetError("called with incorrect number of arguments"); this->SetError("called with incorrect number of arguments");
return false; return false;
} }
// add libraries, nothe that there is an optional prefix
// of debug and optimized than can be used
for(std::vector<std::string>::iterator i = args.begin(); for(std::vector<std::string>::iterator i = args.begin();
i != args.end(); ++i) i != args.end(); ++i)
{ {
m_Makefile->AddLinkLibrary((*i).c_str()); if (*i == "debug")
{
++i;
m_Makefile->AddLinkLibrary(i->c_str(),
cmMakefile::DEBUG);
}
else if (*i == "optimized")
{
++i;
m_Makefile->AddLinkLibrary(i->c_str(),
cmMakefile::OPTIMIZED);
}
else
{
m_Makefile->AddLinkLibrary(i->c_str());
}
} }
return true; return true;
} }

View File

@ -70,11 +70,14 @@ public:
virtual const char* GetFullDocumentation() virtual const char* GetFullDocumentation()
{ {
return return
"LINK_LIBRARIES(library1 library2)\n" "LINK_LIBRARIES(library1 <debug | optimized> library2 ...)\n"
"Specify a list of libraries to be linked into\n" "Specify a list of libraries to be linked into\n"
"executables or shared objects. This command is passed\n" "executables or shared objects. This command is passed\n"
"down to all other commands. The library name should be\n" "down to all other commands. The library name should be\n"
"the same as the name used in the LIBRARY(library) command."; "the same as the name used in the LIBRARY(library) command.\n"
"The debug and optimized strings may be used to indicate that\n"
"the next library listed is to be used only for that specific\n"
"type of build";
} }
cmTypeMacro(cmLinkLibrariesCommand, cmCommand); cmTypeMacro(cmLinkLibrariesCommand, cmCommand);

View File

@ -127,7 +127,6 @@ void cmMakefile::Print() const
this->PrintStringVector("m_MakeVerbatim ", m_MakeVerbatim); this->PrintStringVector("m_MakeVerbatim ", m_MakeVerbatim);
this->PrintStringVector("m_IncludeDirectories;", m_IncludeDirectories); this->PrintStringVector("m_IncludeDirectories;", m_IncludeDirectories);
this->PrintStringVector("m_LinkDirectories", m_LinkDirectories); this->PrintStringVector("m_LinkDirectories", m_LinkDirectories);
this->PrintStringVector("m_LinkLibraries", m_LinkLibraries);
this->PrintStringVector("m_Utilities", m_Utilities); this->PrintStringVector("m_Utilities", m_Utilities);
this->PrintStringVector("m_UtilityDirectories", m_UtilityDirectories); this->PrintStringVector("m_UtilityDirectories", m_UtilityDirectories);
} }
@ -335,9 +334,15 @@ void cmMakefile::AddUtilityDirectory(const char* dir)
m_UtilityDirectories.push_back(dir); m_UtilityDirectories.push_back(dir);
} }
void cmMakefile::AddLinkLibrary(const char* lib, LinkLibraryType llt)
{
m_LinkLibraries.push_back(
std::pair<std::string, LinkLibraryType>(lib,llt));
}
void cmMakefile::AddLinkLibrary(const char* lib) void cmMakefile::AddLinkLibrary(const char* lib)
{ {
m_LinkLibraries.push_back(lib); this->AddLinkLibrary(lib,GENERAL);
} }
void cmMakefile::AddLinkDirectory(const char* dir) void cmMakefile::AddLinkDirectory(const char* dir)
@ -483,11 +488,12 @@ void cmMakefile::ExpandVariables()
{ {
this->ExpandVariablesInString(*j); this->ExpandVariablesInString(*j);
} }
begin = m_LinkLibraries.begin(); LinkLibraries::iterator j2, end2;
end = m_LinkLibraries.end(); j2 = m_LinkLibraries.begin();
for(j = begin; j != end; ++j) end2 = m_LinkLibraries.end();
for(; j2 != end2; ++j2)
{ {
this->ExpandVariablesInString(*j); this->ExpandVariablesInString(j2->first);
} }
} }

View File

@ -118,10 +118,21 @@ public:
*/ */
void AddUtilityDirectory(const char*); void AddUtilityDirectory(const char*);
/**
* Get a list of link libraries in the build.
*/
enum LinkLibraryType {GENERAL, DEBUG, OPTIMIZED};
typedef std::vector<std::pair<std::string,LinkLibraryType> > LinkLibraries;
LinkLibraries& GetLinkLibraries()
{
return m_LinkLibraries;
}
/** /**
* Add a link library to the build. * Add a link library to the build.
*/ */
void AddLinkLibrary(const char*); void AddLinkLibrary(const char*);
void AddLinkLibrary(const char*, LinkLibraryType type);
/** /**
* Add a link directory to the build. * Add a link directory to the build.
@ -332,14 +343,6 @@ public:
return m_UtilityDirectories; return m_UtilityDirectories;
} }
/**
* Get a list of link libraries in the build.
*/
std::vector<std::string>& GetLinkLibraries()
{
return m_LinkLibraries;
}
/** /**
* Return a list of source files in this makefile. * Return a list of source files in this makefile.
*/ */
@ -446,7 +449,7 @@ protected:
std::vector<std::string> m_LinkDirectories; std::vector<std::string> m_LinkDirectories;
std::vector<std::string> m_Utilities; std::vector<std::string> m_Utilities;
std::vector<std::string> m_UtilityDirectories; std::vector<std::string> m_UtilityDirectories;
std::vector<std::string> m_LinkLibraries; LinkLibraries m_LinkLibraries;
std::string m_IncludeFileRegularExpression; std::string m_IncludeFileRegularExpression;
std::string m_DefineFlags; std::string m_DefineFlags;
std::vector<cmSourceGroup> m_SourceGroups; std::vector<cmSourceGroup> m_SourceGroups;

View File

@ -133,18 +133,21 @@ void cmUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
linkLibs += " "; linkLibs += " ";
} }
std::string librariesLinked; std::string librariesLinked;
std::vector<std::string>& libs = m_Makefile->GetLinkLibraries(); cmMakefile::LinkLibraries& libs = m_Makefile->GetLinkLibraries();
for(j = libs.begin(); j != libs.end(); ++j) cmMakefile::LinkLibraries::const_iterator j2;
for(j2 = libs.begin(); j2 != libs.end(); ++j2)
{ {
// Don't link the library against itself! // Don't link the library against itself!
if(targetLibrary && (*j == targetLibrary)) continue; if(targetLibrary && (j2->first == targetLibrary)) continue;
std::string::size_type pos = (*j).find("-l"); // don't look at debug libraries
if (j2->second == cmMakefile::DEBUG) continue;
std::string::size_type pos = j2->first.find("-l");
if((pos == std::string::npos || pos > 0) if((pos == std::string::npos || pos > 0)
&& (*j).find("${") == std::string::npos) && j2->first.find("${") == std::string::npos)
{ {
librariesLinked += "-l"; librariesLinked += "-l";
} }
librariesLinked += *j; librariesLinked += j2->first;
librariesLinked += " "; librariesLinked += " ";
} }
linkLibs += librariesLinked; linkLibs += librariesLinked;
@ -206,22 +209,22 @@ void cmUnixMakefileGenerator::OutputTargets(std::ostream& fout)
void cmUnixMakefileGenerator::OutputDependencies(std::ostream& fout) void cmUnixMakefileGenerator::OutputDependencies(std::ostream& fout)
{ {
fout << "CMAKE_DEPEND_LIBS = "; fout << "CMAKE_DEPEND_LIBS = ";
std::vector<std::string>& libs = m_Makefile->GetLinkLibraries(); cmMakefile::LinkLibraries& libs = m_Makefile->GetLinkLibraries();
std::vector<std::string>::iterator dir, lib; cmMakefile::LinkLibraries::const_iterator lib2;
// Search the list of libraries that will be linked into // Search the list of libraries that will be linked into
// the executable // the executable
for(lib = libs.begin(); lib != libs.end(); ++lib) for(lib2 = libs.begin(); lib2 != libs.end(); ++lib2)
{ {
// loop over the list of directories that the libraries might // loop over the list of directories that the libraries might
// be in, looking for an ADD_LIBRARY(lib...) line. This would // be in, looking for an ADD_LIBRARY(lib...) line. This would
// be stored in the cache // be stored in the cache
const char* cacheValue const char* cacheValue
= cmCacheManager::GetInstance()->GetCacheValue(lib->c_str()); = cmCacheManager::GetInstance()->GetCacheValue(lib2->first.c_str());
if(cacheValue) if(cacheValue)
{ {
std::string libpath = cacheValue; std::string libpath = cacheValue;
libpath += "/lib"; libpath += "/lib";
libpath += *lib; libpath += lib2->first;
libpath += "${CMAKE_LIB_EXT}"; libpath += "${CMAKE_LIB_EXT}";
fout << libpath << " "; fout << libpath << " ";
} }
@ -229,7 +232,7 @@ void cmUnixMakefileGenerator::OutputDependencies(std::ostream& fout)
std::vector<std::string>& utils = m_Makefile->GetUtilities(); std::vector<std::string>& utils = m_Makefile->GetUtilities();
std::vector<std::string>& utildirs = m_Makefile->GetUtilityDirectories(); std::vector<std::string>& utildirs = m_Makefile->GetUtilityDirectories();
std::vector<std::string>::iterator util; std::vector<std::string>::iterator dir, util;
// Search the list of utilities that may be used to generate code for // Search the list of utilities that may be used to generate code for
// this project. // this project.
for(util = utils.begin(); util != utils.end(); ++util) for(util = utils.begin(); util != utils.end(); ++util)

View File

@ -26,9 +26,7 @@ bool cmVTKWrapPythonCommand::Invoke(std::vector<std::string>& args)
// Now check and see if the value has been stored in the cache // Now check and see if the value has been stored in the cache
// already, if so use that value and don't look for the program // already, if so use that value and don't look for the program
const char* cacheValue if(!cmCacheManager::GetInstance()->IsOn("VTK_WRAP_PYTHON"))
= cmCacheManager::GetInstance()->GetCacheValue("VTK_WRAP_PYTHON");
if(!cacheValue || !strcmp(cacheValue,"0"))
{ {
return true; return true;
} }