Upload Kmake

This commit is contained in:
Gorochu
2026-05-26 23:36:42 -07:00
parent ba051b2f74
commit 555ec72358
41615 changed files with 13344630 additions and 1 deletions

View File

@ -0,0 +1,3 @@
/target
**/*.rs.bk
Cargo.lock

View File

@ -0,0 +1 @@
../CMakeLists.txt

View File

@ -0,0 +1,22 @@
[package]
name = "ittapi-rs"
version = "0.1.5"
authors = ["Johnnie Birch <45402135+jlb6740@users.noreply.github.com>"]
edition = "2018"
description = "Rust bindings for ittapi"
license-file = "LICENSES/"
documentation = "https://docs.rs/ittapi-rs"
homepage = "https://github.com/intel/ittapi/ittapi-rs"
repository = "https://github.com/intel/ittapi"
[dependencies]
[features]
force_32 = []
[build-dependencies]
cmake = "0.1.42"
[dev-dependencies]
bindgen = "0.52.0"
diff = "0.1"

View File

@ -0,0 +1 @@
../LICENSES/

View File

@ -0,0 +1,14 @@
# ittapi-rs
This package creates Rust bindings for ittapi. Ittapi is used for instrumentation and tracking and just-in-time profiling.
Note the building of this package is currently only supported (tested) on a couple of Linux platforms (recent Ubuntu and Fedora builds) but support for other platforms is intended and contributions are welcomed.
# Build the package
cargo build
** Note This package uses bindgen which in turn requires recent versions of cmake and llvm to be installed. For Fedora, "yum install llvm-devel" was needed to bring in llvm-config.
** Also note building this package requires rust nightly.
# Publish the package to crates.io
cargo publish

View File

@ -0,0 +1,37 @@
#![allow(unused)]
use cmake::Config;
use std::env;
use std::path::PathBuf;
#[cfg(target_os = "windows")]
fn main() {}
#[cfg(not(target_os = "windows"))]
fn main() {
let out_dir = env::var("OUT_DIR").unwrap();
let out_path = PathBuf::from(out_dir);
#[cfg(not(feature = "force_32"))]
{
let _ittnotify_64 = Config::new("./")
.generator("Unix Makefiles")
.no_build_target(true)
.build();
println!("cargo:rustc-link-search={}/build/bin/", out_path.display());
println!("cargo:rustc-link-lib=static=ittnotify");
}
#[cfg(feature = "force_32")]
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
{
let _ittnotify_32 = Config::new("./")
.generator("Unix Makefiles")
.define("FORCE_32", "ON")
.no_build_target(true)
.build();
println!("cargo:rustc-link-search={}/build/bin/", out_path.display());
println!("cargo:rustc-link-lib=static=ittnotify32");
}
}

View File

@ -0,0 +1 @@
../include/

View File

@ -0,0 +1 @@
../../src/ittnotify

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(unused)]
include!("ittnotify_bindings.rs");
include!("jitprofiling_bindings.rs");

View File

@ -0,0 +1,68 @@
// This is a smoke test for pre-generated `src/ittapi-bindings.rs` and
// `src/jitprofiling-bindings.rs` files to see that they don't need to be
// updated. We check in a generated version so downstream consumers don't
// have to get `bindgen` working themselves.
//
// If bindgen or ittapi.h or jitprofiling.h change you can run tests with
// `BLESS=1` (inpired by a similiar pach for binaryen) to regenerate the
// source files, otherwise this can test on CI that the file doesn't need
// to be regenerated.
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
#![allow(unused)]
#[test]
fn test_ittnotify_bindings_up_to_date() {
let expected = bindgen::Builder::default()
.rustfmt_bindings(true)
.header("./include/ittnotify.h")
.generate()
.expect("Unable to generate ittnotify bindings.")
.to_string();
if std::env::var("BLESS").is_ok() {
std::fs::write("src/ittnotify_bindings.rs", expected).unwrap();
} else {
let actual = include_str!("../src/ittnotify_bindings.rs");
if expected == actual {
return;
}
for diff in diff::lines(&expected, &actual) {
match diff {
diff::Result::Both(_, s) => println!(" {}", s),
diff::Result::Left(s) => println!("-{}", s),
diff::Result::Right(s) => println!("+{}", s),
}
}
panic!("differences found, need to regenerate ittnotify bindings");
}
}
#[test]
fn test_jitprofiling_bindings_up_to_date() {
let expected = bindgen::Builder::default()
.rustfmt_bindings(true)
.header("./include/jitprofiling.h")
.generate()
.expect("Unable to generate jitprofiling bindings")
.to_string();
if std::env::var("BLESS").is_ok() {
std::fs::write("src/jitprofiling_bindings.rs", expected).unwrap();
} else {
let actual = include_str!("../src/jitprofiling_bindings.rs");
if expected == actual {
return;
}
for diff in diff::lines(&expected, &actual) {
match diff {
diff::Result::Both(_, s) => println!(" {}", s),
diff::Result::Left(s) => println!("-{}", s),
diff::Result::Right(s) => println!("+{}", s),
}
}
panic!("differences found, need to regenerate jitprofiling bindings");
}
}