gwihlidal / intel-tex-rs

Rust bindings for Intel's ISPC texture compression
Apache License 2.0
23 stars 4 forks source link

Improve build requirements (ISPC and libclang for bindgen) #2

Closed gwihlidal closed 5 years ago

gwihlidal commented 5 years ago

Currently there is a requirement by any user of the crate that the ISPC compiler is installed (i.e. available in the PATH), and ispc-rs uses rust bindgen to generate rust bindings for the generated code, which then adds an annoying dependency on libclang, as well.

The ISPC compiler is a self-contained binary, but libclang is typically bundled (with headers like stdbool.h) in clang or LLVM, which is quite large.

For ISPC, the host architecture/target is used, but it may be possible to specify multiple targets to generate a variety of object files under an optional feature flag. This feature flag would require ISPC and libclang, but the default feature flag would just link in the appropriate pre-compiled object file.

For bindgen, a similar approach would be to to modify the ispc.rs crate to support using a pre-generated FFI binding instead of always generating in build.rs. When the ISPC object files are compiled, bindgen could be run to pre-create the rust FFI bindings and store them with the object files.

Any alternatives?