diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2007-02-13 19:13:51 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2007-02-13 19:13:51 (GMT) |
commit | f2c0dbd164796aabe5397f4a053c22fe76030b80 (patch) | |
tree | a8d09cd4d91520a25a64c1cf2cccef9182652fd7 | |
parent | 4904db4c8f856213fad9976c5b5ce9071dd08bdf (diff) | |
download | CMake-f2c0dbd164796aabe5397f4a053c22fe76030b80.zip CMake-f2c0dbd164796aabe5397f4a053c22fe76030b80.tar.gz CMake-f2c0dbd164796aabe5397f4a053c22fe76030b80.tar.bz2 |
ENH: More work on the packaging. Add Applicaitons, add icons, etc
-rw-r--r-- | Modules/CPack.DS_Store.in | bin | 0 -> 12292 bytes | |||
-rw-r--r-- | Modules/CPack.VolumeIcon.icns.in | bin | 0 -> 45739 bytes | |||
-rw-r--r-- | Modules/CPack.background.png.in | bin | 0 -> 50482 bytes | |||
-rw-r--r-- | Modules/CPack.cmake | 3 | ||||
-rw-r--r-- | Source/CPack/cmCPackOSXX11Generator.cxx | 47 | ||||
-rw-r--r-- | Source/CPack/cmCPackOSXX11Generator.h | 3 |
6 files changed, 51 insertions, 2 deletions
diff --git a/Modules/CPack.DS_Store.in b/Modules/CPack.DS_Store.in Binary files differnew file mode 100644 index 0000000..5be0eeb --- /dev/null +++ b/Modules/CPack.DS_Store.in diff --git a/Modules/CPack.VolumeIcon.icns.in b/Modules/CPack.VolumeIcon.icns.in Binary files differnew file mode 100644 index 0000000..c59217e --- /dev/null +++ b/Modules/CPack.VolumeIcon.icns.in diff --git a/Modules/CPack.background.png.in b/Modules/CPack.background.png.in Binary files differnew file mode 100644 index 0000000..3fa92b5 --- /dev/null +++ b/Modules/CPack.background.png.in diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 50c55a7..7f496aa 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -123,6 +123,9 @@ cpack_set_if_not_set(CPACK_OUTPUT_CONFIG_FILE cpack_set_if_not_set(CPACK_SOURCE_OUTPUT_CONFIG_FILE "${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake") +cpack_set_if_not_set(CPACK_USE_DESTDIR ON) +cpack_set_if_not_set(CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + cpack_encode_variables() CONFIGURE_FILE("${cpack_input_file}" "${CPACK_OUTPUT_CONFIG_FILE}" @ONLY IMMEDIATE) 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 |