Commit c54a05bf authored by Bill Hoffman's avatar Bill Hoffman

ENH: rework cmake, added ruleMaker classes and changed the syntax of the CMakeLists.txt files.

parent d888b5e3
#include "cmUnixMakefile.h"
#include "cmMakefile.h"
#include "cmStandardIncludes.h"
#include "cmMakeDepend.h"
#include <iostream>
#include "cmUnixMakefileGenerator.h"
// This is the main program used to gentrate makefile fragments
// from CMakeLists.txt input files.
......@@ -12,10 +12,9 @@ main(int ac, char** av)
std::cerr << "Usage: " << av[0] << " Makefile.in -Ipath ..." << std::endl;
return -1;
}
// Create a unix makefile
cmUnixMakefile mf;
// Create a depends object
cmMakeDepend md;
// Create a makefile
cmMakefile mf;
mf.AddDefinition("UNIX", "1");
// Parse the command line
if(ac > 2)
{
......@@ -42,16 +41,12 @@ main(int ac, char** av)
}
}
}
mf.SetMakefileGenerator(new cmUnixMakefileGenerator);
// Read and parse the input makefile
if(!mf.ReadMakefile(av[1]))
{
std::cerr << "Usage: " << av[0] << " Makefile.in -Ipath ..." << std::endl;
return -1;
}
// Set the makefile object on the depend object
md.SetMakefile(&mf);
// compute the depend information
md.DoDepends();
// Ouput the result
mf.OutputMakefile("CMakeTargets.make");
mf.GenerateMakefile();
}
#include "cmDSWMakefile.h"
#include "cmDSPMakefile.h"
#include <iostream>
#include "cmStandardIncludes.h"
#include "cmMakefile.h"
#include "cmMSProjectGenerator.h"
// this is the command line version of CMakeSetup.
// It is called from Visual Studio when a CMakeLists.txt
......@@ -21,7 +22,6 @@ void SetArgs(cmMakefile& builder, int ac, char** av)
if(arg.find("-D",0) != std::string::npos)
{
std::string path = arg.substr(2);
std::cerr << "set makefile dir " << path.c_str() << std::endl;
builder.SetCurrentDirectory(path.c_str());
}
if(arg.find("-O",0) != std::string::npos)
......@@ -44,24 +44,25 @@ main(int ac, char** av)
if(ac < 3)
{
std::cerr << "Usage: " << av[0] <<
" Makefile.in -[DSP|DSW] -Hinsighthome -Dcurrentdir -Ooutput directory" << std::endl;
" CMakeLists.txt -[DSP|DSW] -Hinsighthome -Dcurrentdir"
" -Ooutput directory" << std::endl;
return -1;
}
std::string arg = av[2];
cmMakefile builder;
SetArgs(builder, ac, av);
cmMSProjectGenerator* pg = new cmMSProjectGenerator;
if(arg.find("-DSP", 0) != std::string::npos)
{
cmDSPMakefile builder;
SetArgs(builder, ac, av);
builder.ReadMakefile(av[1]);
builder.OutputDSPFile();
pg->SetBuildDSP();
}
else
{
cmDSWMakefile builder;
SetArgs(builder, ac, av);
builder.ReadMakefile(av[1]);
builder.OutputDSWFile();
pg->SetBuildDSW();
}
builder.SetMakefileGenerator(pg);
builder.ReadMakefile(av[1]);
builder.GenerateMakefile();
return 0;
}
......@@ -91,15 +91,23 @@ LINK32=link.exe
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\cmAbstractFilesRule.cxx
# End Source File
# Begin Source File
SOURCE=.\cmAddTargetRule.cxx
# End Source File
# Begin Source File
SOURCE=.\CMakeSetupCMD.cxx
# End Source File
# Begin Source File
SOURCE=.\cmClassFile.cxx
SOURCE=.\cmAuxSourceDirectoryRule.cxx
# End Source File
# Begin Source File
SOURCE=.\cmCollectFlags.cxx
SOURCE=.\cmClassFile.cxx
# End Source File
# Begin Source File
......@@ -115,6 +123,38 @@ SOURCE=.\cmDSWMakefile.cxx
# End Source File
# Begin Source File
SOURCE=.\cmExecutablesRule.cxx
# End Source File
# Begin Source File
SOURCE=.\cmFindIncludeRule.cxx
# End Source File
# Begin Source File
SOURCE=.\cmFindLibraryRule.cxx
# End Source File
# Begin Source File
SOURCE=.\cmFindProgramRule.cxx
# End Source File
# Begin Source File
SOURCE=.\cmIncludeDirectoryRule.cxx
# End Source File
# Begin Source File
SOURCE=.\cmLibraryRule.cxx
# End Source File
# Begin Source File
SOURCE=.\cmLinkDirectoriesRule.cxx
# End Source File
# Begin Source File
SOURCE=.\cmLinkLibrariesRule.cxx
# End Source File
# Begin Source File
SOURCE=.\cmMakeDepend.cxx
# End Source File
# Begin Source File
......@@ -123,16 +163,196 @@ SOURCE=.\cmMakefile.cxx
# End Source File
# Begin Source File
SOURCE=.\cmMakefileGenerator.cxx
# End Source File
# Begin Source File
SOURCE=.\cmMSProjectGenerator.cxx
# End Source File
# Begin Source File
SOURCE=.\cmProjectRule.cxx
# End Source File
# Begin Source File
SOURCE=.\cmRegularExpression.cxx
# End Source File
# Begin Source File
SOURCE=.\cmSourceFilesRequireRule.cxx
# End Source File
# Begin Source File
SOURCE=.\cmSourceFilesRule.cxx
# End Source File
# Begin Source File
SOURCE=.\cmSubdirRule.cxx
# End Source File
# Begin Source File
SOURCE=.\cmSystemTools.cxx
# End Source File
# Begin Source File
SOURCE=.\cmTestsRule.cxx
# End Source File
# Begin Source File
SOURCE=.\cmUnixDefinesRule.cxx
# End Source File
# Begin Source File
SOURCE=.\cmUnixLibrariesRule.cxx
# End Source File
# Begin Source File
SOURCE=.\cmWin32DefinesRule.cxx
# End Source File
# Begin Source File
SOURCE=.\cmWin32LibrariesRule.cxx
# End Source File
# Begin Source File
SOURCE=.\cmWindowsConfigure.cxx
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\cmAbstractFilesRule.h
# End Source File
# Begin Source File
SOURCE=.\cmAddTargetRule.h
# End Source File
# Begin Source File
SOURCE=.\cmAuxSourceDirectoryRule.h
# End Source File
# Begin Source File
SOURCE=.\cmClassFile.h
# End Source File
# Begin Source File
SOURCE=.\cmDirectory.h
# End Source File
# Begin Source File
SOURCE=.\cmDSPMakefile.h
# End Source File
# Begin Source File
SOURCE=.\cmDSWMakefile.h
# End Source File
# Begin Source File
SOURCE=.\cmExecutablesRule.h
# End Source File
# Begin Source File
SOURCE=.\cmFindIncludeRule.h
# End Source File
# Begin Source File
SOURCE=.\cmFindLibraryRule.h
# End Source File
# Begin Source File
SOURCE=.\cmFindProgramRule.h
# End Source File
# Begin Source File
SOURCE=.\cmIncludeDirectoryRule.h
# End Source File
# Begin Source File
SOURCE=.\cmLibraryRule.h
# End Source File
# Begin Source File
SOURCE=.\cmLinkDirectoriesRule.h
# End Source File
# Begin Source File
SOURCE=.\cmLinkLibrariesRule.h
# End Source File
# Begin Source File
SOURCE=.\cmMakeDepend.h
# End Source File
# Begin Source File
SOURCE=.\cmMakefile.h
# End Source File
# Begin Source File
SOURCE=.\cmMakefile2.h
# End Source File
# Begin Source File
SOURCE=.\cmMakefileGenerator.h
# End Source File
# Begin Source File
SOURCE=.\cmMSProjectGenerator.h
# End Source File
# Begin Source File
SOURCE=.\cmProjectRule.h
# End Source File
# Begin Source File
SOURCE=.\cmRegularExpression.h
# End Source File
# Begin Source File
SOURCE=.\cmRuleMaker.h
# End Source File
# Begin Source File
SOURCE=.\cmSourceFilesRule.h
# End Source File
# Begin Source File
SOURCE=.\cmStandardIncludes.h
# End Source File
# Begin Source File
SOURCE=.\cmSubdirRule.h
# End Source File
# Begin Source File
SOURCE=.\cmSystemTools.h
# End Source File
# Begin Source File
SOURCE=.\cmTestsRule.h
# End Source File
# Begin Source File
SOURCE=.\cmUnixDefinesRule.h
# End Source File
# Begin Source File
SOURCE=.\cmUnixLibrariesRule.h
# End Source File
# Begin Source File
SOURCE=.\cmWin32DefinesRule.h
# End Source File
# Begin Source File
SOURCE=.\cmWin32LibrariesRule.h
# End Source File
# Begin Source File
SOURCE=.\cmWindowsConfigure.h
# End Source File
# End Group
# Begin Group "Resource Files"
......
......@@ -92,6 +92,14 @@ LINK32=link.exe
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\cmAbstractFilesRule.cxx
# End Source File
# Begin Source File
SOURCE=..\cmAddTargetRule.cxx
# End Source File
# Begin Source File
SOURCE=.\CMakeSetup.cpp
# End Source File
# Begin Source File
......@@ -100,15 +108,19 @@ SOURCE=.\CMakeSetup.rc
# End Source File
# Begin Source File
SOURCE=..\CMakeSetupCMD.cxx
# End Source File
# Begin Source File
SOURCE=.\CMakeSetupDialog.cpp
# End Source File
# Begin Source File
SOURCE=..\cmClassFile.cxx
SOURCE=..\cmAuxSourceDirectoryRule.cxx
# End Source File
# Begin Source File
SOURCE=..\cmCollectFlags.cxx
SOURCE=..\cmClassFile.cxx
# End Source File
# Begin Source File
......@@ -124,6 +136,38 @@ SOURCE=..\cmDSWMakefile.cxx
# End Source File
# Begin Source File
SOURCE=..\cmExecutablesRule.cxx
# End Source File
# Begin Source File
SOURCE=..\cmFindIncludeRule.cxx
# End Source File
# Begin Source File
SOURCE=..\cmFindLibraryRule.cxx
# End Source File
# Begin Source File
SOURCE=..\cmFindProgramRule.cxx
# End Source File
# Begin Source File
SOURCE=..\cmIncludeDirectoryRule.cxx
# End Source File
# Begin Source File
SOURCE=..\cmLibraryRule.cxx
# End Source File
# Begin Source File
SOURCE=..\cmLinkDirectoriesRule.cxx
# End Source File
# Begin Source File
SOURCE=..\cmLinkLibrariesRule.cxx
# End Source File
# Begin Source File
SOURCE=..\cmMakeDepend.cxx
# End Source File
# Begin Source File
......@@ -132,14 +176,58 @@ SOURCE=..\cmMakefile.cxx
# End Source File
# Begin Source File
SOURCE=..\cmMakefileGenerator.cxx
# End Source File
# Begin Source File
SOURCE=..\cmMSProjectGenerator.cxx
# End Source File
# Begin Source File
SOURCE=..\cmProjectRule.cxx
# End Source File
# Begin Source File
SOURCE=..\cmRegularExpression.cxx
# End Source File
# Begin Source File
SOURCE=..\cmSourceFilesRequireRule.cxx
# End Source File
# Begin Source File
SOURCE=..\cmSourceFilesRule.cxx
# End Source File
# Begin Source File
SOURCE=..\cmSubdirRule.cxx
# End Source File
# Begin Source File
SOURCE=..\cmSystemTools.cxx
# End Source File
# Begin Source File
SOURCE=..\cmTestsRule.cxx
# End Source File
# Begin Source File
SOURCE=..\cmUnixDefinesRule.cxx
# End Source File
# Begin Source File
SOURCE=..\cmUnixLibrariesRule.cxx
# End Source File
# Begin Source File
SOURCE=..\cmWin32DefinesRule.cxx
# End Source File
# Begin Source File
SOURCE=..\cmWin32LibrariesRule.cxx
# End Source File
# Begin Source File
SOURCE=..\cmWindowsConfigure.cxx
# End Source File
# Begin Source File
......@@ -153,6 +241,14 @@ SOURCE=.\StdAfx.cpp
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\cmAbstractFilesRule.h
# End Source File
# Begin Source File
SOURCE=..\cmAddTargetRule.h
# End Source File
# Begin Source File
SOURCE=..\CMakeSetup.h
# End Source File
# Begin Source File
......@@ -165,10 +261,18 @@ SOURCE=.\CMakeSetupDialog.h
# End Source File
# Begin Source File
SOURCE=..\cmAuxSourceDirectoryRule.h
# End Source File
# Begin Source File
SOURCE=..\cmClassFile.h
# End Source File
# Begin Source File
SOURCE=..\cmDirectory.h
# End Source File
# Begin Source File
SOURCE=..\cmDSPBuilder.h
# End Source File
# Begin Source File
......@@ -185,6 +289,38 @@ SOURCE=..\cmDSWMakefile.h
# End Source File
# Begin Source File
SOURCE=..\cmExecutablesRule.h
# End Source File
# Begin Source File
SOURCE=..\cmFindIncludeRule.h
# End Source File
# Begin Source File
SOURCE=..\cmFindLibraryRule.h
# End Source File
# Begin Source File
SOURCE=..\cmFindProgramRule.h
# End Source File
# Begin Source File
SOURCE=..\cmIncludeDirectoryRule.h
# End Source File
# Begin Source File
SOURCE=..\cmLibraryRule.h
# End Source File
# Begin Source File
SOURCE=..\cmLinkDirectoriesRule.h
# End Source File
# Begin Source File
SOURCE=..\cmLinkLibrariesRule.h
# End Source File
# Begin Source File
SOURCE=..\cmMakeDepend.h
# End Source File
# Begin Source File
......@@ -193,10 +329,74 @@ SOURCE=..\cmMakefile.h
# End Source File
# Begin Source File
SOURCE=..\cmMakefile2.h
# End Source File
# Begin Source File
SOURCE=..\cmMakefileGenerator.h
# End Source File
# Begin Source File
SOURCE=..\cmMSProjectGenerator.h
# End Source File
# Begin Source File
SOURCE=..\cmProjectRule.h
# End Source File
# Begin Source File
SOURCE=..\cmRegularExpression.h
# End Source File
# Begin Source File
SOURCE=..\cmRuleMaker.h
# End Source File
# Begin Source File
SOURCE=..\cmSourceFilesRequireRule.h
# End Source File
# Begin Source File
SOURCE=..\cmSourceFilesRule.h
# End Source File
# Begin Source File
SOURCE=..\cmStandardIncludes.h
# End Source File
# Begin Source File
SOURCE=..\cmSubdirRule.h
# End Source File
# Begin Source File
SOURCE=..\cmSystemTools.h
# End Source File
# Begin Source File
SOURCE=..\cmTestsRule.h
# End Source File
# Begin Source File
SOURCE=..\cmUnixDefinesRule.h
# End Source File
# Begin Source File
SOURCE=..\cmUnixLibrariesRule.h
# End Source File
# Begin Source File
SOURCE=..\cmWin32DefinesRule.h
# End Source File
# Begin Source File
SOURCE=..\cmWin32LibrariesRule.h
# End Source File
# Begin Source File
SOURCE=..\cmWindowsConfigure.h
# End Source File
# Begin Source File
SOURCE=.\Resource.h
# End Source File
# Begin Source File
......
......@@ -6,7 +6,7 @@
#include "CMakeSetupDialog.h"
#include "../cmDSWMakefile.h"
#include "../cmWindowsConfigure.h"
#include "../cmMSProjectGenerator.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
......@@ -269,19 +269,21 @@ void CMakeSetupDialog::OnOK()
}
cmDSWMakefile builder;
// Set the ITK home directory
builder.SetHomeDirectory(m_WhereSource);
// Set the CMakeLists.txt file
CString makefileIn = m_WhereSource;
makefileIn += "/CMakeLists.txt";
builder.ReadMakefile(makefileIn);
cmMakefile mf;
mf.SetMakefileGenerator(new cmMSProjectGenerator);
mf.SetHomeDirectory(m_WhereSource);
// Set the output directory
builder.SetOutputDirectory(m_WhereBuild);
mf.SetOutputDirectory(m_WhereBuild);
// set the directory which contains the CMakeLists.txt
builder.SetCurrentDirectory(m_WhereSource);
mf.SetCurrentDirectory(m_WhereSource);
// Create the master DSW file and all children dsp files for ITK
builder.OutputDSWFile();
// Set the CMakeLists.txt file
CString makefileIn = m_WhereSource;
makefileIn += "/CMakeLists.txt";
mf.ReadMakefile(makefileIn);
// Move this to the cache editor
mf.GenerateMakefile();
CDialog::OnOK();
this->SaveToRegistry();
}
......
......@@ -10,26 +10,68 @@ VPATH = @srcdir@
@MAKEINCLUDE@ @MAKEQUOTE@@CMAKE_CONFIG_DIR@/CMake/CMakeSimpleRules.make@MAKEQUOTE@
OBJS = \
cmClassFile.o \
cmDirectory.o \
cmMakefile.o \
cmUnixMakefile.o \
CMakeBuildTargets.o \
cmMakeDepend.o \
cmMakefile.o \
cmAbstractFilesRule.o \
cmMakefileGenerator.o \
cmAddTargetRule.o \
cmProjectRule.o \
cmAuxSourceDirectoryRule.o \
cmRegularExpression.o \
cmClassFile.o \
cmSourceFilesRule.o \
cmSourceFilesRequireRule.o \
cmSubdirRule.o \
cmSystemTools.o \
CMakeBuildTargets.o \
cmCollectFlags.o
cmCollectFlags.o : cmCollectFlags.h cmCollectFlags.cxx cmSystemTools.h
cmSystemTools.o : cmSystemTools.h cmSystemTools.cxx cmSystemTools.h
cmDirectory.o : cmDirectory.h cmDirectory.cxx cmSystemTools.h
cmClassFile.o : cmClassFile.h cmClassFile.cxx cmSystemTools.h
cmMakefile.o : cmMakefile.h cmMakefile.cxx cmClassFile.h cmSystemTools.h
cmUnixMakefile.o : cmUnixMakefile.h cmUnixMakefile.cxx cmMakefile.h cmClassFile.h
cmMakeDepend.o : cmMakeDepend.h cmMakeDepend.cxx cmMakefile.h cmClassFile.h cmRegularExpression.h
cmRegularExpression.o : cmRegularExpression.h cmRegularExpression.cxx
CMakeBuildTargets.o : CMakeBuildTargets.cxx cmMakefile.h cmMakeDepend.h
cmDirectory.o \
cmUnixDefinesRule.o \
cmExecutablesRule.o \
cmTestsRule.o \
cmUnixLibrariesRule.o \
cmFindIncludeRule.o \
cmFindLibraryRule.o \
cmUnixMakefileGenerator.o \
cmFindProgramRule.o \
cmIncludeDirectoryRule.o \
cmWin32DefinesRule.o \
cmLibraryRule.o \
cmWin32LibrariesRule.o \
cmLinkDirectoriesRule.o \
cmLinkLibrariesRule.o
cmCollectFlags.o : $(srcdir)/*.h
CMakeBuildTargets.o : $(srcdir)/*.h
cmMakeDepend.o : $(srcdir)/*.h
cmMakefile.o : $(srcdir)/*.h
cmAbstractFilesRule.o : $(srcdir)/*.h
cmMakefileGenerator.o : $(srcdir)/*.h
cmAddTargetRule.o : $(srcdir)/*.h
cmProjectRule.o : $(srcdir)/*.h
cmAuxSourceDirectoryRule.o : $(srcdir)/*.h
cmRegularExpression.o : $(srcdir)/*.h
cmClassFile.o : $(srcdir)/*.h
cmSourceFilesRule.o : $(srcdir)/*.h
cmSourceFilesRequireRule.o : $(srcdir)/*.h
cmSubdirRule.o : $(srcdir)/*.h
cmSystemTools.o : $(srcdir)/*.h