| 62 | } |
| 63 | |
| 64 | int cmCPackAppImageGenerator::PackageFiles() |
| 65 | { |
| 66 | cmCPackLogger(cmCPackLog::LOG_OUTPUT, |
| 67 | "AppDir: \"" << this->toplevel << "\"" << std::endl); |
| 68 | |
| 69 | // Desktop file must be in the toplevel dir |
| 70 | auto const desktopFile = FindDesktopFile(); |
| 71 | if (!desktopFile) { |
| 72 | cmCPackLogger(cmCPackLog::LOG_WARNING, |
| 73 | "A desktop file is required to build an AppImage, make sure " |
| 74 | "it's listed for install()." |
| 75 | << std::endl); |
| 76 | return 0; |
| 77 | } |
| 78 | |
| 79 | { |
| 80 | cmCPackLogger(cmCPackLog::LOG_OUTPUT, |
| 81 | "Found Desktop file: \"" << desktopFile.value() << "\"" |
| 82 | << std::endl); |
| 83 | std::string desktopSymLink = this->toplevel + "/" + |
| 84 | cmSystemTools::GetFilenameName(desktopFile.value()); |
| 85 | cmCPackLogger(cmCPackLog::LOG_OUTPUT, |
| 86 | "Desktop file destination: \"" << desktopSymLink << "\"" |
| 87 | << std::endl); |
| 88 | auto status = cmSystemTools::CreateSymlink( |
| 89 | cmSystemTools::RelativePath(toplevel, *desktopFile), desktopSymLink); |
| 90 | if (status.IsSuccess()) { |
| 91 | cmCPackLogger(cmCPackLog::LOG_DEBUG, |
| 92 | "Desktop symbolic link created successfully." |
| 93 | << std::endl); |
| 94 | } else { |
| 95 | cmCPackLogger(cmCPackLog::LOG_ERROR, |
| 96 | "Error creating symbolic link." << status.GetString() |
| 97 | << std::endl); |
| 98 | return 0; |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | auto const desktopEntry = ParseDesktopFile(*desktopFile); |
| 103 | |
| 104 | { |
| 105 | // Prepare Icon file |
| 106 | auto const iconValue = desktopEntry.find("Icon"); |
| 107 | if (iconValue == desktopEntry.end()) { |
| 108 | cmCPackLogger(cmCPackLog::LOG_ERROR, |
| 109 | "An Icon key is required to build an AppImage, make sure " |
| 110 | "the desktop file has a reference to one." |
| 111 | << std::endl); |
| 112 | return 0; |
| 113 | } |
| 114 | |
| 115 | auto icon = this->GetOption("CPACK_PACKAGE_ICON"); |
| 116 | if (!icon) { |
| 117 | cmCPackLogger(cmCPackLog::LOG_ERROR, |
| 118 | "CPACK_PACKAGE_ICON is required to build an AppImage." |
| 119 | << std::endl); |
| 120 | return 0; |
| 121 | } |
nothing calls this directly
no test coverage detected