Add JOM support and clean up some of the tar -E stuff
This commit is contained in:
parent
a01badcc7a
commit
dd09d88065
|
@ -281,6 +281,8 @@ IF (WIN32)
|
|||
cmGlobalMinGWMakefileGenerator.cxx
|
||||
cmGlobalNMakeMakefileGenerator.cxx
|
||||
cmGlobalNMakeMakefileGenerator.h
|
||||
cmGlobalJOMMakefileGenerator.cxx
|
||||
cmGlobalJOMMakefileGenerator.h
|
||||
cmGlobalVisualStudio6Generator.cxx
|
||||
cmGlobalVisualStudio6Generator.h
|
||||
cmGlobalVisualStudio71Generator.cxx
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
/*============================================================================
|
||||
CMake - Cross Platform Makefile Generator
|
||||
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
||||
|
||||
Distributed under the OSI-approved BSD License (the "License");
|
||||
see accompanying file Copyright.txt for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the License for more information.
|
||||
============================================================================*/
|
||||
#include "cmGlobalJOMMakefileGenerator.h"
|
||||
#include "cmLocalUnixMakefileGenerator3.h"
|
||||
#include "cmMakefile.h"
|
||||
|
||||
cmGlobalJOMMakefileGenerator::cmGlobalJOMMakefileGenerator()
|
||||
{
|
||||
this->FindMakeProgramFile = "CMakeJOMFindMake.cmake";
|
||||
this->ForceUnixPaths = false;
|
||||
this->ToolSupportsColor = true;
|
||||
this->UseLinkScript = false;
|
||||
}
|
||||
|
||||
void cmGlobalJOMMakefileGenerator
|
||||
::EnableLanguage(std::vector<std::string>const& l,
|
||||
cmMakefile *mf,
|
||||
bool optional)
|
||||
{
|
||||
// pick a default
|
||||
mf->AddDefinition("CMAKE_GENERATOR_CC", "cl");
|
||||
mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl");
|
||||
if(!(cmSystemTools::GetEnv("INCLUDE") &&
|
||||
cmSystemTools::GetEnv("LIB"))
|
||||
)
|
||||
{
|
||||
std::string message = "To use the JOM generator, cmake must be run "
|
||||
"from a shell that can use the compiler cl from the command line. "
|
||||
"This environment does not contain INCLUDE, LIB, or LIBPATH, and "
|
||||
"these must be set for the cl compiler to work. ";
|
||||
mf->IssueMessage(cmake::WARNING,
|
||||
message);
|
||||
}
|
||||
|
||||
this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
|
||||
}
|
||||
|
||||
///! Create a local generator appropriate to this Global Generator
|
||||
cmLocalGenerator *cmGlobalJOMMakefileGenerator::CreateLocalGenerator()
|
||||
{
|
||||
cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3;
|
||||
lg->SetDefineWindowsNULL(true);
|
||||
lg->SetWindowsShell(true);
|
||||
lg->SetMakeSilentFlag("/nologo");
|
||||
lg->SetGlobalGenerator(this);
|
||||
lg->SetIgnoreLibPrefix(true);
|
||||
lg->SetPassMakeflags(true);
|
||||
lg->SetNMake(true);
|
||||
lg->SetUnixCD(false);
|
||||
return lg;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmGlobalJOMMakefileGenerator
|
||||
::GetDocumentation(cmDocumentationEntry& entry) const
|
||||
{
|
||||
entry.Name = this->GetName();
|
||||
entry.Brief = "Generates JOM makefiles.";
|
||||
entry.Full = "";
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/*============================================================================
|
||||
CMake - Cross Platform Makefile Generator
|
||||
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
||||
|
||||
Distributed under the OSI-approved BSD License (the "License");
|
||||
see accompanying file Copyright.txt for details.
|
||||
|
||||
This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the License for more information.
|
||||
============================================================================*/
|
||||
#ifndef cmGlobalJOMMakefileGenerator_h
|
||||
#define cmGlobalJOMMakefileGenerator_h
|
||||
|
||||
#include "cmGlobalUnixMakefileGenerator3.h"
|
||||
|
||||
/** \class cmGlobalJOMMakefileGenerator
|
||||
* \brief Write a JOM makefiles.
|
||||
*
|
||||
* cmGlobalJOMMakefileGenerator manages nmake build process for a tree
|
||||
*/
|
||||
class cmGlobalJOMMakefileGenerator : public cmGlobalUnixMakefileGenerator3
|
||||
{
|
||||
public:
|
||||
cmGlobalJOMMakefileGenerator();
|
||||
static cmGlobalGenerator* New() {
|
||||
return new cmGlobalJOMMakefileGenerator; }
|
||||
///! Get the name for the generator.
|
||||
virtual const char* GetName() const {
|
||||
return cmGlobalJOMMakefileGenerator::GetActualName();}
|
||||
static const char* GetActualName() {return "JOM Makefiles";}
|
||||
|
||||
/** Get the documentation entry for this generator. */
|
||||
virtual void GetDocumentation(cmDocumentationEntry& entry) const;
|
||||
|
||||
///! Create a local generator appropriate to this Global Generator
|
||||
virtual cmLocalGenerator *CreateLocalGenerator();
|
||||
|
||||
/**
|
||||
* Try to determine system infomation such as shared library
|
||||
* extension, pthreads, byte order etc.
|
||||
*/
|
||||
virtual void EnableLanguage(std::vector<std::string>const& languages,
|
||||
cmMakefile *, bool optional);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1704,7 +1704,7 @@ bool cmSystemTools::IsPathToFramework(const char* path)
|
|||
|
||||
bool cmSystemTools::CreateTar(const char* outFileName,
|
||||
const std::vector<cmStdString>& files,
|
||||
bool gzip, bool verbose)
|
||||
bool gzip, bool bzip2, bool verbose)
|
||||
{
|
||||
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
|
||||
|
@ -1755,6 +1755,14 @@ bool cmSystemTools::CreateTar(const char* outFileName,
|
|||
cmSystemTools::Error("Unable to use gzip in libarchive");
|
||||
}
|
||||
}
|
||||
if(bzip2)
|
||||
{
|
||||
res = archive_write_set_compression_bzip2(a);
|
||||
if(res != ARCHIVE_OK)
|
||||
{
|
||||
cmSystemTools::Error("Unable to use bzip2 in libarchive");
|
||||
}
|
||||
}
|
||||
res = archive_write_set_format_ustar(a);
|
||||
if(res != ARCHIVE_OK)
|
||||
{
|
||||
|
@ -1862,7 +1870,6 @@ list_item_verbose(FILE *out, struct archive_entry *entry)
|
|||
u_width = w;
|
||||
}
|
||||
fprintf(out, "%-*s ", (int)u_width, p);
|
||||
|
||||
/* Use gname if it's present, else gid. */
|
||||
p = archive_entry_gname(entry);
|
||||
if (p != NULL && p[0] != '\0')
|
||||
|
@ -1967,7 +1974,8 @@ int copy_data(struct archive *ar, struct archive *aw)
|
|||
}
|
||||
}
|
||||
|
||||
bool extract_tar(const char* outFileName, bool verbose, bool extract)
|
||||
bool extract_tar(const char* outFileName, bool verbose,
|
||||
bool extract)
|
||||
{
|
||||
struct archive* a = archive_read_new();
|
||||
struct archive *ext = archive_write_disk_new();
|
||||
|
@ -2038,10 +2046,8 @@ bool extract_tar(const char* outFileName, bool verbose, bool extract)
|
|||
#endif
|
||||
|
||||
bool cmSystemTools::ExtractTar(const char* outFileName,
|
||||
const std::vector<cmStdString>& files,
|
||||
bool , bool verbose)
|
||||
{
|
||||
(void)files;
|
||||
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||
return extract_tar(outFileName, verbose, true);
|
||||
#else
|
||||
|
@ -2052,11 +2058,10 @@ bool cmSystemTools::ExtractTar(const char* outFileName,
|
|||
}
|
||||
|
||||
bool cmSystemTools::ListTar(const char* outFileName,
|
||||
std::vector<cmStdString>& files, bool ,
|
||||
bool ,
|
||||
bool verbose)
|
||||
{
|
||||
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||
(void)files;
|
||||
return extract_tar(outFileName, verbose, false);
|
||||
#else
|
||||
(void)outFileName;
|
||||
|
|
|
@ -354,13 +354,11 @@ public:
|
|||
|
||||
/** Create tar */
|
||||
static bool ListTar(const char* outFileName,
|
||||
std::vector<cmStdString>& files,
|
||||
bool gzip, bool verbose);
|
||||
static bool CreateTar(const char* outFileName,
|
||||
const std::vector<cmStdString>& files, bool gzip,
|
||||
bool verbose);
|
||||
static bool ExtractTar(const char* inFileName,
|
||||
const std::vector<cmStdString>& files, bool gzip,
|
||||
bool bzip2, bool verbose);
|
||||
static bool ExtractTar(const char* inFileName, bool gzip,
|
||||
bool verbose);
|
||||
// This should be called first thing in main
|
||||
// it will keep child processes from inheriting the
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
# include "cmGlobalVisualStudio8Win64Generator.h"
|
||||
# include "cmGlobalBorlandMakefileGenerator.h"
|
||||
# include "cmGlobalNMakeMakefileGenerator.h"
|
||||
# include "cmGlobalJOMMakefileGenerator.h"
|
||||
# include "cmGlobalWatcomWMakeGenerator.h"
|
||||
# define CMAKE_HAVE_VS_GENERATORS
|
||||
# endif
|
||||
|
@ -969,7 +970,7 @@ void CMakeCommandUsage(const char* program)
|
|||
<< " remove_directory dir - remove a directory and its contents\n"
|
||||
<< " remove [-f] file1 file2 ... - remove the file(s), use -f to force "
|
||||
"it\n"
|
||||
<< " tar [cxt][vfz] file.tar file/dir1 file/dir2 ... - create a tar "
|
||||
<< " tar [cxt][vfz][cvfj] file.tar file/dir1 file/dir2 ... - create a tar "
|
||||
"archive\n"
|
||||
<< " time command [args] ... - run command and return elapsed time\n"
|
||||
<< " touch file - touch a file.\n"
|
||||
|
@ -1540,7 +1541,12 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||
files.push_back(args[cc]);
|
||||
}
|
||||
bool gzip = false;
|
||||
bool bzip2 = false;
|
||||
bool verbose = false;
|
||||
if ( flags.find_first_of('j') != flags.npos )
|
||||
{
|
||||
bzip2 = true;
|
||||
}
|
||||
if ( flags.find_first_of('z') != flags.npos )
|
||||
{
|
||||
gzip = true;
|
||||
|
@ -1552,7 +1558,7 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||
|
||||
if ( flags.find_first_of('t') != flags.npos )
|
||||
{
|
||||
if ( !cmSystemTools::ListTar(outFile.c_str(), files, gzip, verbose) )
|
||||
if ( !cmSystemTools::ListTar(outFile.c_str(), gzip, verbose) )
|
||||
{
|
||||
cmSystemTools::Error("Problem creating tar: ", outFile.c_str());
|
||||
return 1;
|
||||
|
@ -1561,7 +1567,7 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||
else if ( flags.find_first_of('c') != flags.npos )
|
||||
{
|
||||
if ( !cmSystemTools::CreateTar(
|
||||
outFile.c_str(), files, gzip, verbose) )
|
||||
outFile.c_str(), files, gzip, bzip2, verbose) )
|
||||
{
|
||||
cmSystemTools::Error("Problem creating tar: ", outFile.c_str());
|
||||
return 1;
|
||||
|
@ -1570,7 +1576,7 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||
else if ( flags.find_first_of('x') != flags.npos )
|
||||
{
|
||||
if ( !cmSystemTools::ExtractTar(
|
||||
outFile.c_str(), files, gzip, verbose) )
|
||||
outFile.c_str(), gzip, verbose) )
|
||||
{
|
||||
cmSystemTools::Error("Problem extracting tar: ", outFile.c_str());
|
||||
return 1;
|
||||
|
@ -2381,6 +2387,8 @@ void cmake::AddDefaultGenerators()
|
|||
&cmGlobalBorlandMakefileGenerator::New;
|
||||
this->Generators[cmGlobalNMakeMakefileGenerator::GetActualName()] =
|
||||
&cmGlobalNMakeMakefileGenerator::New;
|
||||
this->Generators[cmGlobalJOMMakefileGenerator::GetActualName()] =
|
||||
&cmGlobalJOMMakefileGenerator::New;
|
||||
this->Generators[cmGlobalWatcomWMakeGenerator::GetActualName()] =
|
||||
&cmGlobalWatcomWMakeGenerator::New;
|
||||
# endif
|
||||
|
|
Loading…
Reference in New Issue