Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++ Doxygen documentation & many doc improvements #4191

Merged
merged 37 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
21a10b8
initial doxyfile without adjustments
Wumpf Nov 9, 2023
6922c85
a few basic doxygen settings
Wumpf Nov 9, 2023
be22f80
doxygen theming
Wumpf Nov 9, 2023
cd58599
started a readme for writing docs
Wumpf Nov 9, 2023
f48ed64
show images in C++ docs
Wumpf Nov 9, 2023
9b51681
remove unrecognized tag from markdown
Wumpf Nov 9, 2023
34f91e1
remove project brief, disable warning on undocumented
Wumpf Nov 9, 2023
48d75f4
use \param instead of @param
Wumpf Nov 9, 2023
10d7d7a
copy files from doxygen-awesome instead of using a submodule
Wumpf Nov 9, 2023
14b56bf
add theme dark/light toggle
Wumpf Nov 9, 2023
4f878a1
extension for copy code block button
Wumpf Nov 9, 2023
95b9e04
remove unnecessary overloads in translation_rotation_scale3d and star…
Wumpf Nov 9, 2023
fcd65ce
more translation/rotation/scale3d doc fixes
Wumpf Nov 9, 2023
5c3f92c
fix doxygen issues with transltation_and_mat3
Wumpf Nov 9, 2023
4bdc20c
continue fixing transform docs. bring back actually needed overloads
Wumpf Nov 9, 2023
eb6f0a0
enable auto-brief
Wumpf Nov 9, 2023
9da559f
file root is rerun_cpp/src now
Wumpf Nov 9, 2023
225fe43
improve recording stream documentation
Wumpf Nov 9, 2023
1df02e8
fix header display, enable STL support, ignore local classes, don't s…
Wumpf Nov 9, 2023
5b00d0f
hide AsComponents implementations and forward declarations
Wumpf Nov 9, 2023
5a72845
some small python fixes along the way
Wumpf Nov 9, 2023
733c8ce
fix a bunch of syntax breaking typos etc. in transform
Wumpf Nov 9, 2023
f0fd5c2
even more transform fixes
Wumpf Nov 9, 2023
e1c31d3
remove settings from doxyfile my doxygen version doesn't know
Wumpf Nov 9, 2023
8848eb6
remove various types from documentation that are cluttering too much.…
Wumpf Nov 9, 2023
3fa3349
document RerunGlobalConfig
Wumpf Nov 9, 2023
8598e3e
fix incorrect links, document SpawnOptions
Wumpf Nov 9, 2023
3362989
make rerun_cpp's readme the main documentation page, disable comment …
Wumpf Nov 9, 2023
bcf4d12
check doxygen on ci
Wumpf Nov 9, 2023
9ff4b13
fix todo note
Wumpf Nov 9, 2023
b8a3817
spell checker words
Wumpf Nov 9, 2023
cb9170d
remove paranthesis that confuse doxygen
Wumpf Nov 9, 2023
8c27ae2
lint script ignore doxygen-awesome
Wumpf Nov 10, 2023
551fdb8
fix rust warning
Wumpf Nov 10, 2023
0ffaf72
bring back gcc workaround
Wumpf Nov 10, 2023
d348e2c
python formatting
Wumpf Nov 10, 2023
aa7c49e
exception for large doxyfile
Wumpf Nov 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/cpp_matrix_full.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"name": "Linux x64, C++17",
"runs_on": "ubuntu-latest-16-cores",
"cache_key": "build-linux",
"extra_env_vars": "RERUN_USE_ASAN=1 RERUN_SET_CXX_VERSION=17"
"extra_env_vars": "RERUN_USE_ASAN=1 RERUN_SET_CXX_VERSION=17",
"additional_commands": "pixi run cpp-docs"
},
{
"name": "Linux x64, C++20",
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/cpp_matrix_partial.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"name": "Linux x64",
"runs_on": "ubuntu-latest-16-cores",
"cache_key": "build-linux",
"extra_env_vars": ""
"extra_env_vars": "",
"additional_commands": "pixi run cpp-docs"
}
]
}
1 change: 1 addition & 0 deletions .github/workflows/reusable_checks_cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,4 @@ jobs:
pixi run cpp-clean
${{ matrix.extra_env_vars }} RERUN_WERROR=ON pixi run cpp-build-all
${{ matrix.extra_env_vars }} RERUN_WERROR=ON pixi run cpp-test
${{ matrix.additional_commands }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ crates/re_types_builder/source_hash.txt
**/cmake_install.cmake
_deps
**/.cache/
**/rerun_cpp/docs/html

# Rust compile target directory:
**/target
Expand Down
10 changes: 10 additions & 0 deletions crates/re_types_builder/src/codegen/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,16 @@ impl RerunImageUrl<'_> {

stack
}

