ENH: Support for packaging source, several cleanups and more yeehaa...
This commit is contained in:
parent
1df8e12c42
commit
c09c3c6bfa
|
@ -3,6 +3,10 @@ SET(cpack_input_file "${CMAKE_ROOT}/Templates/CPackConfig.cmake.in")
|
||||||
IF(EXISTS "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
|
IF(EXISTS "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
|
||||||
SET(cpack_input_file "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
|
SET(cpack_input_file "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
|
||||||
ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
|
ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/CPackConfig.cmake.in")
|
||||||
|
SET(cpack_source_input_file "${CMAKE_ROOT}/Templates/CPackConfig.cmake.in")
|
||||||
|
IF(EXISTS "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in")
|
||||||
|
SET(cpack_source_input_file "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in")
|
||||||
|
ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in")
|
||||||
|
|
||||||
# Macro for setting values if a user did not overwrite them
|
# Macro for setting values if a user did not overwrite them
|
||||||
MACRO(cpack_set_if_not_set name value)
|
MACRO(cpack_set_if_not_set name value)
|
||||||
|
@ -11,6 +15,19 @@ MACRO(cpack_set_if_not_set name value)
|
||||||
ENDIF(NOT DEFINED "${name}")
|
ENDIF(NOT DEFINED "${name}")
|
||||||
ENDMACRO(cpack_set_if_not_set)
|
ENDMACRO(cpack_set_if_not_set)
|
||||||
|
|
||||||
|
# Macro to encode variables for the configuration file
|
||||||
|
MACRO(cpack_encode_variables)
|
||||||
|
SET(_CPACK_OTHER_VARIABLES_)
|
||||||
|
GET_CMAKE_PROPERTY(res VARIABLES)
|
||||||
|
FOREACH(var ${res})
|
||||||
|
IF("xxx${var}" MATCHES "xxxCPACK")
|
||||||
|
SET(_CPACK_OTHER_VARIABLES_
|
||||||
|
"${_CPACK_OTHER_VARIABLES_}\nSET(${var} \"${${var}}\")")
|
||||||
|
ENDIF("xxx${var}" MATCHES "xxxCPACK")
|
||||||
|
ENDFOREACH(var ${res})
|
||||||
|
ENDMACRO(cpack_encode_variables)
|
||||||
|
|
||||||
|
|
||||||
# Set the package name
|
# Set the package name
|
||||||
cpack_set_if_not_set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
|
cpack_set_if_not_set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
|
||||||
cpack_set_if_not_set(CPACK_PACKAGE_VERSION_MAJOR "0")
|
cpack_set_if_not_set(CPACK_PACKAGE_VERSION_MAJOR "0")
|
||||||
|
@ -61,24 +78,38 @@ IF(NOT CPACK_GENERATOR)
|
||||||
ELSE(APPLE)
|
ELSE(APPLE)
|
||||||
SET(CPACK_GENERATOR "STGZ")
|
SET(CPACK_GENERATOR "STGZ")
|
||||||
ENDIF(APPLE)
|
ENDIF(APPLE)
|
||||||
|
SET(CPACK_SOURCE_GENERATOR "TGZ")
|
||||||
ELSE(UNIX)
|
ELSE(UNIX)
|
||||||
SET(CPACK_GENERATOR "NSIS")
|
SET(CPACK_GENERATOR "NSIS")
|
||||||
|
SET(CPACK_SOURCE_GENERATOR "ZIP")
|
||||||
ENDIF(UNIX)
|
ENDIF(UNIX)
|
||||||
ENDIF(NOT CPACK_GENERATOR)
|
ENDIF(NOT CPACK_GENERATOR)
|
||||||
|
|
||||||
# Set some other variables
|
# Set some other variables
|
||||||
cpack_set_if_not_set(CPACK_BINARY_DIR "${CMAKE_BINARY_DIR}")
|
|
||||||
cpack_set_if_not_set(CPACK_INSTALL_CMAKE_PROJECTS
|
cpack_set_if_not_set(CPACK_INSTALL_CMAKE_PROJECTS
|
||||||
"${CMAKE_BINARY_DIR};${CMAKE_PROJECT_NAME};ALL;/")
|
"${CMAKE_BINARY_DIR};${CMAKE_PROJECT_NAME};ALL;/")
|
||||||
cpack_set_if_not_set(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}")
|
cpack_set_if_not_set(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}")
|
||||||
|
cpack_set_if_not_set(CPACK_TOPLEVEL_TAG "${CMAKE_SYSTEM_NAME}")
|
||||||
|
|
||||||
SET(_CPACK_UNUSED_VARIABLES_)
|
cpack_encode_variables()
|
||||||
GET_CMAKE_PROPERTY(res VARIABLES)
|
CONFIGURE_FILE("${cpack_input_file}"
|
||||||
FOREACH(var ${res})
|
"${CMAKE_BINARY_DIR}/CPackConfig.cmake" @ONLY IMMEDIATE)
|
||||||
IF("xxx${var}" MATCHES "xxxCPACK")
|
|
||||||
SET(_CPACK_OTHER_VARIABLES_
|
|
||||||
"${_CPACK_OTHER_VARIABLES_}\nSET(${var} \"${${var}}\")")
|
|
||||||
ENDIF("xxx${var}" MATCHES "xxxCPACK")
|
|
||||||
ENDFOREACH(var ${res})
|
|
||||||
|
|
||||||
CONFIGURE_FILE("${cpack_input_file}" "${CMAKE_BINARY_DIR}/CPackConfig.cmake" @ONLY IMMEDIATE)
|
# Generate source file
|
||||||
|
cpack_set_if_not_set(CPACK_SOURCE_INSTALLED_DIRECTORIES
|
||||||
|
"${CMAKE_SOURCE_DIR};/")
|
||||||
|
cpack_set_if_not_set(CPACK_SOURCE_TOPLEVEL_TAG "${CMAKE_SYSTEM_NAME}-Source")
|
||||||
|
cpack_set_if_not_set(CPACK_SOURCE_PACKAGE_FILE_NAME
|
||||||
|
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-Source")
|
||||||
|
cpack_set_if_not_set(CPACK_SOURCE_IGNORE_FILES
|
||||||
|
"/CVS/;/\\\\\\\\.svn/;\\\\\\\\.swp$;\\\\\\\\.#")
|
||||||
|
SET(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_SOURCE_INSTALL_CMAKE_PROJECTS}")
|
||||||
|
SET(CPACK_INSTALLED_DIRECTORIES "${CPACK_SOURCE_INSTALLED_DIRECTORIES}")
|
||||||
|
SET(CPACK_GENERATOR "${CPACK_SOURCE_GENERATOR}")
|
||||||
|
SET(CPACK_TOPLEVEL_TAG "${CPACK_SOURCE_TOPLEVEL_TAG}")
|
||||||
|
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
|
||||||
|
SET(CPACK_IGNORE_FILES "${CPACK_SOURCE_IGNORE_FILES}")
|
||||||
|
|
||||||
|
cpack_encode_variables()
|
||||||
|
CONFIGURE_FILE("${cpack_source_input_file}"
|
||||||
|
"${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake" @ONLY IMMEDIATE)
|
||||||
|
|
|
@ -48,6 +48,12 @@ int cmCPackGenericGenerator::PrepareNames()
|
||||||
this->SetOption("CPACK_GENERATOR", this->Name.c_str());
|
this->SetOption("CPACK_GENERATOR", this->Name.c_str());
|
||||||
std::string tempDirectory = this->GetOption("CPACK_PACKAGE_DIRECTORY");
|
std::string tempDirectory = this->GetOption("CPACK_PACKAGE_DIRECTORY");
|
||||||
tempDirectory += "/_CPack_Packages/";
|
tempDirectory += "/_CPack_Packages/";
|
||||||
|
const char* toplevelTag = this->GetOption("CPACK_TOPLEVEL_TAG");
|
||||||
|
if ( toplevelTag )
|
||||||
|
{
|
||||||
|
tempDirectory += toplevelTag;
|
||||||
|
tempDirectory += "/";
|
||||||
|
}
|
||||||
tempDirectory += this->GetOption("CPACK_GENERATOR");
|
tempDirectory += this->GetOption("CPACK_GENERATOR");
|
||||||
std::string topDirectory = tempDirectory;
|
std::string topDirectory = tempDirectory;
|
||||||
|
|
||||||
|
@ -120,6 +126,22 @@ int cmCPackGenericGenerator::PrepareNames()
|
||||||
int cmCPackGenericGenerator::InstallProject()
|
int cmCPackGenericGenerator::InstallProject()
|
||||||
{
|
{
|
||||||
cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Install projects" << std::endl);
|
cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Install projects" << std::endl);
|
||||||
|
std::vector<cmsys::RegularExpression> ignoreFilesRegex;
|
||||||
|
const char* cpackIgnoreFiles = this->GetOption("CPACK_IGNORE_FILES");
|
||||||
|
if ( cpackIgnoreFiles )
|
||||||
|
{
|
||||||
|
std::vector<std::string> ignoreFilesRegexString;
|
||||||
|
cmSystemTools::ExpandListArgument(cpackIgnoreFiles,ignoreFilesRegexString);
|
||||||
|
std::vector<std::string>::iterator it;
|
||||||
|
for ( it = ignoreFilesRegexString.begin();
|
||||||
|
it != ignoreFilesRegexString.end();
|
||||||
|
++it )
|
||||||
|
{
|
||||||
|
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
|
||||||
|
"Create ignore files regex for: " << it->c_str() << std::endl);
|
||||||
|
ignoreFilesRegex.push_back(it->c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
const char* tempInstallDirectory
|
const char* tempInstallDirectory
|
||||||
= this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY");
|
= this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY");
|
||||||
int res = 1;
|
int res = 1;
|
||||||
|
@ -143,7 +165,7 @@ int cmCPackGenericGenerator::InstallProject()
|
||||||
cmSystemTools::PutEnv(destDir.c_str());
|
cmSystemTools::PutEnv(destDir.c_str());
|
||||||
}
|
}
|
||||||
const char* installCommands = this->GetOption("CPACK_INSTALL_COMMANDS");
|
const char* installCommands = this->GetOption("CPACK_INSTALL_COMMANDS");
|
||||||
if ( installCommands )
|
if ( installCommands && *installCommands )
|
||||||
{
|
{
|
||||||
std::vector<std::string> installCommandsVector;
|
std::vector<std::string> installCommandsVector;
|
||||||
cmSystemTools::ExpandListArgument(installCommands,installCommandsVector);
|
cmSystemTools::ExpandListArgument(installCommands,installCommandsVector);
|
||||||
|
@ -177,7 +199,7 @@ int cmCPackGenericGenerator::InstallProject()
|
||||||
}
|
}
|
||||||
const char* installDirectories
|
const char* installDirectories
|
||||||
= this->GetOption("CPACK_INSTALLED_DIRECTORIES");
|
= this->GetOption("CPACK_INSTALLED_DIRECTORIES");
|
||||||
if ( installDirectories )
|
if ( installDirectories && *installDirectories )
|
||||||
{
|
{
|
||||||
std::vector<std::string> installDirectoriesVector;
|
std::vector<std::string> installDirectoriesVector;
|
||||||
cmSystemTools::ExpandListArgument(installDirectories,
|
cmSystemTools::ExpandListArgument(installDirectories,
|
||||||
|
@ -203,6 +225,8 @@ int cmCPackGenericGenerator::InstallProject()
|
||||||
std::string subdir = it->c_str();
|
std::string subdir = it->c_str();
|
||||||
std::string findExpr = toplevel;
|
std::string findExpr = toplevel;
|
||||||
findExpr += "/*";
|
findExpr += "/*";
|
||||||
|
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
|
||||||
|
"- Install directory: " << toplevel << std::endl);
|
||||||
gl.RecurseOn();
|
gl.RecurseOn();
|
||||||
if ( !gl.FindFiles(findExpr) )
|
if ( !gl.FindFiles(findExpr) )
|
||||||
{
|
{
|
||||||
|
@ -212,12 +236,29 @@ int cmCPackGenericGenerator::InstallProject()
|
||||||
}
|
}
|
||||||
std::vector<std::string>& files = gl.GetFiles();
|
std::vector<std::string>& files = gl.GetFiles();
|
||||||
std::vector<std::string>::iterator gfit;
|
std::vector<std::string>::iterator gfit;
|
||||||
|
std::vector<cmsys::RegularExpression>::iterator regIt;
|
||||||
for ( gfit = files.begin(); gfit != files.end(); ++ gfit )
|
for ( gfit = files.begin(); gfit != files.end(); ++ gfit )
|
||||||
{
|
{
|
||||||
|
bool skip = false;
|
||||||
|
std::string &inFile = *gfit;
|
||||||
|
for ( regIt= ignoreFilesRegex.begin();
|
||||||
|
regIt!= ignoreFilesRegex.end();
|
||||||
|
++ regIt)
|
||||||
|
{
|
||||||
|
if ( regIt->find(inFile.c_str()) )
|
||||||
|
{
|
||||||
|
cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Ignore file: "
|
||||||
|
<< inFile.c_str() << std::endl);
|
||||||
|
skip = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( skip )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
std::string filePath = tempDir;
|
std::string filePath = tempDir;
|
||||||
filePath += "/" + subdir + "/"
|
filePath += "/" + subdir + "/"
|
||||||
+ cmSystemTools::RelativePath(toplevel.c_str(), gfit->c_str());
|
+ cmSystemTools::RelativePath(toplevel.c_str(), gfit->c_str());
|
||||||
std::string &inFile = *gfit;
|
|
||||||
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Copy file: "
|
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Copy file: "
|
||||||
<< inFile.c_str() << " -> " << filePath.c_str() << std::endl);
|
<< inFile.c_str() << " -> " << filePath.c_str() << std::endl);
|
||||||
if ( !cmSystemTools::CopyFileIfDifferent(inFile.c_str(),
|
if ( !cmSystemTools::CopyFileIfDifferent(inFile.c_str(),
|
||||||
|
@ -234,7 +275,7 @@ int cmCPackGenericGenerator::InstallProject()
|
||||||
= this->GetOption("CPACK_INSTALL_CMAKE_PROJECTS");
|
= this->GetOption("CPACK_INSTALL_CMAKE_PROJECTS");
|
||||||
const char* cmakeGenerator
|
const char* cmakeGenerator
|
||||||
= this->GetOption("CPACK_CMAKE_GENERATOR");
|
= this->GetOption("CPACK_CMAKE_GENERATOR");
|
||||||
if ( cmakeProjects )
|
if ( cmakeProjects && *cmakeProjects )
|
||||||
{
|
{
|
||||||
if ( !cmakeGenerator )
|
if ( !cmakeGenerator )
|
||||||
{
|
{
|
||||||
|
@ -324,6 +365,11 @@ int cmCPackGenericGenerator::InstallProject()
|
||||||
std::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
|
std::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
|
||||||
lg->SetGlobalGenerator(&gg);
|
lg->SetGlobalGenerator(&gg);
|
||||||
cmMakefile *mf = lg->GetMakefile();
|
cmMakefile *mf = lg->GetMakefile();
|
||||||
|
std::string realInstallDirectory = tempInstallDirectory;
|
||||||
|
if ( !installSubDirectory.empty() && installSubDirectory != "/" )
|
||||||
|
{
|
||||||
|
realInstallDirectory += installSubDirectory;
|
||||||
|
}
|
||||||
if ( movable )
|
if ( movable )
|
||||||
{
|
{
|
||||||
mf->AddDefinition("CMAKE_INSTALL_PREFIX", tempInstallDirectory);
|
mf->AddDefinition("CMAKE_INSTALL_PREFIX", tempInstallDirectory);
|
||||||
|
@ -332,6 +378,12 @@ int cmCPackGenericGenerator::InstallProject()
|
||||||
{
|
{
|
||||||
mf->AddDefinition("BUILD_TYPE", buildConfig);
|
mf->AddDefinition("BUILD_TYPE", buildConfig);
|
||||||
}
|
}
|
||||||
|
std::string installComponentLowerCase
|
||||||
|
= cmSystemTools::LowerCase(installComponent);
|
||||||
|
if ( installComponentLowerCase != "all" )
|
||||||
|
{
|
||||||
|
mf->AddDefinition("CMAKE_INSTALL_COMPONENT", installComponent.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
res = mf->ReadListFile(0, installFile.c_str());
|
res = mf->ReadListFile(0, installFile.c_str());
|
||||||
if ( cmSystemTools::GetErrorOccuredFlag() )
|
if ( cmSystemTools::GetErrorOccuredFlag() )
|
||||||
|
@ -383,6 +435,17 @@ int cmCPackGenericGenerator::InstallProject()
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void cmCPackGenericGenerator::SetOptionIfNotSet(const char* op,
|
||||||
|
const char* value)
|
||||||
|
{
|
||||||
|
if ( this->MakefileMap->GetDefinition(op) )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this->SetOption(op, value);
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void cmCPackGenericGenerator::SetOption(const char* op, const char* value)
|
void cmCPackGenericGenerator::SetOption(const char* op, const char* value)
|
||||||
{
|
{
|
||||||
|
@ -473,6 +536,12 @@ int cmCPackGenericGenerator::Initialize(const char* name, cmMakefile* mf)
|
||||||
{
|
{
|
||||||
this->MakefileMap = mf;
|
this->MakefileMap = mf;
|
||||||
this->Name = name;
|
this->Name = name;
|
||||||
|
return this->InitializeInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
int cmCPackGenericGenerator::InitializeInternal()
|
||||||
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Initialize generator
|
* Initialize generator
|
||||||
*/
|
*/
|
||||||
virtual int Initialize(const char* name, cmMakefile* mf);
|
int Initialize(const char* name, cmMakefile* mf);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct generator
|
* Construct generator
|
||||||
|
@ -78,6 +78,7 @@ public:
|
||||||
|
|
||||||
//! Set and get the options
|
//! Set and get the options
|
||||||
void SetOption(const char* op, const char* value);
|
void SetOption(const char* op, const char* value);
|
||||||
|
void SetOptionIfNotSet(const char* op, const char* value);
|
||||||
const char* GetOption(const char* op);
|
const char* GetOption(const char* op);
|
||||||
|
|
||||||
//! Set all the variables
|
//! Set all the variables
|
||||||
|
@ -99,6 +100,7 @@ protected:
|
||||||
|
|
||||||
virtual std::string FindTemplate(const char* name);
|
virtual std::string FindTemplate(const char* name);
|
||||||
virtual bool ConfigureFile(const char* inName, const char* outName);
|
virtual bool ConfigureFile(const char* inName, const char* outName);
|
||||||
|
virtual int InitializeInternal();
|
||||||
|
|
||||||
bool GeneratorVerbose;
|
bool GeneratorVerbose;
|
||||||
std::string Name;
|
std::string Name;
|
||||||
|
|
|
@ -115,17 +115,14 @@ int cmCPackNSISGenerator::CompressFiles(const char* outFileName,
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int cmCPackNSISGenerator::Initialize(const char* name, cmMakefile* mf)
|
int cmCPackNSISGenerator::InitializeInternal()
|
||||||
{
|
{
|
||||||
int res = this->Superclass::Initialize(name, mf);
|
|
||||||
if ( !res )
|
|
||||||
{
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
if ( cmSystemTools::IsOn(this->GetOption(
|
if ( cmSystemTools::IsOn(this->GetOption(
|
||||||
"CPACK_INCLUDE_TOPLEVEL_DIRECTORY")) )
|
"CPACK_INCLUDE_TOPLEVEL_DIRECTORY")) )
|
||||||
{
|
{
|
||||||
cmCPackLogger(cmCPackLog::LOG_ERROR, "NSIS Generator cannot work with CPACK_INCLUDE_TOPLEVEL_DIRECTORY. This option will be ignored."
|
cmCPackLogger(cmCPackLog::LOG_ERROR,
|
||||||
|
"NSIS Generator cannot work with CPACK_INCLUDE_TOPLEVEL_DIRECTORY. "
|
||||||
|
"This option will be ignored."
|
||||||
<< std::endl);
|
<< std::endl);
|
||||||
this->SetOption("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", 0);
|
this->SetOption("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", 0);
|
||||||
}
|
}
|
||||||
|
@ -222,7 +219,7 @@ int cmCPackNSISGenerator::Initialize(const char* name, cmMakefile* mf)
|
||||||
this->SetOption("CPACK_NSIS_DELETE_ICONS", deleteStr.str().c_str());
|
this->SetOption("CPACK_NSIS_DELETE_ICONS", deleteStr.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return this->Superclass::InitializeInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -31,11 +31,6 @@ class cmCPackNSISGenerator : public cmCPackGenericGenerator
|
||||||
public:
|
public:
|
||||||
cmCPackTypeMacro(cmCPackNSISGenerator, cmCPackGenericGenerator);
|
cmCPackTypeMacro(cmCPackNSISGenerator, cmCPackGenericGenerator);
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize generator
|
|
||||||
*/
|
|
||||||
virtual int Initialize(const char* name, cmMakefile* mf);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct generator
|
* Construct generator
|
||||||
*/
|
*/
|
||||||
|
@ -43,6 +38,7 @@ public:
|
||||||
virtual ~cmCPackNSISGenerator();
|
virtual ~cmCPackNSISGenerator();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual int InitializeInternal();
|
||||||
int CompressFiles(const char* outFileName, const char* toplevel,
|
int CompressFiles(const char* outFileName, const char* toplevel,
|
||||||
const std::vector<std::string>& files);
|
const std::vector<std::string>& files);
|
||||||
virtual const char* GetOutputExtension() { return "exe"; }
|
virtual const char* GetOutputExtension() { return "exe"; }
|
||||||
|
|
|
@ -137,13 +137,8 @@ int cmCPackPackageMakerGenerator::CompressFiles(const char* outFileName,
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int cmCPackPackageMakerGenerator::Initialize(const char* name, cmMakefile* mf)
|
int cmCPackPackageMakerGenerator::InitializeInternal()
|
||||||
{
|
{
|
||||||
int res = this->Superclass::Initialize(name, mf);
|
|
||||||
if ( !res )
|
|
||||||
{
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
cmCPackLogger(cmCPackLog::LOG_DEBUG,
|
cmCPackLogger(cmCPackLog::LOG_DEBUG,
|
||||||
"cmCPackPackageMakerGenerator::Initialize()" << std::endl);
|
"cmCPackPackageMakerGenerator::Initialize()" << std::endl);
|
||||||
std::vector<std::string> path;
|
std::vector<std::string> path;
|
||||||
|
@ -228,7 +223,7 @@ int cmCPackPackageMakerGenerator::Initialize(const char* name, cmMakefile* mf)
|
||||||
}
|
}
|
||||||
this->SetOption("CPACK_INSTALLER_PROGRAM_DISK_IMAGE", pkgPath.c_str());
|
this->SetOption("CPACK_INSTALLER_PROGRAM_DISK_IMAGE", pkgPath.c_str());
|
||||||
|
|
||||||
return res;
|
return this->Superclass::InitializeInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -32,11 +32,6 @@ class cmCPackPackageMakerGenerator : public cmCPackGenericGenerator
|
||||||
public:
|
public:
|
||||||
cmCPackTypeMacro(cmCPackPackageMakerGenerator, cmCPackGenericGenerator);
|
cmCPackTypeMacro(cmCPackPackageMakerGenerator, cmCPackGenericGenerator);
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize generator
|
|
||||||
*/
|
|
||||||
virtual int Initialize(const char* name, cmMakefile* mf);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct generator
|
* Construct generator
|
||||||
*/
|
*/
|
||||||
|
@ -44,6 +39,7 @@ public:
|
||||||
virtual ~cmCPackPackageMakerGenerator();
|
virtual ~cmCPackPackageMakerGenerator();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual int InitializeInternal();
|
||||||
int CompressFiles(const char* outFileName, const char* toplevel,
|
int CompressFiles(const char* outFileName, const char* toplevel,
|
||||||
const std::vector<std::string>& files);
|
const std::vector<std::string>& files);
|
||||||
virtual const char* GetOutputExtension() { return "dmg"; }
|
virtual const char* GetOutputExtension() { return "dmg"; }
|
||||||
|
|
|
@ -35,6 +35,13 @@ cmCPackSTGZGenerator::~cmCPackSTGZGenerator()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
int cmCPackSTGZGenerator::InitializeInternal()
|
||||||
|
{
|
||||||
|
this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "0");
|
||||||
|
return this->Superclass::InitializeInternal();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os)
|
int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os)
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,6 +37,7 @@ public:
|
||||||
virtual ~cmCPackSTGZGenerator();
|
virtual ~cmCPackSTGZGenerator();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual int InitializeInternal();
|
||||||
int GenerateHeader(std::ostream* os);
|
int GenerateHeader(std::ostream* os);
|
||||||
virtual const char* GetOutputExtension() { return "sh"; }
|
virtual const char* GetOutputExtension() { return "sh"; }
|
||||||
};
|
};
|
||||||
|
|
|
@ -178,6 +178,13 @@ int cmCPackTGZ_Data_Close(void *client_data)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
int cmCPackTGZGenerator::InitializeInternal()
|
||||||
|
{
|
||||||
|
this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "1");
|
||||||
|
return this->Superclass::InitializeInternal();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int cmCPackTGZGenerator::CompressFiles(const char* outFileName,
|
int cmCPackTGZGenerator::CompressFiles(const char* outFileName,
|
||||||
const char* toplevel, const std::vector<std::string>& files)
|
const char* toplevel, const std::vector<std::string>& files)
|
||||||
|
|
|
@ -40,6 +40,7 @@ public:
|
||||||
virtual ~cmCPackTGZGenerator();
|
virtual ~cmCPackTGZGenerator();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual int InitializeInternal();
|
||||||
virtual int GenerateHeader(std::ostream* os);
|
virtual int GenerateHeader(std::ostream* os);
|
||||||
int CompressFiles(const char* outFileName, const char* toplevel,
|
int CompressFiles(const char* outFileName, const char* toplevel,
|
||||||
const std::vector<std::string>& files);
|
const std::vector<std::string>& files);
|
||||||
|
|
|
@ -38,13 +38,9 @@ cmCPackZIPGenerator::~cmCPackZIPGenerator()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int cmCPackZIPGenerator::Initialize(const char* name, cmMakefile* mf)
|
int cmCPackZIPGenerator::InitializeInternal()
|
||||||
{
|
{
|
||||||
int res = this->Superclass::Initialize(name, mf);
|
this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "1");
|
||||||
if ( !res )
|
|
||||||
{
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
std::vector<std::string> path;
|
std::vector<std::string> path;
|
||||||
std::string pkgPath = "c:/Program Files/WinZip";
|
std::string pkgPath = "c:/Program Files/WinZip";
|
||||||
path.push_back(pkgPath);
|
path.push_back(pkgPath);
|
||||||
|
@ -68,7 +64,8 @@ int cmCPackZIPGenerator::Initialize(const char* name, cmMakefile* mf)
|
||||||
pkgPath = cmSystemTools::FindProgram("zip", path, false);
|
pkgPath = cmSystemTools::FindProgram("zip", path, false);
|
||||||
if ( pkgPath.empty() )
|
if ( pkgPath.empty() )
|
||||||
{
|
{
|
||||||
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Cannot find unix ZIP" << std::endl);
|
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Cannot find unix ZIP"
|
||||||
|
<< std::endl);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -83,9 +80,10 @@ int cmCPackZIPGenerator::Initialize(const char* name, cmMakefile* mf)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
this->SetOption("CPACK_INSTALLER_PROGRAM", pkgPath.c_str());
|
this->SetOption("CPACK_INSTALLER_PROGRAM", pkgPath.c_str());
|
||||||
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Found ZIP program: " << pkgPath.c_str()
|
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Found ZIP program: "
|
||||||
|
<< pkgPath.c_str()
|
||||||
<< std::endl);
|
<< std::endl);
|
||||||
return 1;
|
return this->Superclass::InitializeInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
|
@ -31,10 +31,6 @@ public:
|
||||||
friend class cmCPackZIPGeneratorForward;
|
friend class cmCPackZIPGeneratorForward;
|
||||||
cmCPackTypeMacro(cmCPackZIPGenerator, cmCPackGenericGenerator);
|
cmCPackTypeMacro(cmCPackZIPGenerator, cmCPackGenericGenerator);
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize generator
|
|
||||||
*/
|
|
||||||
virtual int Initialize(const char* name, cmMakefile* mf);
|
|
||||||
/**
|
/**
|
||||||
* Construct generator
|
* Construct generator
|
||||||
*/
|
*/
|
||||||
|
@ -49,6 +45,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual int InitializeInternal();
|
||||||
int CompressFiles(const char* outFileName, const char* toplevel,
|
int CompressFiles(const char* outFileName, const char* toplevel,
|
||||||
const std::vector<std::string>& files);
|
const std::vector<std::string>& files);
|
||||||
virtual const char* GetOutputExtension() { return "zip"; }
|
virtual const char* GetOutputExtension() { return "zip"; }
|
||||||
|
|
Loading…
Reference in New Issue