ENH: move from tools and create working CMake program

This commit is contained in:
Bill Hoffman 2000-08-30 13:35:41 -04:00
parent 1f42f521ce
commit 077c31484e
15 changed files with 224 additions and 113 deletions

View File

@ -15,7 +15,7 @@
#
#------------------------------------------------------------------------------
#
all: ${OBJ_SUB_DIRS} ${EXECUTABLES} ${SUBDIR_BUILD} ${ITK_LIB_FILE} ${LOCAL_BUILD_TARGETS}
all: ${OBJ_SUB_DIRS} ${EXECUTABLES} ${SUBDIR_BUILD} ${BUILD_LIB_FILE} ${LOCAL_BUILD_TARGETS}
#------------------------------------------------------------------------------
@ -46,6 +46,6 @@ lib$(ME)$(SHLIB_SUFFIX): ${KIT_OBJ}
lib$(ME)$(SHLIB_SUFFIX) \
${KIT_OBJ} ${SHLIB_LD_LIBS}
install: ${ITK_LIB_FILE}
@echo "Installing ${ITK_LIB_FILE}"
${INSTALL} -m 755 $(ITK_LIB_FILE) $(LIB_INSTALL_DIR)/$(ITK_LIB_FILE)
install: ${BUILD_LIB_FILE}
@echo "Installing ${BUILD_LIB_FILE}"
${INSTALL} -m 755 $(BUILD_LIB_FILE) $(LIB_INSTALL_DIR)/$(BUILD_LIB_FILE)

View File

@ -105,5 +105,5 @@ CC_FLAGS = ${CPPFLAGS} ${LOCAL_CFLAGS} ${CFLAGS}
# set up the path to the rulesgen program
CMAKE = @CMAKE_OBJ_DIR@/CMake/Source/CMakeBuildTargets
KIT_OBJ = ${SRC_OBJ}
BUILD_LIB_FILE = lib${ME}${ITK_LIB_EXT}

12
README
View File

@ -13,6 +13,18 @@ Unix
configure -> run on unix to configure for build
CMakeBuildTargets -> Unix program to read CMakeLists.txt and generate CMakeTargets.make
CMakeLists.txt:
WIN32_CLASSES =
UNIX_CLASSES =
ABSTRACT_CLASSES =
SUBDIRS =
EXECUTABLES =
ME =
BEGIN MAKE VERBATIM
... # copy stuff into CMakeTargets.make directly
END MAKE VERBATIM
TEMPLATE_INSTANCE_DIR =
TODO:
Fix cmUnixMakefile.cxx and cmDSPMakefile.cxx
to read libraries and -I stuff from a config file

View File

@ -91,10 +91,18 @@ LINK32=link.exe
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\CMakeSetupCMD.cxx
# End Source File
# Begin Source File
SOURCE=.\cmClassFile.cxx
# End Source File
# Begin Source File
SOURCE=.\cmDirectory.cxx
# End Source File
# Begin Source File
SOURCE=.\cmDSPBuilder.cxx
# End Source File
# Begin Source File
@ -129,10 +137,6 @@ SOURCE=.\cmRegularExpression.cxx
SOURCE=.\cmSystemTools.cxx
# End Source File
# Begin Source File
SOURCE=.\CMakeSetupCMD.cxx
# End Source File
# End Group
# Begin Group "Header Files"

View File

