mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Merge pull request #354 from djmitche/tc-lib-rlib
export taskchampion-lib as an rlib, too
This commit is contained in:
commit
73baefa0a5
5 changed files with 24 additions and 5 deletions
|
@ -32,6 +32,9 @@ To regenerate this file, run `cargo xtask codegen`.
|
||||||
|
|
||||||
## C libraries
|
## C libraries
|
||||||
|
|
||||||
|
NOTE: support for linking against taskchampion is a work in progress.
|
||||||
|
Contributions and pointers to best practices are appreciated!
|
||||||
|
|
||||||
The `taskchampion-lib` crate generates libraries suitable for use from C (or any C-compatible language).
|
The `taskchampion-lib` crate generates libraries suitable for use from C (or any C-compatible language).
|
||||||
|
|
||||||
The necessary bits are:
|
The necessary bits are:
|
||||||
|
@ -44,8 +47,12 @@ Downstream consumers may use either the static or dynamic library, as they prefe
|
||||||
|
|
||||||
NOTE: on Windows, the "BCrypt" library must be included when linking to taskchampion.
|
NOTE: on Windows, the "BCrypt" library must be included when linking to taskchampion.
|
||||||
|
|
||||||
|
### As a Rust dependency
|
||||||
|
|
||||||
|
If you would prefer to build Taskchampion directly into your project, and have a build system capable of building Rust libraries (such as CMake), the `taskchampion-lib` crate can be referenced as an `rlib` dependency.
|
||||||
|
|
||||||
## Documentation Generation
|
## Documentation Generation
|
||||||
|
|
||||||
The `mdbook` configuration contains a "preprocessor" implemented in the `taskchampion-cli` crate in order to reflect CLI usage information into the generated book.
|
The `mdbook` configuration contains a "preprocessor" implemented in the `taskchampion-cli` crate in order to reflect CLI usage information into the generated book.
|
||||||
Tihs preprocessor is not built by default.
|
This preprocessor is not built by default.
|
||||||
To (re)build it, run `cargo build -p taskchampion-cli --features usage-docs --bin usage-docs`.
|
To (re)build it, run `cargo build -p taskchampion-cli --features usage-docs --bin usage-docs`.
|
||||||
|
|
|
@ -18,7 +18,7 @@ fn link_libtaskchampion() {
|
||||||
|
|
||||||
let libtc_dir = libtc_dir.to_str().expect("path is valid utf-8");
|
let libtc_dir = libtc_dir.to_str().expect("path is valid utf-8");
|
||||||
println!("cargo:rustc-link-search={}", libtc_dir);
|
println!("cargo:rustc-link-search={}", libtc_dir);
|
||||||
println!("cargo:rustc-link-lib=dylib=taskchampion");
|
println!("cargo:rustc-link-lib=dylib=taskchampionlib");
|
||||||
|
|
||||||
// on windows, it appears that rust std requires BCrypt
|
// on windows, it appears that rust std requires BCrypt
|
||||||
if cfg!(target_os = "windows") {
|
if cfg!(target_os = "windows") {
|
||||||
|
|
|
@ -4,8 +4,8 @@ version = "0.1.0"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "taskchampion"
|
name = "taskchampionlib"
|
||||||
crate-type = ["staticlib", "cdylib"]
|
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libc = "0.2.113"
|
libc = "0.2.113"
|
||||||
|
|
|
@ -17,17 +17,29 @@ mod traits;
|
||||||
mod util;
|
mod util;
|
||||||
|
|
||||||
pub mod annotation;
|
pub mod annotation;
|
||||||
|
pub use annotation::*;
|
||||||
pub mod atomic;
|
pub mod atomic;
|
||||||
|
pub use atomic::*;
|
||||||
pub mod kv;
|
pub mod kv;
|
||||||
|
pub use kv::*;
|
||||||
pub mod replica;
|
pub mod replica;
|
||||||
|
pub use replica::*;
|
||||||
pub mod result;
|
pub mod result;
|
||||||
|
pub use result::*;
|
||||||
pub mod server;
|
pub mod server;
|
||||||
|
pub use server::*;
|
||||||
pub mod status;
|
pub mod status;
|
||||||
|
pub use status::*;
|
||||||
pub mod string;
|
pub mod string;
|
||||||
|
pub use string::*;
|
||||||
pub mod task;
|
pub mod task;
|
||||||
|
pub use task::*;
|
||||||
pub mod uda;
|
pub mod uda;
|
||||||
|
pub use uda::*;
|
||||||
pub mod uuid;
|
pub mod uuid;
|
||||||
|
pub use uuid::*;
|
||||||
pub mod workingset;
|
pub mod workingset;
|
||||||
|
pub use workingset::*;
|
||||||
|
|
||||||
pub(crate) mod types {
|
pub(crate) mod types {
|
||||||
pub(crate) use crate::annotation::{TCAnnotation, TCAnnotationList};
|
pub(crate) use crate::annotation::{TCAnnotation, TCAnnotationList};
|
||||||
|
|
|
@ -411,7 +411,7 @@ impl CList for TCStringList {
|
||||||
///
|
///
|
||||||
/// For example:
|
/// For example:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```text
|
||||||
/// char *url = get_item_url(..); // dynamically allocate C string
|
/// char *url = get_item_url(..); // dynamically allocate C string
|
||||||
/// tc_task_annotate(task, tc_string_borrow(url)); // TCString created, passed, and freed
|
/// tc_task_annotate(task, tc_string_borrow(url)); // TCString created, passed, and freed
|
||||||
/// free(url); // string is no longer referenced and can be freed
|
/// free(url); // string is no longer referenced and can be freed
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue