start work on nmake generator
This commit is contained in:
parent
6220a187ba
commit
dc839f80f0
|
@ -91,6 +91,10 @@ SOURCE=.\cmake.cxx
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmNMakeMakefileGenerator.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cmBorlandMakefileGenerator.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
@ -38,6 +38,7 @@ ADD_DEFINITIONS(-DCMAKE_BUILD_WITH_CMAKE)
|
|||
IF (WIN32)
|
||||
SOURCE_FILES(SRCS cmDSWWriter.cxx cmDSPWriter.cxx cmMSProjectGenerator.cxx)
|
||||
SOURCE_FILES(SRCS cmBorlandMakefileGenerator.cpp)
|
||||
SOURCE_FILES(SRCS cmNMakeMakefileGenerator.cxx)
|
||||
IF(NOT UNIX)
|
||||
IF( CMAKE_CXX_COMPILER MATCHES Borland )
|
||||
ELSE (CMAKE_CXX_COMPILER MATCHES Borland )
|
||||
|
|
|
@ -0,0 +1,117 @@
|
|||
/*=========================================================================
|
||||
|
||||
Program: Insight Segmentation & Registration Toolkit
|
||||
Module: $RCSfile$
|
||||
Language: C++
|
||||
Date: $Date$
|
||||
Version: $Revision$
|
||||
|
||||
Copyright (c) 2001 Insight Consortium
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* The name of the Insight Consortium, nor the names of any consortium members,
|
||||
nor of any contributors, may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
* Modified source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
=========================================================================*/
|
||||
#include "cmNMakeMakefileGenerator.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmStandardIncludes.h"
|
||||
#include "cmSystemTools.h"
|
||||
#include "cmSourceFile.h"
|
||||
#include "cmMakeDepend.h"
|
||||
#include "cmCacheManager.h"
|
||||
#include "cmGeneratedFileStream.h"
|
||||
|
||||
cmNMakeMakefileGenerator::cmNMakeMakefileGenerator()
|
||||
{
|
||||
}
|
||||
|
||||
cmNMakeMakefileGenerator::~cmNMakeMakefileGenerator()
|
||||
{
|
||||
}
|
||||
|
||||
void cmNMakeMakefileGenerator::ComputeSystemInfo()
|
||||
{
|
||||
}
|
||||
|
||||
void cmNMakeMakefileGenerator::OutputMakeVariables(std::ostream& fout)
|
||||
{
|
||||
fout << "# NMake Makefile generated by cmake\n";
|
||||
const char* variables =
|
||||
"# general varibles used in the makefile\n"
|
||||
"\n"
|
||||
"# Path to cmake\n"
|
||||
"CMAKE_COMMAND = ${CMAKE_COMMAND}\n";
|
||||
std::string replaceVars = variables;
|
||||
m_Makefile->ExpandVariablesInString(replaceVars);
|
||||
fout << replaceVars.c_str();
|
||||
fout << "CMAKE_CURRENT_SOURCE = " << m_Makefile->GetStartDirectory()
|
||||
<< "\n";
|
||||
fout << "CMAKE_CURRENT_BINARY = " << m_Makefile->GetStartOutputDirectory()
|
||||
<< "\n";
|
||||
fout << "CMAKE_SOURCE_DIR = " << m_Makefile->GetHomeDirectory() << "\n";
|
||||
fout << "CMAKE_BINARY_DIR = " << m_Makefile->GetHomeOutputDirectory()
|
||||
<< "\n";
|
||||
// Output Include paths
|
||||
fout << "INCLUDE_FLAGS = ";
|
||||
std::vector<std::string>& includes = m_Makefile->GetIncludeDirectories();
|
||||
std::vector<std::string>::iterator i;
|
||||
fout << "-I" << m_Makefile->GetStartDirectory() << " ";
|
||||
for(i = includes.begin(); i != includes.end(); ++i)
|
||||
{
|
||||
std::string include = *i;
|
||||
// Don't output a -I for the standard include path "/usr/include".
|
||||
// This can cause problems with certain standard library
|
||||
// implementations because the wrong headers may be found first.
|
||||
if(include != "/usr/include")
|
||||
{
|
||||
fout << "-I" << cmSystemTools::EscapeSpaces(i->c_str()).c_str() << " ";
|
||||
}
|
||||
}
|
||||
fout << m_Makefile->GetDefineFlags();
|
||||
fout << "\n\n";
|
||||
}
|
||||
|
||||
|
||||
void cmNMakeMakefileGenerator::BuildInSubDirectory(std::ostream& fout,
|
||||
const char* directory,
|
||||
const char* target1,
|
||||
const char* target2)
|
||||
{
|
||||
if(target1)
|
||||
{
|
||||
fout << "\tif not exist " << directory << " "
|
||||
<< "$(MAKE) rebuild_cache\n"
|
||||
<< "\tcd \".\\" << directory << "\"\n"
|
||||
<< "\t$(MAKE) -$(MAKEFLAGS) " << target1 << "\n";
|
||||
}
|
||||
if(target2)
|
||||
{
|
||||
fout << "\t$(MAKE) -$(MAKEFLAGS) " << target2 << "\n";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
/*=========================================================================
|
||||
|
||||
Program: Insight Segmentation & Registration Toolkit
|
||||
Module: $RCSfile$
|
||||
Language: C++
|
||||
Date: $Date$
|
||||
Version: $Revision$
|
||||
|
||||
Copyright (c) 2001 Insight Consortium
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* The name of the Insight Consortium, nor the names of any consortium members,
|
||||
nor of any contributors, may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
* Modified source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
=========================================================================*/
|
||||
#ifndef cmNMakeMakefileGenerator_h
|
||||
#define cmNMakeMakefileGenerator_h
|
||||
|
||||
#include "cmUnixMakefileGenerator.h"
|
||||
|
||||
/** \class cmNMakeMakefileGenerator
|
||||
* \brief Write an NMake makefile.
|
||||
*
|
||||
* cmNMakeMakefileGenerator produces a Unix makefile from its
|
||||
* member m_Makefile.
|
||||
*/
|
||||
class cmNMakeMakefileGenerator : public cmUnixMakefileGenerator
|
||||
{
|
||||
public:
|
||||
///! Set cache only and recurse to false by default.
|
||||
cmNMakeMakefileGenerator();
|
||||
|
||||
virtual ~cmNMakeMakefileGenerator();
|
||||
|
||||
///! Get the name for the generator.
|
||||
virtual const char* GetName() {return "NMake Makefiles";}
|
||||
|
||||
///! virtual copy constructor
|
||||
virtual cmMakefileGenerator* CreateObject()
|
||||
{ return new cmNMakeMakefileGenerator;}
|
||||
|
||||
///! figure out about the current system information
|
||||
virtual void ComputeSystemInfo();
|
||||
protected:
|
||||
virtual void OutputMakeVariables(std::ostream&);
|
||||
virtual void BuildInSubDirectory(std::ostream& fout,
|
||||
const char* directory,
|
||||
const char* target1,
|
||||
const char* target2);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -204,6 +204,10 @@ void cmUnixMakefileGenerator::OutputMakefile(const char* file)
|
|||
return;
|
||||
}
|
||||
fout << "# CMAKE generated Makefile, DO NOT EDIT!\n"
|
||||
<< "# Generated by \"" << this->GetName() << "\""
|
||||
<< " Generator, CMake Version "
|
||||
<< cmMakefile::GetMajorVersion() << "."
|
||||
<< cmMakefile::GetMinorVersion() << "\n"
|
||||
<< "# Generated from the following files:\n# "
|
||||
<< m_Makefile->GetHomeOutputDirectory() << "/CMakeCache.txt\n";
|
||||
std::vector<std::string> lfiles = m_Makefile->GetListFiles();
|
||||
|
@ -256,6 +260,12 @@ void cmUnixMakefileGenerator::OutputMakefile(const char* file)
|
|||
}
|
||||
this->OutputObjectDepends(dependout);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "skipping depends\n";
|
||||
}
|
||||
std::cout << "hello\n";
|
||||
|
||||
this->OutputCustomRules(fout);
|
||||
this->OutputMakeRules(fout);
|
||||
this->OutputInstallRules(fout);
|
||||
|
@ -839,6 +849,27 @@ inline std::string FixDirectoryName(const char* dir)
|
|||
return s;
|
||||
}
|
||||
|
||||
|
||||
void cmUnixMakefileGenerator::BuildInSubDirectory(std::ostream& fout,
|
||||
const char* directory,
|
||||
const char* target1,
|
||||
const char* target2)
|
||||
{
|
||||
if(target1)
|
||||
{
|
||||
fout << "\t@if test ! -d " << directory
|
||||
<< "; then $(MAKE) rebuild_cache; fi\n"
|
||||
"\tcd " << directory
|
||||
<< "; $(MAKE) -$(MAKEFLAGS) " << target1 << "\n";
|
||||
}
|
||||
if(target2)
|
||||
{
|
||||
fout << "\t@cd " << directory
|
||||
<< "; $(MAKE) -$(MAKEFLAGS) " << target2 << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
cmUnixMakefileGenerator::
|
||||
OutputSubDirectoryVars(std::ostream& fout,
|
||||
|
@ -881,17 +912,8 @@ OutputSubDirectoryVars(std::ostream& fout,
|
|||
fout << " " << target << "_" << fixed_d.c_str();
|
||||
}
|
||||
fout << "\n";
|
||||
if(target1)
|
||||
{
|
||||
fout << "\t@if test ! -d " << SubDirectories[i].c_str() << "; then $(MAKE) rebuild_cache; fi\n"
|
||||
"\tcd " << SubDirectories[i].c_str()
|
||||
<< "; $(MAKE) -$(MAKEFLAGS) " << target1 << "\n";
|
||||
}
|
||||
if(target2)
|
||||
{
|
||||
fout << "\t@cd " << SubDirectories[i].c_str()
|
||||
<< "; $(MAKE) -$(MAKEFLAGS) " << target2 << "\n";
|
||||
}
|
||||
this->BuildInSubDirectory(fout, SubDirectories[i].c_str(),
|
||||
target1, target2);
|
||||
}
|
||||
fout << "\n\n";
|
||||
}
|
||||
|
@ -1080,7 +1102,8 @@ void cmUnixMakefileGenerator::RecursiveGenerateCacheOnly()
|
|||
{
|
||||
mf->AddDefinition("RUN_CONFIGURE", true);
|
||||
}
|
||||
cmUnixMakefileGenerator* gen = new cmUnixMakefileGenerator;
|
||||
cmUnixMakefileGenerator* gen =
|
||||
static_cast<cmUnixMakefileGenerator*>(this->CreateObject());
|
||||
gen->SetCacheOnlyOn();
|
||||
gen->SetRecurseOff();
|
||||
mf->SetMakefileGenerator(gen);
|
||||
|
|
|
@ -131,6 +131,11 @@ protected:
|
|||
const char* extraCompileFlags,
|
||||
bool sharedTarget);
|
||||
|
||||
virtual void BuildInSubDirectory(std::ostream& fout,
|
||||
const char* directory,
|
||||
const char* target1,
|
||||
const char* target2);
|
||||
|
||||
virtual void OutputSubDirectoryVars(std::ostream& fout,
|
||||
const char* var,
|
||||
const char* target,
|
||||
|
|
Loading…
Reference in New Issue