many enhancements including dll support

This commit is contained in:
Ken Martin 2001-02-27 16:50:51 -05:00
parent d13d283f14
commit e5e2a57bfb
6 changed files with 76 additions and 34 deletions

View File

@ -17,6 +17,7 @@
#include "cmStandardIncludes.h" #include "cmStandardIncludes.h"
#include "cmSystemTools.h" #include "cmSystemTools.h"
#include "cmRegularExpression.h" #include "cmRegularExpression.h"
#include "cmCacheManager.h"
cmDSPMakefile::~cmDSPMakefile() cmDSPMakefile::~cmDSPMakefile()
{ {
@ -81,13 +82,27 @@ void cmDSPMakefile::OutputDSPFile()
// add any extra define flags // add any extra define flags
m_ReleaseLibraryOptions = m_DebugLibraryOptions; m_ReleaseLibraryOptions = m_DebugLibraryOptions;
cmSystemTools::ReplaceString(m_ReleaseLibraryOptions, "Debug", "Release"); cmSystemTools::ReplaceString(m_ReleaseLibraryOptions, "Debug", "Release");
m_DebugDLLLibraryOptions = m_DebugLibraryOptions;
cmSystemTools::ReplaceString(m_DebugDLLLibraryOptions, "Debug", "DebugDLL");
m_ReleaseDLLLibraryOptions = m_DebugDLLLibraryOptions;
cmSystemTools::ReplaceString(m_ReleaseDLLLibraryOptions, "Debug", "Release");
m_ReleaseMinSizeLibraryOptions = m_ReleaseLibraryOptions;
cmSystemTools::ReplaceString(m_ReleaseMinSizeLibraryOptions,
"Release", "ReleaseMinSize");
// Create the DSP or set of DSP's for libraries and executables // Create the DSP or set of DSP's for libraries and executables
if(strlen(m_Makefile->GetLibraryName()) != 0) if(strlen(m_Makefile->GetLibraryName()) != 0)
{
const char* cacheValue
= cmCacheManager::GetInstance()->GetCacheValue("BUILD_SHARED_LIBS");
if(cacheValue && strcmp(cacheValue,"0"))
{
this->SetBuildType(DLL);
}
else
{ {
this->SetBuildType(STATIC_LIBRARY); this->SetBuildType(STATIC_LIBRARY);
}
this->CreateSingleDSP(); this->CreateSingleDSP();
} }
// if there are executables build them // if there are executables build them
@ -305,8 +320,14 @@ void cmDSPMakefile::WriteDSPHeader(std::ostream& fout)
std::string line = buffer; std::string line = buffer;
cmSystemTools::ReplaceString(line, "CM_RELEASE_LIBRARIES", cmSystemTools::ReplaceString(line, "CM_RELEASE_LIBRARIES",
m_ReleaseLibraryOptions.c_str()); m_ReleaseLibraryOptions.c_str());
cmSystemTools::ReplaceString(line, "CM_RELEASEMINSIZE_LIBRARIES",
m_ReleaseMinSizeLibraryOptions.c_str());
cmSystemTools::ReplaceString(line, "CM_DEBUG_LIBRARIES", cmSystemTools::ReplaceString(line, "CM_DEBUG_LIBRARIES",
m_DebugLibraryOptions.c_str()); m_DebugLibraryOptions.c_str());
cmSystemTools::ReplaceString(line, "CM_RELEASEDLL_LIBRARIES",
m_ReleaseDLLLibraryOptions.c_str());
cmSystemTools::ReplaceString(line, "CM_DEBUGDLL_LIBRARIES",
m_DebugDLLLibraryOptions.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", cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME",
@ -357,8 +378,7 @@ void cmDSPMakefile::WriteDSPBuildRules(std::ostream& fout, const char *ext)
std::vector<cmClassFile>& Classes = m_Makefile->GetClasses(); std::vector<cmClassFile>& Classes = m_Makefile->GetClasses();
for(int i = 0; i < Classes.size(); ++i) for(int i = 0; i < Classes.size(); ++i)
{ {
if(!Classes[i].m_IsExecutable && !Classes[i].m_AbstractClass && if(!Classes[i].m_IsExecutable && !Classes[i].m_HeaderFileOnly)
!Classes[i].m_HeaderFileOnly)
{ {
// is this class of the appropriate type ? // is this class of the appropriate type ?
if (std::find(exts.begin(),exts.end(),Classes[i].m_ClassExtension) if (std::find(exts.begin(),exts.end(),Classes[i].m_ClassExtension)

View File

@ -82,6 +82,9 @@ private:
std::string m_IncludeOptions; std::string m_IncludeOptions;
std::string m_DebugLibraryOptions; std::string m_DebugLibraryOptions;
std::string m_ReleaseLibraryOptions; std::string m_ReleaseLibraryOptions;
std::string m_ReleaseMinSizeLibraryOptions;
std::string m_DebugDLLLibraryOptions;
std::string m_ReleaseDLLLibraryOptions;
cmMakefile* m_Makefile; cmMakefile* m_Makefile;
std::vector<std::string> m_Configurations; std::vector<std::string> m_Configurations;

View File

@ -17,6 +17,7 @@
#include "cmStandardIncludes.h" #include "cmStandardIncludes.h"
#include "cmSystemTools.h" #include "cmSystemTools.h"
#include "cmRegularExpression.h" #include "cmRegularExpression.h"
#include "cmCacheManager.h"
cmDSPMakefile::~cmDSPMakefile() cmDSPMakefile::~cmDSPMakefile()
{ {
@ -81,13 +82,27 @@ void cmDSPMakefile::OutputDSPFile()
// add any extra define flags // add any extra define flags
m_ReleaseLibraryOptions = m_DebugLibraryOptions; m_ReleaseLibraryOptions = m_DebugLibraryOptions;
cmSystemTools::ReplaceString(m_ReleaseLibraryOptions, "Debug", "Release"); cmSystemTools::ReplaceString(m_ReleaseLibraryOptions, "Debug", "Release");
m_DebugDLLLibraryOptions = m_DebugLibraryOptions;
cmSystemTools::ReplaceString(m_DebugDLLLibraryOptions, "Debug", "DebugDLL");
m_ReleaseDLLLibraryOptions = m_DebugDLLLibraryOptions;
cmSystemTools::ReplaceString(m_ReleaseDLLLibraryOptions, "Debug", "Release");
m_ReleaseMinSizeLibraryOptions = m_ReleaseLibraryOptions;
cmSystemTools::ReplaceString(m_ReleaseMinSizeLibraryOptions,
"Release", "ReleaseMinSize");
// Create the DSP or set of DSP's for libraries and executables // Create the DSP or set of DSP's for libraries and executables
if(strlen(m_Makefile->GetLibraryName()) != 0) if(strlen(m_Makefile->GetLibraryName()) != 0)
{
const char* cacheValue
= cmCacheManager::GetInstance()->GetCacheValue("BUILD_SHARED_LIBS");
if(cacheValue && strcmp(cacheValue,"0"))
{
this->SetBuildType(DLL);
}
else
{ {
this->SetBuildType(STATIC_LIBRARY); this->SetBuildType(STATIC_LIBRARY);
}
this->CreateSingleDSP(); this->CreateSingleDSP();
} }
// if there are executables build them // if there are executables build them
@ -305,8 +320,14 @@ void cmDSPMakefile::WriteDSPHeader(std::ostream& fout)
std::string line = buffer; std::string line = buffer;
cmSystemTools::ReplaceString(line, "CM_RELEASE_LIBRARIES", cmSystemTools::ReplaceString(line, "CM_RELEASE_LIBRARIES",
m_ReleaseLibraryOptions.c_str()); m_ReleaseLibraryOptions.c_str());
cmSystemTools::ReplaceString(line, "CM_RELEASEMINSIZE_LIBRARIES",
m_ReleaseMinSizeLibraryOptions.c_str());
cmSystemTools::ReplaceString(line, "CM_DEBUG_LIBRARIES", cmSystemTools::ReplaceString(line, "CM_DEBUG_LIBRARIES",
m_DebugLibraryOptions.c_str()); m_DebugLibraryOptions.c_str());
cmSystemTools::ReplaceString(line, "CM_RELEASEDLL_LIBRARIES",
m_ReleaseDLLLibraryOptions.c_str());
cmSystemTools::ReplaceString(line, "CM_DEBUGDLL_LIBRARIES",
m_DebugDLLLibraryOptions.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", cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME",
@ -357,8 +378,7 @@ void cmDSPMakefile::WriteDSPBuildRules(std::ostream& fout, const char *ext)
std::vector<cmClassFile>& Classes = m_Makefile->GetClasses(); std::vector<cmClassFile>& Classes = m_Makefile->GetClasses();
for(int i = 0; i < Classes.size(); ++i) for(int i = 0; i < Classes.size(); ++i)
{ {
if(!Classes[i].m_IsExecutable && !Classes[i].m_AbstractClass && if(!Classes[i].m_IsExecutable && !Classes[i].m_HeaderFileOnly)
!Classes[i].m_HeaderFileOnly)
{ {
// is this class of the appropriate type ? // is this class of the appropriate type ?
if (std::find(exts.begin(),exts.end(),Classes[i].m_ClassExtension) if (std::find(exts.begin(),exts.end(),Classes[i].m_ClassExtension)

View File

@ -82,6 +82,9 @@ private:
std::string m_IncludeOptions; std::string m_IncludeOptions;
std::string m_DebugLibraryOptions; std::string m_DebugLibraryOptions;
std::string m_ReleaseLibraryOptions; std::string m_ReleaseLibraryOptions;
std::string m_ReleaseMinSizeLibraryOptions;
std::string m_DebugDLLLibraryOptions;
std::string m_ReleaseDLLLibraryOptions;
cmMakefile* m_Makefile; cmMakefile* m_Makefile;
std::vector<std::string> m_Configurations; std::vector<std::string> m_Configurations;

View File

@ -121,8 +121,7 @@ void cmDSWMakefile::WriteProject(std::ostream& fout,
fout << "Package=<5>\n{{{\n}}}\n\n"; fout << "Package=<5>\n{{{\n}}}\n\n";
fout << "Package=<4>\n"; fout << "Package=<4>\n";
fout << "{{{\n"; fout << "{{{\n";
if(project->GetMakefile()->HasExecutables())
{
// 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; std::vector<std::string>::iterator i, end;
i = project->GetMakefile()->GetLinkLibraries().begin(); i = project->GetMakefile()->GetLinkLibraries().begin();
@ -136,7 +135,6 @@ void cmDSWMakefile::WriteProject(std::ostream& fout,
fout << "End Project Dependency\n"; fout << "End Project Dependency\n";
} }
} }
}
fout << "}}}\n\n"; fout << "}}}\n\n";
} }

View File

@ -121,8 +121,7 @@ void cmDSWMakefile::WriteProject(std::ostream& fout,
fout << "Package=<5>\n{{{\n}}}\n\n"; fout << "Package=<5>\n{{{\n}}}\n\n";
fout << "Package=<4>\n"; fout << "Package=<4>\n";
fout << "{{{\n"; fout << "{{{\n";
if(project->GetMakefile()->HasExecutables())
{
// 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; std::vector<std::string>::iterator i, end;
i = project->GetMakefile()->GetLinkLibraries().begin(); i = project->GetMakefile()->GetLinkLibraries().begin();
@ -136,7 +135,6 @@ void cmDSWMakefile::WriteProject(std::ostream& fout,
fout << "End Project Dependency\n"; fout << "End Project Dependency\n";
} }
} }
}
fout << "}}}\n\n"; fout << "}}}\n\n";
} }