From ae002a1992637d970b77bee89141ce0b4ab517ce Mon Sep 17 00:00:00 2001 From: Luca Cominardi Date: Fri, 29 Sep 2023 10:01:46 +0200 Subject: [PATCH 1/3] Add .readthedocs.yaml file --- .readthedocs.yaml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .readthedocs.yaml diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 000000000..bc2b3c653 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,22 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Set the version of Python and other tools you might need +build: + os: ubuntu-22.04 + tools: + python: "3.11" + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: docs/conf.py + +# We recommend specifying your dependencies to enable reproducible builds: +# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html +python: + install: + - requirements: docs/requirements.txt \ No newline at end of file From 752bbc6051ff4eca2e554549ffabc941fb238790 Mon Sep 17 00:00:00 2001 From: OlivierHecart Date: Fri, 29 Sep 2023 14:14:54 +0200 Subject: [PATCH 2/3] Docs fix (#182) --- build.rs | 22 ++++++++++++++++++++++ cbindgen.toml | 16 +--------------- docs/conf.py | 1 + include/zenoh_commons.h | 17 +++++++++++++++++ include/zenoh_concrete.h | 4 ++++ 5 files changed, 45 insertions(+), 15 deletions(-) diff --git a/build.rs b/build.rs index 7764f23bb..17dde1894 100644 --- a/build.rs +++ b/build.rs @@ -4,6 +4,24 @@ use std::{borrow::Cow, collections::HashMap, io::BufWriter, path::Path}; const GENERATION_PATH: &str = "include/zenoh-gen.h"; const SPLITGUIDE_PATH: &str = "splitguide.yaml"; +const HEADER: &str = r"// +// Copyright (c) 2022 ZettaScale Technology +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 +// which is available at https://www.apache.org/licenses/LICENSE-2.0. +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// +// Contributors: +// ZettaScale Zenoh Team, +// +#ifdef DOCS +#define ALIGN(n) +#define ZENOHC_API +#endif +"; fn main() { cbindgen::generate(std::env::var("CARGO_MANIFEST_DIR").unwrap()) @@ -100,6 +118,10 @@ fn split_bindings(split_guide: &SplitGuide) -> Result<(), String> { (name.as_str(), BufWriter::new(file)) }) .collect::>(); + for file in files.values_mut() { + file.write_all(HEADER.as_bytes()) + .map_err(|e| e.to_string())?; + } let mut records = group_tokens(Tokenizer { filename: GENERATION_PATH, inner: &bindings, diff --git a/cbindgen.toml b/cbindgen.toml index fd2ab44c9..49713759f 100644 --- a/cbindgen.toml +++ b/cbindgen.toml @@ -24,21 +24,7 @@ language = "C" ############## Options for Wrapping the Contents of the Header ################# -header = """ -// -// Copyright (c) 2022 ZettaScale Technology -// -// This program and the accompanying materials are made available under the -// terms of the Eclipse Public License 2.0 which is available at -// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 -// which is available at https://www.apache.org/licenses/LICENSE-2.0. -// -// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -// -// Contributors: -// ZettaScale Zenoh Team, -// -""" +# header = "/* Text to put at the beginning of the generated file. Probably a license. */" # trailer = "/* Text to put at the end of the generated file */" # include_guard = "ZENOH_FUNCTIONS" # pragma_once = true diff --git a/docs/conf.py b/docs/conf.py index 1c18dafc7..48894d533 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -26,6 +26,7 @@ extensions = ['sphinx_c_autodoc', 'sphinx_c_autodoc.napoleon'] language = 'c' c_autodoc_roots = ['../include'] +c_autodoc_compilation_args = ["-DDOCS"] # -- Options for HTML output ------------------------------------------------- html_theme = 'sphinx_rtd_theme' diff --git a/include/zenoh_commons.h b/include/zenoh_commons.h index 15385a3d8..763c267aa 100644 --- a/include/zenoh_commons.h +++ b/include/zenoh_commons.h @@ -1,3 +1,20 @@ +// +// Copyright (c) 2022 ZettaScale Technology +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 +// which is available at https://www.apache.org/licenses/LICENSE-2.0. +// +// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +// +// Contributors: +// ZettaScale Zenoh Team, +// +#ifdef DOCS +#define ALIGN(n) +#define ZENOHC_API +#endif /** * The kind of congestion control. * diff --git a/include/zenoh_concrete.h b/include/zenoh_concrete.h index 1110523db..000004c3e 100644 --- a/include/zenoh_concrete.h +++ b/include/zenoh_concrete.h @@ -11,6 +11,10 @@ // Contributors: // ZettaScale Zenoh Team, // +#ifdef DOCS +#define ALIGN(n) +#define ZENOHC_API +#endif #include #include #include From f4359fc7692085d0a48d638d900afa0f39747148 Mon Sep 17 00:00:00 2001 From: OlivierHecart Date: Fri, 29 Sep 2023 15:05:53 +0200 Subject: [PATCH 3/3] Update clang library path --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 48894d533..5b1c4d97e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -32,4 +32,4 @@ html_theme = 'sphinx_rtd_theme' # ---------------------------------------------------------------------------- -Config.set_library_file('/usr/lib/llvm-6.0/lib/libclang.so.1') +Config.set_library_file('/usr/lib/llvm-14/lib/libclang.so.1')