@ -92,10 +92,26 @@ LINK32=link.exe
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\CMakeSetup.cpp
# End Source File
# Begin Source File
SOURCE=.\CMakeSetup.rc
# End Source File
# Begin Source File
SOURCE=.\CMakeSetupDialog.cpp
# End Source File
# Begin Source File
SOURCE=..\cmClassFile.cxx
# End Source File
# Begin Source File
SOURCE=..\cmDirectory.cxx
# End Source File
# Begin Source File
SOURCE=..\cmDSPBuilder.cxx
# End Source File
# Begin Source File
@ -132,23 +148,11 @@ SOURCE=..\cmSystemTools.cxx
# End Source File
# Begin Source File
SOURCE=..\itkVC60Configure.cxx
# End Source File
# Begin Source File
SOURCE=..\cmWindowsConfigure.cxx
# End Source File
# Begin Source File
SOURCE=.\CMakeSetup.cpp
# End Source File
# Begin Source File
SOURCE=.\CMakeSetup.rc
# End Source File
# Begin Source File
SOURCE=.\CMakeSetupDialog.cpp
SOURCE=..\itkVC60Configure.cxx
# End Source File
# Begin Source File
@ -161,6 +165,18 @@ SOURCE=.\StdAfx.cpp
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\CMakeSetup.h
# End Source File
# Begin Source File
SOURCE=.\CMakeSetup.h
# End Source File
# Begin Source File
SOURCE=.\CMakeSetupDialog.h
# End Source File
# Begin Source File
SOURCE=..\cmClassFile.h
# End Source File
# Begin Source File
@ -189,22 +205,10 @@ SOURCE=..\cmMakefile.h
# End Source File
# Begin Source File
SOURCE=..\CMakeSetup.h
# End Source File
# Begin Source File
SOURCE=..\cmRegularExpression.h
# End Source File
# Begin Source File
SOURCE=.\CMakeSetup.h
# End Source File
# Begin Source File
SOURCE=.\CMakeSetupDialog.h
# End Source File
# Begin Source File
SOURCE=.\Resource.h
# End Source File
# Begin Source File
@ -221,11 +225,11 @@ SOURCE=.\res\CMakeSetup.ico
# End Source File
# Begin Source File
SOURCE=.\res\CMakeSetupDialog.rc2
SOURCE=.\res\CMakeSetupDialog.ico
# End Source File
# Begin Source File
SOURCE=.\res\CMakeSetupDialog.ico
SOURCE=.\res\CMakeSetupDialog.rc2
# End Source File
# End Group
# Begin Source File

View File

@ -235,13 +235,13 @@ void CMakeSetupDialog::OnOK()
cmDSWBuilder builder;
// Set the ITK home directory
builder.SetHomeDirectory(m_WhereSource);
// Set the Makefile.in file
// Set the CMakeLists.txt file
CString makefileIn = m_WhereSource;
makefileIn += "/Makefile.in";
makefileIn += "/CMakeLists.txt";
builder.SetInputMakefilePath(makefileIn);
// Set the output directory
builder.SetOutputDirectory(m_WhereBuild);
// set the directory which contains the Makefile.in
// set the directory which contains the CMakeLists.txt
builder.SetMakefileDirectory(m_WhereSource);
// Create the master DSW file and all children dsp files for ITK
builder.CreateDSWFile();

View File

@ -12,12 +12,15 @@ CMAKE =
OBJS = \
cmClassFile.o \
cmDirectory.o \
cmMakefile.o \
cmUnixMakefile.o \
cmMakeDepend.o \
cmRegularExpression.o \
CMakeBuildTargets.o
CMakeBuildTargets.o
cmDirectory.o : cmDirectory.h cmDirectory.cxx
cmClassFile.o : cmClassFile.h cmClassFile.cxx
cmMakefile.o : cmMakefile.h cmMakefile.cxx cmClassFile.h
cmUnixMakefile.o : cmUnixMakefile.h cmUnixMakefile.cxx cmMakefile.h cmClassFile.h

View File

@ -38,11 +38,12 @@ void cmClassFile::SetName(const char* name, const char* dir)
std::string hname = pathname;
hname += ".cxx";
if(cmFileExists(hname.c_str()))
{
{
m_HeaderFileOnly = false;
m_FullPath = hname;
return;
}
}
hname = pathname;
hname += ".c";
if(cmFileExists(hname.c_str()))

View File

