Commit 88bbc0c3 authored by Will Schroeder's avatar Will Schroeder
Browse files

ENH:Documentation and cleanups

parent 336f3e80
......@@ -54,11 +54,11 @@ int main(int ac, char** av)
cmMSProjectGenerator* pg = new cmMSProjectGenerator;
if(arg.find("-DSP", 0) != std::string::npos)
{
pg->SetBuildDSP();
pg->BuildDSPOff();
}
else
{
pg->SetBuildDSW();
pg->BuildDSWOn();
}
builder.SetMakefileGenerator(pg);
builder.ReadMakefile(av[1]);
......
/*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile$
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 2000 National Library of Medicine
All rights reserved.
See COPYRIGHT.txt for copyright details.
=========================================================================*/
#include "cmAddTargetRule.h"
// cmAddTargetRule
......
/*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile$
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 2000 National Library of Medicine
All rights reserved.
See COPYRIGHT.txt for copyright details.
=========================================================================*/
#include "cmAuxSourceDirectoryRule.h"
#include "cmDirectory.h"
......
......@@ -13,39 +13,66 @@
See COPYRIGHT.txt for copyright details.
=========================================================================*/
/**
* cmClassFile a structure that represents a class loaded from
* a makefile.
*/
#ifndef cmClassFile_h
#define cmClassFile_h
#include "cmStandardIncludes.h"
#include "cmStandardIncludes.h"
struct cmClassFile
/** \class cmClassFile
* \brief Represent a class loaded from a makefile.
*
* cmClassFile is represents a class loaded from
* a makefile.
*/
class cmClassFile
{
public:
/**
* Construct instance as a concrete class with both a
* .h and .cxx file.
*/
cmClassFile()
{
m_AbstractClass = false;
m_HeaderFileOnly = false;
m_AbstractClass = false;
m_HeaderFileOnly = false;
}
/**
* Set the name of the file, given the directory
* the file should be in. Extensions are tried on
* the name in the directory to find the actual file.
* the file should be in. Various extensions are tried on
* the name (e.g., .cxx, .cpp) in the directory to find the actual file.
*/
void SetName(const char* name, const char* dir);
/**
* print the structure to cout
* Print the structure to std::cout.
*/
void Print();
bool m_AbstractClass; // is this an abstract class
bool m_HeaderFileOnly; // is this file only a header file
std::string m_FullPath; // full path to the file
std::string m_ClassName; // class name
// list of files that this file depends on
/**
* Indicate whether the class is abstract (non-instantiable).
*/
bool m_AbstractClass;
/**
* Indicate whether this class is defined with only the header file.
*/
bool m_HeaderFileOnly;
/**
* The full path to the file.
*/
std::string m_FullPath;
/**
* The file name associated with stripped off directory and extension.
* (In most cases this is the name of the class.)
*/
std::string m_ClassName;
/**
* The dependencies of this class are gathered here.
*/
std::vector<std::string> m_Depends;
};
......
......@@ -70,7 +70,7 @@ cmDSWMakefile
{
// Create a new cmDSPMakefile to read the currentDir CMakeLists.txt file
cmMSProjectGenerator* pg = new cmMSProjectGenerator;
pg->SetBuildDSP();
pg->BuildDSPOff();
cmMakefile* mf = new cmMakefile;
mf->SetMakefileGenerator(pg);
// add it to the vector
......
......@@ -13,22 +13,33 @@
See COPYRIGHT.txt for copyright details.
=========================================================================*/
/**
* cmDSWMakefile - class to write a microsoft DSW file.
*/
#ifndef cmDSWMakefile_h
#define cmDSWMakefile_h
#include "cmStandardIncludes.h"
#include "cmMakefile.h"
class cmDSPMakefile;
class cmMSProjectGenerator;
/** \class cmDSWMakefile
* \brief Write a Microsoft Visual C++ DSW (workspace) file.
*
* cmDSWMakefile produces a Microsoft Visual C++ DSW (workspace) file.
*/
class cmDSWMakefile
{
public:
/**
* Constructor.
*/
cmDSWMakefile(cmMakefile*);
/**
* Generate the DSW workspace file.
*/
virtual void OutputDSWFile();
private:
void FindAllCMakeListsFiles(const char* subdir,
std::vector<cmMSProjectGenerator*>&);
......
......@@ -70,7 +70,7 @@ cmDSWMakefile
{
// Create a new cmDSPMakefile to read the currentDir CMakeLists.txt file
cmMSProjectGenerator* pg = new cmMSProjectGenerator;
pg->SetBuildDSP();
pg->BuildDSPOff();
cmMakefile* mf = new cmMakefile;
mf->SetMakefileGenerator(pg);
// add it to the vector
......
......@@ -13,22 +13,33 @@
See COPYRIGHT.txt for copyright details.
=========================================================================*/
/**
* cmDSWMakefile - class to write a microsoft DSW file.
*/
#ifndef cmDSWMakefile_h
#define cmDSWMakefile_h
#include "cmStandardIncludes.h"
#include "cmMakefile.h"
class cmDSPMakefile;
class cmMSProjectGenerator;
/** \class cmDSWMakefile
* \brief Write a Microsoft Visual C++ DSW (workspace) file.
*
* cmDSWMakefile produces a Microsoft Visual C++ DSW (workspace) file.
*/
class cmDSWMakefile
{
public:
/**
* Constructor.
*/
cmDSWMakefile(cmMakefile*);
/**
* Generate the DSW workspace file.
*/
virtual void OutputDSWFile();
private:
void FindAllCMakeListsFiles(const char* subdir,
std::vector<cmMSProjectGenerator*>&);
......
......@@ -18,20 +18,19 @@
#include "cmStandardIncludes.h"
#include "cmSystemTools.h"
/** \class cmDirectory
* \brief Portable directory/filename traversal.
*
* cmDirectory provides a portable way of finding the names of the files
* in a system directory.
*
* cmDirectory works with windows and unix only.
* cmDirectory currently works with Windows and Unix operating systems.
*/
class cmDirectory
{
public:
/**
* Load the specified directory and load the names of the files
* in that directory. 0 is returned if the directory can not be
......@@ -52,7 +51,7 @@ public:
private:
std::vector<std::string> m_Files; // Array of Files
std::string m_Path; // Path to Open'ed directory
}; // End Class: cmDirectory
}; // End Class: cmDirectory
#endif
......@@ -24,7 +24,8 @@
*
* cmFindProgramRule is used to define a CMake variable
* that specifies an executable program. The rule searches
* for a given file in a list of directories.
* in the current path (e.g., PATH environment variable) for
* an executable that matches one of the supplied names.
*/
class cmFindProgramRule : public cmRuleMaker
{
......@@ -74,7 +75,7 @@ public:
virtual const char* FullDocumentation()
{
return
"FIND_PROGRAM(NAME try1 try2 ...)";
"FIND_PROGRAM(NAME executable1 executable2 ...)";
}
};
......
......@@ -6,7 +6,7 @@ cmMSProjectGenerator::cmMSProjectGenerator()
{
m_DSWMakefile = 0;
m_DSPMakefile = 0;
SetBuildDSW();
BuildDSWOn();
}
void cmMSProjectGenerator::GenerateMakefile()
......
......@@ -13,28 +13,62 @@
See COPYRIGHT.txt for copyright details.
=========================================================================*/
/**
* cmMSProjectGenerator - class to write a microsoft DSW file.
*/
#ifndef cmMSProjectGenerator_h
#define cmMSProjectGenerator_h
#include "cmStandardIncludes.h"
#include "cmMakefileGenerator.h"
class cmDSPMakefile;
class cmDSWMakefile;
/** \class cmMSProjectGenerator
* \brief Write a Microsoft Visual C++ DSP (project) file.
*
* cmMSProjectGenerator produces a Microsoft Visual C++ DSP (project) file.
*/
class cmMSProjectGenerator : public cmMakefileGenerator
{
public:
/**
* Constructor sets the generation of DSW files on.
*/
cmMSProjectGenerator();
/**
* Destructor.
*/
~cmMSProjectGenerator();
/**
* Produce the makefile (in this case a Microsoft Visual C++ project).
*/
virtual void GenerateMakefile();
void SetBuildDSP() { m_BuildDSW = false;}
void SetBuildDSW() { m_BuildDSW = true;}
cmDSWMakefile* GetDSWMakefile() { return m_DSWMakefile;}
cmDSPMakefile* GetDSPMakefile() { return m_DSPMakefile;}
/**
* Turn off the generation of a Microsoft Visual C++ DSP file.
*/
void BuildDSPOff()
{m_BuildDSW = false;}
/**
* Turn on the generation of a Microsoft Visual C++ DSW file.
*/
void BuildDSWOn()
{m_BuildDSW = true;}
/**
* Retrieve a pointer to a cmDSWMakefile instance.
*/
cmDSWMakefile* GetDSWMakefile()
{return m_DSWMakefile;}
/**
* Retrieve a pointer to a cmDSPMakefile instance.
*/
cmDSPMakefile* GetDSPMakefile()
{return m_DSPMakefile;}
private:
cmDSWMakefile* m_DSWMakefile;
cmDSPMakefile* m_DSPMakefile;
......
......@@ -13,9 +13,6 @@
See COPYRIGHT.txt for copyright details.
=========================================================================*/
/**
* cmMakeDepend
*/
#ifndef cmMakeDepend_h
#define cmMakeDepend_h
......@@ -24,39 +21,59 @@
#include "cmRegularExpression.h"
#include "cmStandardIncludes.h"
// This structure stores the depend information
// for a single source file
/** \class cmDependInformation
* \brief Store dependency information for a single source file.
*
* This structure stores the depend information for a single source file.
*/
struct cmDependInformation
{
/**
* Construct with dependency generation marked not done; instance
* not placed in cmMakefile's list.
*/
cmDependInformation()
{
m_DependDone = false;
m_ClassFileIndex = -1;
m_DependDone = false;
m_ClassFileIndex = -1;
}
// index into m_DependInformation array of cmMakeDepend
// class, represents the files that this file depends on
/**
* A list of indices into the m_DependInformation array of cmMakeDepend.
* The index represents the files that this file depends on.
*/
std::vector<int> m_Indices;
// full path to file
/**
* Full path to this file.
*/
std::string m_FullPath;
// name as include directive uses
/**
* Name that the include directive uses.
*/
std::string m_IncludeName;
// refers back to the index of the cmMakefile's array
// of cmClassFile objects which this class class describes,
// -1 for files not in the array
/**
* The index into the cmMakefile::m_Classes list.
* The index value of -1 indicates that it is not in the list.
*/
int m_ClassFileIndex;
// flag to determine if depends have
// been done for this file
/**
* This flag indicates whether dependency checking has been
* performed for this file.
*/
bool m_DependDone;
// function to add the depends of another file to this one
/**
* This method adds the dependencies of another file to this one.
*/
void MergeInfo(cmDependInformation*);
// remove duplicate depends from the index list
/**
* This method removes duplicate depends from the index list.
*/
void RemoveDuplicateIndices();
};
......@@ -66,43 +83,60 @@ struct cmDependInformation
class cmMakeDepend
{
public:
/**
* Construct the object with verbose turned off.
*/
cmMakeDepend();
/**
* Destructor.
*/
~cmMakeDepend();
/**
* Set the makefile that is used as a source of classes.
*/
void SetMakefile(cmMakefile* makefile);
/**
* Generate the depend information
*/
void DoDepends();
/**
* Set a regular expression that include files must match
* in order to be considered as part of the depend information
* in order to be considered as part of the depend information.
*/
void SetIncludeRegularExpression(const char* regex);
/**
* Add a directory to the search path for include files
* Add a directory to the search path for include files.
*/
void AddSearchPath(const char*);
private:
/**
* Add a source file to the search path.
*/
void AddFileToSearchPath(const char* filepath);
/**
* Find the index into the m_DependInformation array
* that matches the given m_IncludeName
* that matches the given m_IncludeName.
*/
int FindInformation(const char* includeName);
/**
* Compute the depend information for this class
* Compute the depend information for this class.
*/
void Depend(cmDependInformation* info);
/**
* Find the full path name for the given file name.
* This uses the include directories
* This uses the include directories.
*/
std::string FullPath(const char*);
private:
cmMakefile* m_Makefile;
bool m_Verbose;
cmRegularExpression m_IncludeFileRegularExpression;
......
......@@ -13,162 +13,293 @@
See COPYRIGHT.txt for copyright details.
=========================================================================*/
/**
* cmMakefile - used to parse and store the contents of a
* CMakeLists.txt makefile in memory.
*/
#ifndef cmMakefile_h
#define cmMakefile_h
#include "cmStandardIncludes.h"
#include "cmClassFile.h"
#include "cmSystemTools.h"
class cmRuleMaker;
class cmMakefileGenerator;
/** \class cmMakefile
* \brief Process the input CMakeLists.txt file.
*
* Process and store into memory the input CMakeLists.txt file.
* Each CMakeLists.txt file is parsed and the rules found there
* are added into the build process.
*/
class cmMakefile
{
public:
/**
* Construct an empty makefile.
*/
cmMakefile();
/**
* Destructor.
*/
~cmMakefile();
// Parse a CMakeLists.txt file
/**
* Read and parse a CMakeLists.txt file.
*/
bool ReadMakefile(const char* makefile, bool inheriting = false);
// Add a wrap generator
/**
* Add a wrapper generator.
*/
void AddRuleMaker(cmRuleMaker* );
// Set the make file
/**
* Specify the makefile generator. This is platform/compiler
* dependent, although the interface is through a generic
* superclass.
*/
void SetMakefileGenerator(cmMakefileGenerator*);
// Generate the output file
/**
* Produce the output makefile.
*/
void GenerateMakefile();
// Print useful stuff to stdout
/**
* Print the object state to std::cout.
*/
void Print();
// cmRuleMaker interfaces
/**
* Add a custom rule to the build.
*/
void AddCustomRule(const char* source,
const char* result,
const char* command,
std::vector<std::string>& depends);
/**
* Add a define flag to the build.
*/
void AddDefineFlag(const char* definition);
/**
* Add an executable to the build.
*/
void AddExecutable(cmClassFile&);
/**
* Add a link library to the build.
*/
void AddLinkLibrary(const char*);
/**
* Add a link directory to the build.
*/
void AddLinkDirectory(const char*);
/**
* Add a subdirectory to the build.
*/
void AddSubDirectory(const char*);
/**
* Add an include directory to the build.
*/
void AddIncludeDirectory(const char*);
/**
* Add a variable definition to the build. This variable
* can be used in CMake to refer to lists, directories, etc.
*/
void AddDefinition(const char* name, const char* value);
/**
* Specify the name of the project for this build.
*/
void SetProjectName(const char*);
/**
* Get the name of the project for this build.