summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2009-11-05 20:00:15 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2009-11-05 20:00:15 (GMT)
commitdd09d880656c71421acfd73776eac92c3f3ef77a (patch)
tree3465702ff785e584151c8f760d64b4aabe65a2a2
parenta01badcc7a8d4813d2eb84923c4e03447745657e (diff)
downloadCMake-dd09d880656c71421acfd73776eac92c3f3ef77a.zip
CMake-dd09d880656c71421acfd73776eac92c3f3ef77a.tar.gz
CMake-dd09d880656c71421acfd73776eac92c3f3ef77a.tar.bz2
Add JOM support and clean up some of the tar -E stuff
-rw-r--r--Source/CMakeLists.txt2
-rw-r--r--Source/cmGlobalJOMMakefileGenerator.cxx69
-rw-r--r--Source/cmGlobalJOMMakefileGenerator.h47
-rw-r--r--Source/cmSystemTools.cxx25
-rw-r--r--Source/cmSystemTools.h6
-rw-r--r--Source/cmake.cxx16
6 files changed, 147 insertions, 18 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 96b0e4e..ecbecaf 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -281,6 +281,8 @@ IF (WIN32)
cmGlobalMinGWMakefileGenerator.cxx
cmGlobalNMakeMakefileGenerator.cxx
cmGlobalNMakeMakefileGenerator.h
+ cmGlobalJOMMakefileGenerator.cxx
+ cmGlobalJOMMakefileGenerator.h
cmGlobalVisualStudio6Generator.cxx
cmGlobalVisualStudio6Generator.h
cmGlobalVisualStudio71Generator.cxx
diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx
new file mode 100644
index 0000000..411e28b
--- /dev/null
+++ b/Source/cmGlobalJOMMakefileGenerator.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 = "";
+}
diff --git a/Source/cmGlobalJOMMakefileGenerator.h b/Source/cmGlobalJOMMakefileGenerator.h
new file mode 100644
index 0000000..98df5f5
--- /dev/null
+++ b/Source/cmGlobalJOMMakefileGenerator.h
@@ -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
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index df8bfbf..fe95b60 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -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)
{
@@ -1822,7 +1830,7 @@ namespace{
#define BSDTAR_FILESIZE_PRINTF "%lu"
#define BSDTAR_FILESIZE_TYPE unsigned long
void
-list_item_verbose(FILE *out, struct archive_entry *entry)
+ list_item_verbose(FILE *out, struct archive_entry *entry)
{
char tmp[100];
size_t w;
@@ -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')
@@ -1905,7 +1912,7 @@ list_item_verbose(FILE *out, struct archive_entry *entry)
gs_width = w+strlen(tmp)+1;
}
fprintf(out, "%*s", (int)(gs_width - w), tmp);
-
+
/* Format the time using 'ls -l' conventions. */
tim = archive_entry_mtime(entry);
#define HALF_YEAR (time_t)365 * 86400 / 2
@@ -1926,7 +1933,7 @@ list_item_verbose(FILE *out, struct archive_entry *entry)
strftime(tmp, sizeof(tmp), fmt, localtime(&tim));
fprintf(out, " %s ", tmp);
fprintf(out, "%s", archive_entry_pathname(entry));
-
+
/* Extra information for links. */
if (archive_entry_hardlink(entry)) /* Hard link */
{
@@ -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;
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 679884e..6364870 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -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
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index b9162bb..fafe2ae 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -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