Skip to content

Commit

Permalink
Adds doxygen support
Browse files Browse the repository at this point in the history
  • Loading branch information
Mottl committed Aug 15, 2024
1 parent 85c5d0c commit 87e01f8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lightgbm3"
version = "1.0.4"
version = "1.0.5"
edition = "2021"
authors = [
"Dmitry Mottl <dmitry.mottl@gmail.com>",
Expand Down
3 changes: 2 additions & 1 deletion lightgbm3-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lightgbm3-sys"
version = "1.0.4"
version = "1.0.5"
edition = "2021"
authors = ["Dmitry Mottl <dmitry.mottl@gmail.com>", "vaaaaanquish <6syun9@gmail.com>"]
build = "build.rs"
Expand All @@ -17,6 +17,7 @@ libc = "0.2.155"
[build-dependencies]
cmake = "0.1.50"
bindgen = "0.69.4"
doxygen-rs = "0.4.2"

[features]
openmp = []
Expand Down
10 changes: 10 additions & 0 deletions lightgbm3-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ use std::{
process::Command,
};

#[derive(Debug)]
struct DoxygenCallback;

impl bindgen::callbacks::ParseCallbacks for DoxygenCallback {
fn process_comment(&self, comment: &str) -> Option<String> {
Some(doxygen_rs::transform(comment))
}
}

fn main() {
let target = env::var("TARGET").unwrap();
let out_dir = env::var("OUT_DIR").unwrap();
Expand Down Expand Up @@ -55,6 +64,7 @@ fn main() {
.allowlist_file("lightgbm/include/LightGBM/c_api.h")
.clang_args(&["-x", "c++", "-std=c++11"])
.clang_arg(format!("-I{}", lgbm_root.join("include").display()))
.parse_callbacks(Box::new(DoxygenCallback))
.generate()
.expect("Unable to generate bindings");
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
Expand Down

0 comments on commit 87e01f8

Please sign in to comment.