@ -4,6 +4,13 @@
#include <fstream>
#include <windows.h>
static void Die(const char* message)
{
MessageBox(0, message, 0, MB_OK);
exit(-1);
}
void cmDSPMakefile::OutputDSPFile()
{
m_IncludeOptions = "/STACK:10000000 ";
@ -36,8 +43,9 @@ void cmDSPMakefile::OutputDSPFile()
{
if(!cmSystemTools::MakeDirectory(m_OutputDirectory.c_str()))
{
MessageBox(0, "Error creating directory ", 0, MB_OK);
MessageBox(0, m_OutputDirectory.c_str(), 0, MB_OK);
std::string message = "Error creating directory ";
message += m_OutputDirectory;
Die(message.c_str());
}
}
@ -45,22 +53,19 @@ void cmDSPMakefile::OutputDSPFile()
{
if(this->m_LibraryName == "")
{
std::cerr << "No library name in Makefile.in dsp not created" << std::endl;
// if no library silently give up
return;
}
std::cerr << "building library " << this->m_LibraryName.c_str() << std::endl;
this->SetBuildType(STATIC_LIBRARY);
this->CreateSingleDSP();
}
else
{
std::cerr << "Build Executables " << std::endl;
this->CreateExecutableDSPFiles();
}
}
void cmDSPMakefile::CreateExecutableDSPFiles()
{
std::cerr << "Create executables for ";
for(int i = 0; i < m_Classes.size(); ++i)
{
cmClassFile& classfile = m_Classes[i];
@ -71,9 +76,9 @@ void cmDSPMakefile::CreateExecutableDSPFiles()
std::ofstream fout(fname.c_str());
if(!fout)
{
MessageBox(0, "Error writing ", 0, MB_OK);
MessageBox(0, fname.c_str(), 0, MB_OK);
std::cerr << "Error can not open " << fname.c_str() << " for write" << std::endl;
std::string message = "Error Writing ";
message += fname;
Die(message.c_str());
}
else
{
@ -97,8 +102,6 @@ void cmDSPMakefile::CreateExecutableDSPFiles()
void cmDSPMakefile::CreateSingleDSP()
{
std::string fname;
std::cerr << "writting dsp file " << m_cmCurrentDirectory.c_str()
<< std::endl;
fname = m_OutputDirectory;
fname += "/";
fname += this->m_LibraryName;
@ -106,15 +109,13 @@ void cmDSPMakefile::CreateSingleDSP()
m_CreatedProjectNames.clear();
std::string pname = m_LibraryName;
m_CreatedProjectNames.push_back(pname);
std::cerr << "writting dsp file " << fname.c_str() << std::endl;
std::ofstream fout(fname.c_str());
if(!fout)
{
MessageBox(0, "Error writing ", 0, MB_OK);
MessageBox(0, fname.c_str(), 0, MB_OK);
std::cerr << "Error can not open " << fname.c_str() << " for write" << std::endl;
return;
}
std::string message = "Error Writing ";
message += fname;
Die(message.c_str());
}
this->WriteDSPFile(fout);
}
@ -125,7 +126,7 @@ void cmDSPMakefile::WriteDSPBuildRule(std::ostream& fout)
#undef GetCurrentDirectory
std::string makefileIn = this->GetCurrentDirectory();
makefileIn += "/";
makefileIn += "Makefile.in";
makefileIn += "CMakeLists.txt";
std::string dsprule = GetHomeDirectory();
dsprule += "/CMake/pcbuilderCMD ";
dsprule += makefileIn;
@ -191,21 +192,21 @@ void cmDSPMakefile::SetBuildType(BuildType b)
{
case STATIC_LIBRARY:
m_DSPHeaderTemplate = m_cmHomeDirectory;
m_DSPHeaderTemplate += "/CMake/staticLibHeader.dsptemplate";
m_DSPHeaderTemplate += "/CMake/Source/staticLibHeader.dsptemplate";
m_DSPFooterTemplate = m_cmHomeDirectory;
m_DSPFooterTemplate += "/CMake/staticLibFooter.dsptemplate";
m_DSPFooterTemplate += "/CMake/Source/staticLibFooter.dsptemplate";
break;
case DLL:
m_DSPHeaderTemplate = m_cmHomeDirectory;
m_DSPHeaderTemplate += "/CMake/DLLHeader.dsptemplate";
m_DSPHeaderTemplate += "/CMake/Source/DLLHeader.dsptemplate";
m_DSPFooterTemplate = m_cmHomeDirectory;
m_DSPFooterTemplate += "/CMake/DLLFooter.dsptemplate";
m_DSPFooterTemplate += "/CMake/Source/DLLFooter.dsptemplate";
break;
case EXECUTABLE:
m_DSPHeaderTemplate = m_cmHomeDirectory;
m_DSPHeaderTemplate += "/CMake/EXEHeader.dsptemplate";
m_DSPHeaderTemplate += "/CMake/Source/EXEHeader.dsptemplate";
m_DSPFooterTemplate = m_cmHomeDirectory;
m_DSPFooterTemplate += "/CMake/EXEFooter.dsptemplate";
m_DSPFooterTemplate += "/CMake/Source/EXEFooter.dsptemplate";
break;
}
}
@ -216,9 +217,9 @@ void cmDSPMakefile::WriteDSPHeader(std::ostream& fout)
std::ifstream fin(m_DSPHeaderTemplate.c_str());
if(!fin)
{
std::cerr << "failed to open " << m_DSPHeaderTemplate.c_str()
<< " for read" << std::endl;
return;
std::string message = "Error Reading ";
message += m_DSPHeaderTemplate;
Die(message.c_str());
}
char buffer[2048];
while(fin)
@ -245,9 +246,9 @@ void cmDSPMakefile::WriteDSPFooter(std::ostream& fout)
std::ifstream fin(m_DSPFooterTemplate.c_str());
if(!fin)
{
std::cerr << "can not open " << m_DSPFooterTemplate.c_str() <<
" for read" << std::endl;
return;
std::string message = "Error Reading ";
message += m_DSPFooterTemplate;
Die(message.c_str());
}
char buffer[2048];
while(fin)

View File

@ -4,6 +4,13 @@
#include <fstream>
#include <windows.h>
static void Die(const char* message)
{
MessageBox(0, message, 0, MB_OK);
exit(-1);
}
void cmDSPMakefile::OutputDSPFile()
{
m_IncludeOptions = "/STACK:10000000 ";
@ -36,8 +43,9 @@ void cmDSPMakefile::OutputDSPFile()
{
if(!cmSystemTools::MakeDirectory(m_OutputDirectory.c_str()))
{
MessageBox(0, "Error creating directory ", 0, MB_OK);
MessageBox(0, m_OutputDirectory.c_str(), 0, MB_OK);
std::string message = "Error creating directory ";
message += m_OutputDirectory;
Die(message.c_str());
}
}
@ -45,22 +53,19 @@ void cmDSPMakefile::OutputDSPFile()
{
if(this->m_LibraryName == "")
{
std::cerr << "No library name in Makefile.in dsp not created" << std::endl;
// if no library silently give up
return;
}
std::cerr << "building library " << this->m_LibraryName.c_str() << std::endl;
this->SetBuildType(STATIC_LIBRARY);
this->CreateSingleDSP();
}
else
{
std::cerr << "Build Executables " << std::endl;
this->CreateExecutableDSPFiles();
}
}
void cmDSPMakefile::CreateExecutableDSPFiles()
{
std::cerr << "Create executables for ";
for(int i = 0; i < m_Classes.size(); ++i)
{
cmClassFile& classfile = m_Classes[i];
@ -71,9 +76,9 @@ void cmDSPMakefile::CreateExecutableDSPFiles()
std::ofstream fout(fname.c_str());
if(!fout)
{
MessageBox(0, "Error writing ", 0, MB_OK);
MessageBox(0, fname.c_str(), 0, MB_OK);
std::cerr << "Error can not open " << fname.c_str() << " for write" << std::endl;
std::string message = "Error Writing ";
message += fname;
Die(message.c_str());
}
else
{
@ -97,8 +102,6 @@ void cmDSPMakefile::CreateExecutableDSPFiles()
void cmDSPMakefile::CreateSingleDSP()
{
std::string fname;
std::cerr << "writting dsp file " << m_cmCurrentDirectory.c_str()
<< std::endl;
fname = m_OutputDirectory;
fname += "/";
fname += this->m_LibraryName;
@ -106,15 +109,13 @@ void cmDSPMakefile::CreateSingleDSP()
m_CreatedProjectNames.clear();
std::string pname = m_LibraryName;
m_CreatedProjectNames.push_back(pname);
std::cerr << "writting dsp file " << fname.c_str() << std::endl;
std::ofstream fout(fname.c_str());
if(!fout)
{
MessageBox(0, "Error writing ", 0, MB_OK);
MessageBox(0, fname.c_str(), 0, MB_OK);
std::cerr << "Error can not open " << fname.c_str() << " for write" << std::endl;
return;
}
std::string message = "Error Writing ";
message += fname;
Die(message.c_str());
}
this->WriteDSPFile(fout);
}
@ -125,7 +126,7 @@ void cmDSPMakefile::WriteDSPBuildRule(std::ostream& fout)
#undef GetCurrentDirectory
std::string makefileIn = this->GetCurrentDirectory();
makefileIn += "/";
makefileIn += "Makefile.in";
makefileIn += "CMakeLists.txt";
std::string dsprule = GetHomeDirectory();
dsprule += "/CMake/pcbuilderCMD ";
dsprule += makefileIn;
@ -191,21 +192,21 @@ void cmDSPMakefile::SetBuildType(BuildType b)
{
case STATIC_LIBRARY:
m_DSPHeaderTemplate = m_cmHomeDirectory;
m_DSPHeaderTemplate += "/CMake/staticLibHeader.dsptemplate";
m_DSPHeaderTemplate += "/CMake/Source/staticLibHeader.dsptemplate";
m_DSPFooterTemplate = m_cmHomeDirectory;
m_DSPFooterTemplate += "/CMake/staticLibFooter.dsptemplate";
m_DSPFooterTemplate += "/CMake/Source/staticLibFooter.dsptemplate";
break;
case DLL:
m_DSPHeaderTemplate = m_cmHomeDirectory;
m_DSPHeaderTemplate += "/CMake/DLLHeader.dsptemplate";
m_DSPHeaderTemplate += "/CMake/Source/DLLHeader.dsptemplate";
m_DSPFooterTemplate = m_cmHomeDirectory;
m_DSPFooterTemplate += "/CMake/DLLFooter.dsptemplate";
m_DSPFooterTemplate += "/CMake/Source/DLLFooter.dsptemplate";
break;
case EXECUTABLE:
m_DSPHeaderTemplate = m_cmHomeDirectory;
m_DSPHeaderTemplate += "/CMake/EXEHeader.dsptemplate";
m_DSPHeaderTemplate += "/CMake/Source/EXEHeader.dsptemplate";
m_DSPFooterTemplate = m_cmHomeDirectory;
m_DSPFooterTemplate += "/CMake/EXEFooter.dsptemplate";
m_DSPFooterTemplate += "/CMake/Source/EXEFooter.dsptemplate";
break;
}
}
@ -216,9 +217,9 @@ void cmDSPMakefile::WriteDSPHeader(std::ostream& fout)
std::ifstream fin(m_DSPHeaderTemplate.c_str());
if(!fin)
{
std::cerr << "failed to open " << m_DSPHeaderTemplate.c_str()
<< " for read" << std::endl;
return;
std::string message = "Error Reading ";
message += m_DSPHeaderTemplate;
Die(message.c_str());
}
char buffer[2048];
while(fin)
@ -245,9 +246,9 @@ void cmDSPMakefile::WriteDSPFooter(std::ostream& fout)
std::ifstream fin(m_DSPFooterTemplate.c_str());
if(!fin)
{
std::cerr << "can not open " << m_DSPFooterTemplate.c_str() <<
" for read" << std::endl;
return;
std::string message = "Error Reading ";
message += m_DSPFooterTemplate;
Die(message.c_str());
}
char buffer[2048];
while(fin)

View File

@ -62,7 +62,7 @@ void cmDSWMakefile::WriteDSWFile(std::ostream& fout)
std::cerr << "Create dsp for " << (*si).c_str() << std::endl;
if(dspname == "")
{
std::cerr << "Project name not found in " << dir << "/Makefile.in" << std::endl;
std::cerr << "Project name not found in " << dir << "/CMakeLists.txt" << std::endl;
std::cerr << "Skipping Project " << std::endl;
}
else
@ -91,7 +91,7 @@ std::vector<std::string> cmDSWMakefile::CreateDSPFile(const char* subdir)
outdir += subdir;
dsp.SetOutputDirectory(outdir.c_str());
currentDir += "/";
currentDir += "Makefile.in";
currentDir += "CMakeLists.txt";
dsp.SetInputMakefilePath(currentDir.c_str());
dsp.CreateDSPFile();
return dsp.GetCreatedProjectNames();

View File

@ -62,7 +62,7 @@ void cmDSWMakefile::WriteDSWFile(std::ostream& fout)
std::cerr << "Create dsp for " << (*si).c_str() << std::endl;
if(dspname == "")
{
std::cerr << "Project name not found in " << dir << "/Makefile.in" << std::endl;
std::cerr << "Project name not found in " << dir << "/CMakeLists.txt" << std::endl;
std::cerr << "Skipping Project " << std::endl;
}
else
@ -91,7 +91,7 @@ std::vector<std::string> cmDSWMakefile::CreateDSPFile(const char* subdir)
outdir += subdir;
dsp.SetOutputDirectory(outdir.c_str());
currentDir += "/";
currentDir += "Makefile.in";
currentDir += "CMakeLists.txt";
dsp.SetInputMakefilePath(currentDir.c_str());
dsp.CreateDSPFile();
return dsp.GetCreatedProjectNames();

View File

@ -3,13 +3,14 @@
#endif
#include "cmMakefile.h"
#include "cmClassFile.h"
#include "cmDirectory.h"
#include <fstream>
#include <iostream>
// remove extra spaces and the "\" character from the name
// of the class as it is in the Makefile.in
// of the class as it is in the CMakeLists.txt
inline std::string CleanUpName(const char* name)
{
std::string className = name;
@ -50,7 +51,7 @@ void cmMakefile::Print()
m_Classes[i].Print();
}
// Parse the given Makefile.in file into a list of classes.
// Parse the given CMakeLists.txt file into a list of classes.
bool cmMakefile::ReadMakefile(const char* filename)
{
@ -97,6 +98,10 @@ bool cmMakefile::ReadMakefile(const char* filename)
this->ReadClasses(fin, true);
}
}
else if(line.find("TEMPLATE_INSTANCE_DIRECTORY") != std::string::npos)
{
this->ReadTemplateInstanceDirectory(line);
}
else if(line.find("SUBDIRS") != std::string::npos)
{
if(line.find("\\") != std::string::npos)
@ -112,6 +117,23 @@ bool cmMakefile::ReadMakefile(const char* filename)
m_Executables = true;
}
}
else if(line.find("BEGIN MAKE VERBATIM") != std::string::npos)
{
char inbuffer[2048];
bool done = false;
m_MakeVerbatim.push_back("# Begin CMakeLists Verbatim\n");
while(!done)
{
fin.getline(inbuffer, 2047);
m_MakeVerbatim.push_back(inbuffer);
if((m_MakeVerbatim.end()-1)->find("END MAKE VERBATIM")
!= std::string::npos )
{
done = true;
*(m_MakeVerbatim.end()-1) = "# End CMakeLists VERBATIM\n\n";
}
}
}
else if(line.find("ME") != std::string::npos)
{
size_t mestart = line.find("ME");
@ -183,6 +205,52 @@ void cmMakefile::ReadClasses(std::ifstream& fin,
}
void cmMakefile::ReadTemplateInstanceDirectory(std::string& line)
{
std::string::size_type start = line.find("=");
if(start != std::string::npos)
{
std::string dirname = line.substr(start+1, line.size());
dirname = CleanUpName(dirname.c_str());
std::string tdir = this->GetCurrentDirectory();
tdir += "/";
tdir += dirname;
// Load all the files in the directory
cmDirectory dir;
if(dir.Load(tdir.c_str()))
{
int numfiles = dir.GetNumberOfFiles();
for(int i =0; i < numfiles; ++i)
{
std::string file = dir.GetFile(i);
// ignore files less than f.cxx in length
if(file.size() > 4)
{
// Remove the extension
std::string::size_type dotpos = file.rfind(".");
file = file.substr(0, dotpos);
std::string fullname = dirname;
fullname += "/";
fullname += file;
// add the file as a class file so
// depends can be done
cmClassFile cmfile;
cmfile.SetName(fullname.c_str(), this->GetCurrentDirectory());
cmfile.m_AbstractClass = false;
m_Classes.push_back(cmfile);
}
}
}
else
{
std::cerr << "Error can not open template instance directory "
<< dirname.c_str() << std::endl;
}
}
}
// Read a list of subdirectories from the stream
void cmMakefile::ReadSubdirs(std::ifstream& fin)
{
@ -206,3 +274,4 @@ void cmMakefile::ReadSubdirs(std::ifstream& fin)
m_SubDirectories.push_back(dir);
}
}

