![]() Why Sphinx?ĭoxygen has been around for a couple of decades and is a stable, feature-rich tool for generating documentation. We’ll also integrate this process into a CMake build system so that we have a unified workflow.įor an example of a real-world project whose documentation is built like this, see fmtlib. ![]() This post will show you how to use Sphinx to generate attractive, functional documentation for C++ libraries, supplied with information from Doxygen. Tools can’t solve this problem in themselves, but they can ease the pain. Project-specific CMake modules (such as various FindPackage.cmake files) are placed in a modules/ directory in the project root and then added to CMAKE_MODULE_PATH in the top-level CMakeLists.txt file: set ( CMAKE_MODULE_PATH $ ) a. When using target_link_libraries (), prefer to specify the PUBLIC|PRIVATE|INTERFACE distinction explicitly. Prefer to use the new, non-global CMake workflow, so target_include_directories (), target_compile_definitions () and target_compile_options () instead of include_directories (), add_definitions () and modifying the global CMAKE_CXX_FLAGS. Source and header lists should be ordered alphabetically, subdirectories last, preferably separated by a single empty line. set ()) have trailing parenthesis on the same line as last parameter, not on separate line: set ( MyUtilityLibrary_SRCS Filesystem.cpp IniParser.cpp Utility.cpp ) variable holding all sources for target MyUtilityLibrary will be named MyUtilityLibrary_SRCS. Variables are mostly uppercase with underscores between words, except for variables with direct relation to any named target - then they have the target name as prefix with no case change, followed with underscore, the rest of variable name is uppercase, e.g. add_executable (), set ()) are lowercase, keywords (e.g. CMake codeĪll CMake functions and macros (e.g. The text (and code) should be wrapped around 80th column to make it possible to view more files alongside each other without breaking their layout, long single-line statements are allowed unless it hurts readability. Sentences are always separated with only one space. Logic sections of the code and documentation paragraphs are always separated with not more than one empty line to save vertical space. If CR+LF line endings are required for particular files, they have to be explicitly listed in. Files in the repository should be with LF line ending by default. Trailing whitespaces are not permitted (and you should set up your Git installation to warn about that). encouraging C++11 and new-style CMake workflow instead of C++03 and pre-3.0 CMake styleĮach file must have one blank line at the end (Git will warn you in the diff if it's not the case), indentation is done exclusively with spaces (4 spaces).reducing ambiguity and mental overhead with clearly defined indentation and spacing rules.vertical and horizontal compression, fitting more code on a screen while still making it possible to have more files open side by side by wrapping on the 80th column.In general, the main aim of this style is: Chromium: http:/ / / developers/ coding-style/ cpp-dos-and-donts.LLVM: http:/ / / docs/ CodingStandards.html.You can also take inspiration from other thoroughly written coding style guidelines of large projects: Nothing is worse than rule that hurts productivity instead of improving it. Please note that if you have a good excuse to either break the rules or modify them, feel free to do it (and update this guide accordingly, if appropriate). Backwards compatibility and experimental features.Configuration value parsers and writers.Forward declarations and forward declaration headers.Coding style and best practices to preserve maintainability and consistent style across whole project.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |