summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2007-02-13 19:13:51 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2007-02-13 19:13:51 (GMT)
commitf2c0dbd164796aabe5397f4a053c22fe76030b80 (patch)
treea8d09cd4d91520a25a64c1cf2cccef9182652fd7 /Source
parent4904db4c8f856213fad9976c5b5ce9071dd08bdf (diff)
downloadCMake-f2c0dbd164796aabe5397f4a053c22fe76030b80.zip
CMake-f2c0dbd164796aabe5397f4a053c22fe76030b80.tar.gz
CMake-f2c0dbd164796aabe5397f4a053c22fe76030b80.tar.bz2
ENH: More work on the packaging. Add Applicaitons, add icons, etc
Diffstat (limited to 'Source')
-rw-r--r--Source/CPack/cmCPackOSXX11Generator.cxx47
-rw-r--r--Source/CPack/cmCPackOSXX11Generator.h3
2 files changed, 48 insertions, 2 deletions
diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx
index 95e2801..0a63dd3 100644
--- a/Source/CPack/cmCPackOSXX11Generator.cxx
+++ b/Source/CPack/cmCPackOSXX11Generator.cxx
@@ -75,7 +75,16 @@ int cmCPackOSXX11Generator::CompressFiles(const char* outFileName,
}
}
+ // Disk image directories
+ std::string diskImageDirectory = toplevel;
+ std::string diskImageBackgroundImageDir
+ = diskImageDirectory + "/.background";
+
+
+ // App bundle directories
std::string packageDirFileName = toplevel;
+ packageDirFileName += "/";
+ packageDirFileName += this->GetOption("CPACK_PACKAGE_FILE_NAME");
packageDirFileName += ".app";
std::string contentsDirectory = packageDirFileName + "/Contents";
std::string resourcesDirectory = contentsDirectory + "/Resources";
@@ -84,7 +93,33 @@ int cmCPackOSXX11Generator::CompressFiles(const char* outFileName,
const char* dir = resourcesDirectory.c_str();
const char* appdir = appDirectory.c_str();
const char* contDir = contentsDirectory.c_str();
+ const char* iconFile = this->GetOption("CPACK_PACKAGE_ICON");
+ if ( iconFile )
+ {
+ std::string iconFileName = cmsys::SystemTools::GetFilenameName(
+ iconFile);
+ if ( !cmSystemTools::FileExists(iconFile) )
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find icon file: "
+ << iconFile << ". Please check CPACK_PACKAGE_ICON setting."
+ << std::endl);
+ return 0;
+ }
+ std::string destFileName = resourcesDirectory + "/" + iconFileName;
+ this->ConfigureFile(iconFile, destFileName.c_str(), true);
+ this->SetOptionIfNotSet("CPACK_APPLE_GUI_ICON", iconFileName.c_str());
+ }
+
+ std::string applicationsLinkName = diskImageDirectory + "/Applications";
+ cmSystemTools::CreateSymlink("/Applications", applicationsLinkName.c_str());
+
if (
+ !this->CopyResourcePlistFile("VolumeIcon.icns", diskImageDirectory.c_str(),
+ ".VolumeIcon.icns", true ) ||
+ !this->CopyResourcePlistFile("DS_Store", diskImageDirectory.c_str(),
+ ".DS_Store", true ) ||
+ !this->CopyResourcePlistFile("background.png",
+ diskImageBackgroundImageDir.c_str(), "background.png", true ) ||
!this->CopyResourcePlistFile("RuntimeScript", dir) ||
!this->CopyResourcePlistFile("OSXX11.Info.plist", contDir,
"Info.plist" ) ||
@@ -102,9 +137,11 @@ int cmCPackOSXX11Generator::CompressFiles(const char* outFileName,
tmpFile += "/hdiutilOutput.log";
cmOStringStream dmgCmd;
dmgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM_DISK_IMAGE")
- << "\" create -ov -format UDZO -srcfolder \"" << packageDirFileName
+ << "\" create -ov -format UDZO -srcfolder \"" << diskImageDirectory.c_str()
<< "\" \"" << outFileName << "\"";
int retVal = 1;
+ cmCPackLogger(cmCPackLog::LOG_VERBOSE,
+ "Compress disk image using command: " << dmgCmd.str().c_str() << std::endl);
bool res = cmSystemTools::RunSingleCommand(dmgCmd.str().c_str(), &output,
&retVal, 0, this->GeneratorVerbose, 0);
if ( !res || retVal )
@@ -218,3 +255,11 @@ bool cmCPackOSXX11Generator::CopyResourcePlistFile(const char* name,
return true;
}
+//----------------------------------------------------------------------
+const char* cmCPackOSXX11Generator::GetInstallPrefix()
+{
+ this->InstallPrefix = "/";
+ this->InstallPrefix += this->GetOption("CPACK_PACKAGE_FILE_NAME");
+ this->InstallPrefix += ".app/Contents/Resources";
+ return this->InstallPrefix.c_str();
+}
diff --git a/Source/CPack/cmCPackOSXX11Generator.h b/Source/CPack/cmCPackOSXX11Generator.h
index caa454b..8d9fef5 100644
--- a/Source/CPack/cmCPackOSXX11Generator.h
+++ b/Source/CPack/cmCPackOSXX11Generator.h
@@ -40,12 +40,13 @@ protected:
virtual int InitializeInternal();
int CompressFiles(const char* outFileName, const char* toplevel,
const std::vector<std::string>& files);
+ virtual const char* GetInstallPrefix();
virtual const char* GetOutputExtension() { return ".dmg"; }
- virtual const char* GetInstallPrefix() { return ".app/Contents/Resources"; }
//bool CopyCreateResourceFile(const char* name, const char* dir);
bool CopyResourcePlistFile(const char* name, const char* dir,
const char* outputFileName = 0, bool copyOnly = false);
+ std::string InstallPrefix;
};
#endif