summaryrefslogtreecommitdiffstats
path: root/Source/cmDSPMakefile.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2001-01-05 16:41:20 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2001-01-05 16:41:20 (GMT)
commitc54a05bfc799f3e88459956ec37698bab22c27f9 (patch)
tree400b2eb0b6853952a4faa8c0fc41b90eb06deaec /Source/cmDSPMakefile.cxx
parentd888b5e39d4e01af538b48ad16c2a6a474de34a0 (diff)
downloadCMake-c54a05bfc799f3e88459956ec37698bab22c27f9.zip
CMake-c54a05bfc799f3e88459956ec37698bab22c27f9.tar.gz
CMake-c54a05bfc799f3e88459956ec37698bab22c27f9.tar.bz2
ENH: rework cmake, added ruleMaker classes and changed the syntax of the CMakeLists.txt files.
Diffstat (limited to 'Source/cmDSPMakefile.cxx')
-rw-r--r--Source/cmDSPMakefile.cxx90
1 files changed, 51 insertions, 39 deletions
diff --git a/Source/cmDSPMakefile.cxx b/Source/cmDSPMakefile.cxx
index 9147bcb..1d62694 100644
--- a/Source/cmDSPMakefile.cxx
+++ b/Source/cmDSPMakefile.cxx
@@ -1,8 +1,6 @@
#include "cmDSPMakefile.h"
+#include "cmStandardIncludes.h"
#include "cmSystemTools.h"
-#include "cmCollectFlags.h"
-#include <iostream>
-#include <fstream>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef GetCurrentDirectory
@@ -12,12 +10,20 @@ static void Die(const char* message)
MessageBox(0, message, 0, MB_OK);
exit(-1);
}
+cmDSPMakefile::~cmDSPMakefile()
+{
+}
+
+cmDSPMakefile::cmDSPMakefile(cmMakefile*mf)
+{
+ m_Makefile = mf;
+}
void cmDSPMakefile::OutputDSPFile()
{
// Setup /I and /LIBPATH options
- std::vector<std::string>& includes = m_BuildFlags.GetIncludeDirectories();
+ std::vector<std::string>& includes = m_Makefile->GetIncludeDirectories();
std::vector<std::string>::iterator i;
for(i = includes.begin(); i != includes.end(); ++i)
{
@@ -25,21 +31,21 @@ void cmDSPMakefile::OutputDSPFile()
m_IncludeOptions += *i;
m_IncludeOptions += "\" ";
}
- std::vector<std::string>& libs = m_BuildFlags.GetLinkLibraries();
+ std::vector<std::string>& libs = m_Makefile->GetLinkLibraries();
for(i = libs.begin(); i != libs.end(); ++i)
{
m_DebugLibraryOptions += " ";
m_DebugLibraryOptions += *i;
m_DebugLibraryOptions += ".lib ";
}
- std::vector<std::string>& libswin32 = m_BuildFlags.GetLinkLibrariesWin32();
+ std::vector<std::string>& libswin32 = m_Makefile->GetLinkLibrariesWin32();
for(i = libswin32.begin(); i != libswin32.end(); ++i)
{
m_DebugLibraryOptions += " ";
m_DebugLibraryOptions += *i;
m_DebugLibraryOptions += ".lib ";
}
- std::vector<std::string>& libdirs = m_BuildFlags.GetLinkDirectories();
+ std::vector<std::string>& libdirs = m_Makefile->GetLinkDirectories();
for(i = libdirs.begin(); i != libdirs.end(); ++i)
{
m_DebugLibraryOptions += " /LIBPATH:\"";
@@ -53,23 +59,27 @@ void cmDSPMakefile::OutputDSPFile()
}
}
m_DebugLibraryOptions += "/STACK:10000000 ";
+ // add any extra define flags
+ m_DebugLibraryOptions += m_Makefile->GetDefineFlags();
m_ReleaseLibraryOptions = m_DebugLibraryOptions;
cmSystemTools::ReplaceString(m_ReleaseLibraryOptions, "Debug", "Release");
+
// If the output directory is not the m_cmHomeDirectory
// then create it.
- if(m_OutputDirectory != m_cmHomeDirectory)
+ if(strcmp(m_Makefile->GetOutputDirectory(),
+ m_Makefile->GetHomeDirectory()) != 0)
{
- if(!cmSystemTools::MakeDirectory(m_OutputDirectory.c_str()))
+ if(!cmSystemTools::MakeDirectory(m_Makefile->GetOutputDirectory()))
{
std::string message = "Error creating directory ";
- message += m_OutputDirectory;
+ message += m_Makefile->GetOutputDirectory();
Die(message.c_str());
}
}
- if(!m_Executables)
+ if(!m_Makefile->HasExecutables())
{
- if(this->m_LibraryName == "")
+ if(strlen(m_Makefile->GetLibraryName()) == 0)
{
// if no library silently give up
return;
@@ -84,10 +94,11 @@ void cmDSPMakefile::OutputDSPFile()
}
void cmDSPMakefile::CreateExecutableDSPFiles()
{
- for(int i = 0; i < m_Classes.size(); ++i)
+ std::vector<cmClassFile>& Classes = m_Makefile->GetClasses();
+ for(int i = 0; i < Classes.size(); ++i)
{
- cmClassFile& classfile = m_Classes[i];
- std::string fname = m_OutputDirectory;
+ cmClassFile& classfile = Classes[i];
+ std::string fname = m_Makefile->GetOutputDirectory();
fname += "/";
fname += classfile.m_ClassName;
fname += ".dsp";
@@ -100,9 +111,9 @@ void cmDSPMakefile::CreateExecutableDSPFiles()
}
else
{
- m_LibraryName = classfile.m_ClassName;
+ m_Makefile->SetLibraryName(classfile.m_ClassName.c_str());
this->SetBuildType(EXECUTABLE);
- std::string pname = m_LibraryName;
+ std::string pname = m_Makefile->GetLibraryName();
m_CreatedProjectNames.push_back(pname);
this->WriteDSPHeader(fout);
@@ -120,12 +131,12 @@ void cmDSPMakefile::CreateExecutableDSPFiles()
void cmDSPMakefile::CreateSingleDSP()
{
std::string fname;
- fname = m_OutputDirectory;
+ fname = m_Makefile->GetOutputDirectory();
fname += "/";
- fname += this->m_LibraryName;
+ fname += m_Makefile->GetLibraryName();
fname += ".dsp";
m_CreatedProjectNames.clear();
- std::string pname = m_LibraryName;
+ std::string pname = m_Makefile->GetLibraryName();
m_CreatedProjectNames.push_back(pname);
std::ofstream fout(fname.c_str());
if(!fout)
@@ -141,20 +152,20 @@ void cmDSPMakefile::WriteDSPBuildRule(std::ostream& fout)
{
std::string dspname = *(m_CreatedProjectNames.end()-1);
dspname += ".dsp";
- std::string makefileIn = this->GetCurrentDirectory();
+ std::string makefileIn = m_Makefile->GetCurrentDirectory();
makefileIn += "/";
makefileIn += "CMakeLists.txt";
- std::string dsprule = GetHomeDirectory();
+ std::string dsprule = m_Makefile->GetHomeDirectory();
dsprule += "/CMake/Source/CMakeSetupCMD ";
dsprule += makefileIn;
dsprule += " -DSP -H";
- dsprule += this->GetHomeDirectory();
+ dsprule += m_Makefile->GetHomeDirectory();
dsprule += " -D";
- dsprule += this->GetCurrentDirectory();
+ dsprule += m_Makefile->GetCurrentDirectory();
dsprule += " -O";
- dsprule += this->GetOutputDirectory();
+ dsprule += m_Makefile->GetOutputDirectory();
dsprule += " -B";
- dsprule += this->GetOutputHomeDirectory();
+ dsprule += m_Makefile->GetOutputHomeDirectory();
this->WriteCustomRule(fout, makefileIn.c_str(),
dspname.c_str(),
dsprule.c_str());
@@ -172,9 +183,9 @@ void cmDSPMakefile::WriteDSPFile(std::ostream& fout)
void cmDSPMakefile::WriteCustomRule(std::ostream& fout,
- const char* source,
- const char* result,
- const char* command)
+ const char* source,
+ const char* result,
+ const char* command)
{
fout << "# Begin Source File\n\n";
fout << "SOURCE=" << source << "\n\n";
@@ -208,21 +219,21 @@ void cmDSPMakefile::SetBuildType(BuildType b)
switch(b)
{
case STATIC_LIBRARY:
- m_DSPHeaderTemplate = m_cmHomeDirectory;
+ m_DSPHeaderTemplate = m_Makefile->GetHomeDirectory();
m_DSPHeaderTemplate += "/CMake/Source/staticLibHeader.dsptemplate";
- m_DSPFooterTemplate = m_cmHomeDirectory;
+ m_DSPFooterTemplate = m_Makefile->GetHomeDirectory();
m_DSPFooterTemplate += "/CMake/Source/staticLibFooter.dsptemplate";
break;
case DLL:
- m_DSPHeaderTemplate = m_cmHomeDirectory;
+ m_DSPHeaderTemplate = m_Makefile->GetHomeDirectory();
m_DSPHeaderTemplate += "/CMake/Source/DLLHeader.dsptemplate";
- m_DSPFooterTemplate = m_cmHomeDirectory;
+ m_DSPFooterTemplate = m_Makefile->GetHomeDirectory();
m_DSPFooterTemplate += "/CMake/Source/DLLFooter.dsptemplate";
break;
case EXECUTABLE:
- m_DSPHeaderTemplate = m_cmHomeDirectory;
+ m_DSPHeaderTemplate = m_Makefile->GetHomeDirectory();
m_DSPHeaderTemplate += "/CMake/Source/EXEHeader.dsptemplate";
- m_DSPFooterTemplate = m_cmHomeDirectory;
+ m_DSPFooterTemplate = m_Makefile->GetHomeDirectory();
m_DSPFooterTemplate += "/CMake/Source/EXEFooter.dsptemplate";
break;
}
@@ -250,7 +261,7 @@ void cmDSPMakefile::WriteDSPHeader(std::ostream& fout)
cmSystemTools::ReplaceString(line, "BUILD_INCLUDES",
m_IncludeOptions.c_str());
cmSystemTools::ReplaceString(line, "OUTPUT_LIBNAME",
- m_LibraryName.c_str());
+ m_Makefile->GetLibraryName());
cmSystemTools::ReplaceString(line,
"EXTRA_DEFINES", "");
fout << line.c_str() << std::endl;
@@ -278,11 +289,12 @@ void cmDSPMakefile::WriteDSPFooter(std::ostream& fout)
void cmDSPMakefile::WriteDSPBuildRules(std::ostream& fout)
{
- for(int i = 0; i < m_Classes.size(); ++i)
+ std::vector<cmClassFile>& Classes = m_Makefile->GetClasses();
+ for(int i = 0; i < Classes.size(); ++i)
{
- if(!m_Classes[i].m_AbstractClass && !m_Classes[i].m_HeaderFileOnly)
+ if(!Classes[i].m_AbstractClass && !Classes[i].m_HeaderFileOnly)
{
- this->WriteDSPBuildRule(fout, m_Classes[i].m_FullPath.c_str());
+ this->WriteDSPBuildRule(fout, Classes[i].m_FullPath.c_str());
}
}
}