#ispc #intel #build-dependencies #cargo-build #build-script #cross-compilation #spmd

build rispc

A build-time dependency for cargo build scripts to assist in invoking Intel's ISPC compiler to compile a static archive to be linked into rust code

1 unstable release

Uses old Rust 2015

0.1.0 May 23, 2016

#9 in #ispc

MIT license

22KB
478 lines

A library for build scripts to compile Intel SPMD (ispc) code.

This library is intended to be used as a build-dependencies entry in Cargo.toml, with a runtime component added to the dependencies:

[build-dependencies]
rispc = "0.1"

[dependencies]
rispcrt = "0.1"

The purpose of this crate is to provide the utility functions necesasry to compile ispc code into a static archive which is then linked into a Rust crate. The top-level compile_library function serves as a convenience and more advanced configuration is available through the Config builder.

This crate will automatically detect situations such as cross compilation or other environment variables set by Cargo and will build code appropriately.

Examples

Use the default configuration:

// build.rs
extern crate rispc;

fn main() {
  rispc::compile_library("libmandelbrot.a", &[ "src/mandelbrot.ispc" ]);
}

Use more advanced configuration:

// build.rs
extern crate rispc;

fn main() {
  rispc::Config::new()
    .file("src/mandelbrot.ispc")
    .define("FOO", Some("bar"))
    .math_lib(rispc::Math::Fast)
    .enable_fast_math(true)
    .addressing(rispc::Addr::A64)
    .compile("libmandelbrot.a");
}

For a complete, working example, see the rispc-demo folder in the repository.

Dependencies

~3MB
~71K SLoC