diff options
author | Eric NOULARD <eric.noulard@gmail.com> | 2012-01-02 23:54:08 (GMT) |
---|---|---|
committer | Eric NOULARD <eric.noulard@gmail.com> | 2012-01-22 12:31:24 (GMT) |
commit | 1629615a10df10296ba6588f66a680eed424f9ba (patch) | |
tree | 4a59c67918578b94dbced9f0fde63f7af3005af2 /Source/CPack | |
parent | 83e34dd9e688b4721c70c56e66629bdc2768fa77 (diff) | |
download | CMake-1629615a10df10296ba6588f66a680eed424f9ba.zip CMake-1629615a10df10296ba6588f66a680eed424f9ba.tar.gz CMake-1629615a10df10296ba6588f66a680eed424f9ba.tar.bz2 |
CPack Documentation extraction from CMake script begins to work
- Enhance extract doc parser. Seems robust now. The legacy
module documentation parser works as before ignoring
the new markup.
- Proof of concept for CPack (generic), CPack RPM and CPack Deb
generator for macro and variables.
Try cpack --help-command and cpack --help-variables
Diffstat (limited to 'Source/CPack')
-rw-r--r-- | Source/CPack/cmCPackDocumentMacros.cxx | 80 | ||||
-rw-r--r-- | Source/CPack/cmCPackDocumentVariables.cxx | 24 | ||||
-rw-r--r-- | Source/CPack/cpack.cxx | 103 |
3 files changed, 75 insertions, 132 deletions
diff --git a/Source/CPack/cmCPackDocumentMacros.cxx b/Source/CPack/cmCPackDocumentMacros.cxx index 1ff0351..8752e56 100644 --- a/Source/CPack/cmCPackDocumentMacros.cxx +++ b/Source/CPack/cmCPackDocumentMacros.cxx @@ -3,76 +3,14 @@ void cmCPackDocumentMacros::GetMacrosDocumentation( std::vector<cmDocumentationEntry>& v) { - cmDocumentationEntry e("cpack_add_component", - "Describes a CPack installation component " - "named by the COMPONENT argument to a CMake INSTALL command.", - " cpack_add_component(compname\n" - " [DISPLAY_NAME name]\n" - " [DESCRIPTION description]\n" - " [HIDDEN | REQUIRED | DISABLED ]\n" - " [GROUP group]\n" - " [DEPENDS comp1 comp2 ... ]\n" - " [INSTALL_TYPES type1 type2 ... ]\n" - " [DOWNLOADED]\n" - " [ARCHIVE_FILE filename])\n" - "\n" - "The cmake_add_component command describes an installation" - "component, which the user can opt to install or remove as part of" - " the graphical installation process. compname is the name of the " - "component, as provided to the COMPONENT argument of one or more " - "CMake INSTALL commands." - "\n" - "DISPLAY_NAME is the displayed name of the component, used in " - "graphical installers to display the component name. This value " - "can be any string." - "\n" - "DESCRIPTION is an extended description of the component, used in " - "graphical installers to give the user additional information about " - "the component. Descriptions can span multiple lines using \"\\n\" " - " as the line separator. Typically, these descriptions should be no " - "more than a few lines long." - "\n" - "HIDDEN indicates that this component will be hidden in the " - "graphical installer, so that the user cannot directly change " - "whether it is installed or not." - "\n" - "REQUIRED indicates that this component is required, and therefore " - "will always be installed. It will be visible in the graphical " - "installer, but it cannot be unselected. (Typically, required " - "components are shown greyed out)." - "\n" - "DISABLED indicates that this component should be disabled " - "(unselected) by default. The user is free to select this component " - "for installation, unless it is also HIDDEN." - "\n" - "DEPENDS lists the components on which this component depends. If " - "this component is selected, then each of the components listed " - "must also be selected. The dependency information is encoded " - "within the installer itself, so that users cannot install " - "inconsistent sets of components." - "\n" - "GROUP names the component group of which this component is a " - "part. If not provided, the component will be a standalone " - "component, not part of any component group. Component groups are " - "described with the cpack_add_component_group command, detailed" - "below." - "\n" - "INSTALL_TYPES lists the installation types of which this component " - "is a part. When one of these installations types is selected, this " - "component will automatically be selected. Installation types are" - "described with the cpack_add_install_type command, detailed below." - "\n" - "DOWNLOADED indicates that this component should be downloaded " - "on-the-fly by the installer, rather than packaged in with the " - "installer itself. For more information, see the " - "cpack_configure_downloads command." - "\n" - "ARCHIVE_FILE provides a name for the archive file created by CPack " - "to be used for downloaded components. If not supplied, CPack will " - "create a file with some name based on CPACK_PACKAGE_FILE_NAME and " - "the name of the component. See cpack_configure_downloads for more " - "information." -); - + // Commented-out example of use + // + // cmDocumentationEntry e("cpack_<macro>", + // "Brief Description" + // "which may be on several lines.", + // "Long description in pre-formatted format" + // " blah\n" + // " blah\n" + //); //v.push_back(e); } diff --git a/Source/CPack/cmCPackDocumentVariables.cxx b/Source/CPack/cmCPackDocumentVariables.cxx index ab806d2..8b60d5f 100644 --- a/Source/CPack/cmCPackDocumentVariables.cxx +++ b/Source/CPack/cmCPackDocumentVariables.cxx @@ -6,19 +6,19 @@ void cmCPackDocumentVariables::DefineVariables(cmake* cm) // Subsection: variables defined/used by cpack, // which are common to all CPack generators - cm->DefineProperty - ("CPACK_PACKAGE_VENDOR", cmProperty::VARIABLE, - "The name of the package vendor.", - "If not specified, defaults to \"Humanity\"." - "", false, - "Variables common to all CPack generators"); +// cm->DefineProperty +// ("CPACK_PACKAGE_VENDOR", cmProperty::VARIABLE, +// "The name of the package vendor.", +// "If not specified, defaults to \"Humanity\"." +// "", false, +// "Variables common to all CPack generators"); // Subsection: variables defined/used by cpack, // which are specific to one CPack generator - cm->DefineProperty - ("CPACK_RPM_PACKAGE_NAME", cmProperty::VARIABLE, - "RPM specific package name.", - "If not specified, defaults to CPACK_PACKAGE_NAME." - "", false, - "Variables specific to a CPack generator"); +// cm->DefineProperty +// ("CPACK_RPM_PACKAGE_NAME", cmProperty::VARIABLE, +// "RPM specific package name.", +// "If not specified, defaults to CPACK_PACKAGE_NAME." +// "", false, +// "Variables specific to a CPack generator"); } diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 8e59fa0..4117971 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -303,29 +303,30 @@ int main (int argc, char *argv[]) help = false; } - if ( parsed && !help ) + // find out which system cpack is running on, so it can setup the search + // paths, so FIND_XXX() commands can be used in scripts + // This part is used for cpack documentation lookup as well. + cminst.AddCMakePaths(); + std::string systemFile = + globalMF->GetModulesFile("CMakeDetermineSystem.cmake"); + if (!globalMF->ReadListFile(0, systemFile.c_str())) { - // find out which system cpack is running on, so it can setup the search - // paths, so FIND_XXX() commands can be used in scripts - cminst.AddCMakePaths(); - std::string systemFile = - globalMF->GetModulesFile("CMakeDetermineSystem.cmake"); - if (!globalMF->ReadListFile(0, systemFile.c_str())) - { - cmCPack_Log(&log, cmCPackLog::LOG_ERROR, - "Error reading CMakeDetermineSystem.cmake" << std::endl); - return 1; - } + cmCPack_Log(&log, cmCPackLog::LOG_ERROR, + "Error reading CMakeDetermineSystem.cmake" << std::endl); + return 1; + } - systemFile = - globalMF->GetModulesFile("CMakeSystemSpecificInformation.cmake"); - if (!globalMF->ReadListFile(0, systemFile.c_str())) - { - cmCPack_Log(&log, cmCPackLog::LOG_ERROR, - "Error reading CMakeSystemSpecificInformation.cmake" << std::endl); - return 1; - } + systemFile = + globalMF->GetModulesFile("CMakeSystemSpecificInformation.cmake"); + if (!globalMF->ReadListFile(0, systemFile.c_str())) + { + cmCPack_Log(&log, cmCPackLog::LOG_ERROR, + "Error reading CMakeSystemSpecificInformation.cmake" << std::endl); + return 1; + } + if ( parsed && !help ) + { if ( cmSystemTools::FileExists(cpackConfigFile.c_str()) ) { cpackConfigFile = @@ -519,43 +520,47 @@ int main (int argc, char *argv[]) doc.SetSection("Description",cmDocumentationDescription); doc.PrependSection("Options",cmDocumentationOptions); + // statically (in C++ code) defined variables cmCPackDocumentVariables::DefineVariables(&cminst); std::vector<cmDocumentationEntry> commands; - cminst.AddCMakePaths(); - std::string systemFile = - globalMF->GetModulesFile("CMakeDetermineSystem.cmake"); - if (!globalMF->ReadListFile(0, systemFile.c_str())) - { - cmCPack_Log(&log, cmCPackLog::LOG_ERROR, - "Error reading CMakeDetermineSystem.cmake" << std::endl); - return 1; - } - - systemFile = - globalMF->GetModulesFile("CMakeSystemSpecificInformation.cmake"); - if (!globalMF->ReadListFile(0, systemFile.c_str())) - { - cmCPack_Log(&log, cmCPackLog::LOG_ERROR, - "Error reading CMakeSystemSpecificInformation.cmake" - << std::endl); - return 1; - } - std::string cpFile = globalMF->GetModulesFile("CPack.cmake"); - doc.getStructuredDocFromFile(cpFile.c_str(), - commands,&cminst,"Variables common to all CPack generators"); - cpFile = globalMF->GetModulesFile("CPackComponent.cmake"); - doc.getStructuredDocFromFile(cpFile.c_str(), - commands,&cminst,"Variables common to all CPack generators"); - cpFile = globalMF->GetModulesFile("CPackRPM.cmake"); - doc.getStructuredDocFromFile(cpFile.c_str(), - commands,&cminst,"Variables specific to a CPack generator"); + typedef std::pair<std::string,std::string> docModuleSectionPair_t; + typedef std::list<docModuleSectionPair_t> docedModulesList_t; + docedModulesList_t docedModList; + docModuleSectionPair_t docPair; + std::string docedFile; + + // build the list of files to be parsed for documentation + // extraction + docPair.first = "CPack.cmake"; + docPair.second = "Variables common to all CPack generators"; + docedModList.push_back(docPair); + docPair.first = "CPackComponent.cmake"; + docedModList.push_back(docPair); + docPair.first = "CPackRPM.cmake"; + docPair.second = "Variables specific to a CPack generator"; + docedModList.push_back(docPair); + docPair.first = "CPackDeb.cmake"; + docedModList.push_back(docPair); + + // parse the files for documentation. + for (docedModulesList_t::iterator it = docedModList.begin(); + it!= docedModList.end(); ++it) + { + docedFile = globalMF->GetModulesFile((it->first).c_str()); + if (docedFile.length()!=0) + { + doc.GetStructuredDocFromFile(docedFile.c_str(), + commands,&cminst,(it->second).c_str()); + } + } std::map<std::string,cmDocumentationSection *> propDocs; cminst.GetPropertiesDocumentation(propDocs); doc.SetSections(propDocs); - cminst.GetCommandDocumentation(commands); + cminst.GetCommandDocumentation(commands,true,false); + // statically (in C++ code) defined macros/commands cmCPackDocumentMacros::GetMacrosDocumentation(commands); doc.SetSection("Commands",commands); |