pub fn markdown_tag(&self) -> String {
let RerunImageUrl {
name,
hash,
max_width: _,
extension,
} = *self;
format!("![image](https://static.rerun.io/{name}/{hash}/full.{extension})")
}
}

pub struct Example<'a> {
Expand Down
5 changes: 4 additions & 1 deletion crates/re_types_builder/src/codegen/cpp/forward_decl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::collections::{BTreeMap, BTreeSet};
use proc_macro2::{Ident, TokenStream};
use quote::{format_ident, quote};

use super::NEWLINE_TOKEN;
use super::{quote_hide_from_docs, NEWLINE_TOKEN};

/// A C++ forward declaration.
#[derive(Debug, Clone)]
Expand Down Expand Up @@ -64,7 +64,10 @@ impl quote::ToTokens for ForwardDecl {
quote! { class #name; }
}
ForwardDecl::TemplateClass(name) => {
// Doxygen likes including template declarations in the docs.
let hide_from_docs = quote_hide_from_docs();
quote! {
#hide_from_docs
template<typename T> class #name;
#NEWLINE_TOKEN
#NEWLINE_TOKEN
Expand Down
34 changes: 28 additions & 6 deletions crates/re_types_builder/src/codegen/cpp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@
quote! { #DOC_COMMENT_PREFIX_TOKEN #text #DOC_COMMENT_SUFFIX_TOKEN }
}

fn quote_hide_from_docs() -> TokenStream {
let comment = quote_doc_comment("\\private");
quote! {
#NEWLINE_TOKEN
#comment
}
}

fn string_from_token_stream(token_stream: &TokenStream, source_path: Option<&Utf8Path>) -> String {
let mut code = String::new();
code.push_str(&format!("// {}\n", autogen_warning!()));
Expand Down Expand Up @@ -479,6 +487,7 @@
};

let indicator_comment = quote_doc_comment("Indicator component, used to identify the archetype when converting to a list of components.");
let doc_hide_comment = quote_hide_from_docs();

let hpp = quote! {
#hpp_includes
Expand All @@ -505,10 +514,12 @@
#NEWLINE_TOKEN
#NEWLINE_TOKEN

// Instead of including as_components.hpp, simply re-declare the template since it's trivial.
// Instead of including as_components.hpp, simply re-declare the template since it's trivial
#doc_hide_comment
template<typename T>
struct AsComponents;

#doc_hide_comment
template<>
struct AsComponents<archetypes::#type_ident> {
#serialize_hpp
Expand Down Expand Up @@ -983,6 +994,7 @@
};

let swap_comment = quote_comment("This bitwise swap would fail for self-referential types, but we don't have any of those.");
let hide_from_docs_comment = quote_hide_from_docs();

let methods_hpp = methods.iter().map(|m| m.to_hpp_tokens());
let hpp = quote! {
Expand All @@ -993,10 +1005,12 @@
namespace rerun {
namespace #namespace_ident {
namespace detail {
#hide_from_docs_comment
enum class #tag_typename : uint8_t {
#(#tag_fields)*
};

#hide_from_docs_comment
union #data_typename {
#(#enum_data_declarations;)*

Expand Down Expand Up @@ -2076,10 +2090,7 @@
let mut examples = examples.into_iter().peekable();
while let Some(example) = examples.next() {
let ExampleInfo {
name,
title,
image: _, // TODO(andreas): Include images in doc
..
name, title, image, ..
} = &example.base;

for line in &example.lines {
Expand All @@ -2091,7 +2102,18 @@
} else {
lines.push(format!("### `{name}`:"));
}
lines.push("```cpp,ignore".into());

if let Some(image) = image {
match image {
super::common::ImageUrl::Rerun(image) => lines.push(image.markdown_tag()),
super::common::ImageUrl::Other(url) => {
lines.push(format!("![example image]({url})"))

Check failure on line 2110 in crates/re_types_builder/src/codegen/cpp/mod.rs

View workflow job for this annotation

GitHub Actions / Checks / Rust lints (fmt, check, cranky, tests, doc)

consider adding a `;` to the last statement for consistent formatting
}
}
lines.push(String::new());
}

lines.push("```cpp".into());
lines.extend(example.lines.iter().cloned());
lines.push("```".into());
if examples.peek().is_some() {
Expand Down
3 changes: 3 additions & 0 deletions docs/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"colormaps",
"colorrgba",
"comms",
"cond",
"constexpr",
"consts",
"controlnet",
Expand All @@ -86,6 +87,7 @@
"dont",
"downscaled",
"downscaling",
"Doxygen",
"drawables",
"DRERUN",
"dtype",
Expand All @@ -97,6 +99,7 @@
"ehttp",
"Eigen",
"emilk",
"endcond",
"enumflags",
"everytime",
"ewebsock",
Expand Down
83 changes: 83 additions & 0 deletions pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ cpp-log-benchmark = { cmd = "export RERUN_STRICT=1 && ./build/tests/cpp/log_benc
"cpp-build-log-benchmark",
] }
cpp-build-and-test-all = { depends_on = ["cpp-build-all", "cpp-test"] }
cpp-docs = { cmd = "doxygen rerun_cpp/docs/Doxyfile" }

[target.win-64.tasks]
cpp-prepare-msvc = "cmake -G 'Visual Studio 17 2022' -B build-msvc -S ."
Expand Down Expand Up @@ -103,6 +104,9 @@ typing_extensions = ">4.5"
typos = ">=1.16.20"
wheel = ">=0.38,<0.39"
ninja = "1.11.1"
# Make sure to use a version that is compatible with
# the theme we're using, see https://github.com/jothepro/doxygen-awesome-css/blob/v2.2.1/README.md
doxygen = "1.9.7.*"

[target.linux-64.dependencies]
patchelf = ">=0.17"
Expand Down
17 changes: 16 additions & 1 deletion rerun_cpp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ The Rerun C++ SDK allows logging data to Rerun directly from C++.

Read the [getting started guide](https://www.rerun.io/docs/getting-started/cpp) for information on how to use the Rerun C++ SDK.

## Building Blocks

The most important type in the SDK is the `rerun::RecordingStream`.
It allows you to connect to the Rerun Viewer and send data.

The built-in types are distributed to the respective namespaces:
* `rerun::archetypes`
* `rerun::components`
* `rerun::datatypes`

If you include `rerun.hpp`, all archetypes and selected components become part of the `rerun` namespace.

Check the [general doc page on types](https://www.rerun.io/docs/reference/types) to learn more.


## Build & Distribution

### Overview
Expand All @@ -25,7 +40,7 @@ From a build system perspective, the SDK consists of three dependencies:
* See [Install arrow-cpp](https://www.rerun.io/docs/howto/arrow-cpp-install) for how to install this library


### SDK bundle (`rerun_cpp_sdk.zip`)
### SDK bundle `rerun_cpp_sdk.zip`

For convenience, Rerun provides a C++ SDK bundle with every release.
(this includes our regular [Development Builds](https://github.com/rerun-io/rerun/releases/tag/prerelease)!)
Expand Down
Loading
Loading