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 6da579f74..165c68f26 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -26,9 +26,10 @@ 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' # ---------------------------------------------------------------------------- -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') 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