kcp-io 0.0.4

A Rust wrapper for the KCP protocol — FFI bindings, safe API, and async tokio integration
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
fn main() {
    // Compile the KCP C source code using the `cc` crate
    cc::Build::new()
        .file("kcp/ikcp.c")
        .include("kcp")
        // Optimization: use O2 in release, O0 in debug
        .opt_level_str(if cfg!(debug_assertions) { "0" } else { "2" })
        // Suppress common C warnings that don't affect correctness
        .warnings(false)
        // Define standard compilation flags
        .define("NDEBUG", None) // disable C asserts in KCP
        .compile("kcp");

    // Rebuild if C source files change
    println!("cargo:rerun-if-changed=kcp/ikcp.c");
    println!("cargo:rerun-if-changed=kcp/ikcp.h");
}