View File

@ -84,6 +84,7 @@ public:
}
private:
void ReadTemplateInstanceDirectory(std::string&);
void ReadSubdirs(std::ifstream& fin);
void ReadClasses(std::ifstream& fin, bool t);
friend class cmMakeDepend; // make depend needs direct access
@ -98,6 +99,7 @@ protected:
std::string m_LibraryName; // library name
std::vector<cmClassFile> m_Classes; // list of classes in makefile
std::vector<std::string> m_SubDirectories; // list of sub directories
std::vector<std::string> m_MakeVerbatim; // list of sub directories
};

View File

@ -82,6 +82,13 @@ void cmUnixMakefile::OutputMakefile(const char* file)
}
fout << "\n";
}
fout << "ME = " << this->GetLibraryName() << "\n\n";
for(int i =0; i < m_MakeVerbatim.size(); i++)
{
fout << m_MakeVerbatim[i] << "\n";
}
fout << "\n\n";
if( m_Executables )
{
for(int i = 0; i < m_Classes.size(); i++)
@ -91,10 +98,19 @@ void cmUnixMakefile::OutputMakefile(const char* file)
std::string DotO = m_Classes[i].m_ClassName;
DotO += ".o";
fout << m_Classes[i].m_ClassName << ": " << DotO << "\n";
fout << "\t ${CXX} ${CXX_FLAGS} " << DotO.c_str() << " -o $@ -L${ITK_OBJ}/Code/Common -lITKCommon \\\n"
<< "\t-L${ITK_OBJ}/Code/Insight3DParty/vxl -lITKNumerics -lm ${DL_LIBS}\n\n";
fout << "\t ${CXX} ${CXX_FLAGS} " << DotO.c_str() << " -o $@ -L${CMAKE_OBJ_DIR}/Code/Common -lITKCommon \\\n"
<< "\t-L${CMAKE_OBJ_DIR}/Code/Insight3DParty/vxl -lITKNumerics -lm ${DL_LIBS}\n\n";
}
}
fout << "EXECUTABLES = \\\n";
for(int i = 0; i < m_Classes.size(); i++)
{
if(!m_Classes[i].m_AbstractClass && !m_Classes[i].m_HeaderFileOnly)
{
fout << m_Classes[i].m_ClassName << " \\\n";
}
}
fout << "\n";
}
if( m_SubDirectories.size() )
@ -135,9 +151,7 @@ void cmUnixMakefile::OutputMakefile(const char* file)
for(i =0; i < m_SubDirectories.size(); i++)
{
std::string subdir = FixDirectoryName(m_SubDirectories[i].c_str());
fout << "build_" << subdir.c_str() << ": targets.make\n";
fout << "\tcd " << m_SubDirectories[i].c_str()
<< "; ${MAKE} -${MAKEFLAGS} targets.make\n";
fout << "build_" << subdir.c_str() << ":\n";
fout << "\tcd " << m_SubDirectories[i].c_str()
<< "; ${MAKE} -${MAKEFLAGS} all\n\n";