forked from vitrine/wmaker
First crack at C<->Rust interaction.
Pushing elsewhere because this won't build on my laptop.
This commit is contained in:
+21
-1
@@ -1,4 +1,4 @@
|
||||
# load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
|
||||
# http_archive(
|
||||
# name = "bazel_pkg_config",
|
||||
@@ -6,6 +6,26 @@
|
||||
# urls = ["https://github.com/cherrry/bazel_pkg_config/archive/master.zip"],
|
||||
# )
|
||||
|
||||
# To find additional information on this release or newer ones visit:
|
||||
# https://github.com/bazelbuild/rules_rust/releases
|
||||
http_archive(
|
||||
name = "rules_rust",
|
||||
integrity = "sha256-Weev1uz2QztBlDA88JX6A1N72SucD1V8lBsaliM0TTg=",
|
||||
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.48.0/rules_rust-v0.48.0.tar.gz"],
|
||||
)
|
||||
|
||||
load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains")
|
||||
|
||||
rules_rust_dependencies()
|
||||
rust_register_toolchains()
|
||||
|
||||
rust_register_toolchains(
|
||||
edition = "2021",
|
||||
versions = [
|
||||
"1.79.0"
|
||||
],
|
||||
)
|
||||
|
||||
load("@bazel_tools//tools/build_defs/repo:local.bzl", "local_repository")
|
||||
local_repository(
|
||||
name = "bazel_pkg_config",
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
load("@rules_rust//rust:defs.bzl", "rust_library")
|
||||
|
||||
rust_library(
|
||||
name = "wrlib_rs",
|
||||
srcs = ["wrlib.rs"],
|
||||
deps = [":wrlib"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "wrlib",
|
||||
srcs = [
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
use std::os::raw::{c_char, c_int, c_uchar};
|
||||
|
||||
#[repr(u8)]
|
||||
pub enum RImageFormat {
|
||||
RGBAFormat = 0,
|
||||
RRGBAFormat = 1,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct RImage {
|
||||
data: *mut c_uchar,
|
||||
width: c_int,
|
||||
height: c_int,
|
||||
format: RImageFormat,
|
||||
ref_count: c_int,
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
pub fn r_destroy_conversion_tables() -> ();
|
||||
|
||||
pub fn RLoadPPM(file: *const c_char) -> *mut RImage;
|
||||
|
||||
pub fn RLoadXPM(context: *mut RContext, file: *const c_char) -> mut *RImage;
|
||||
|
||||
pub fn RReleaseCache() -> ();
|
||||
|
||||
pub fn wraster_rotate_image_180(source: *const RImage) -> *mut RImage;
|
||||
|
||||
pub fn wraster_change_filter(ty: RScalingFilter) -> ();
|
||||
|
||||
pub fn RShutdown() -> ();
|
||||
|
||||
#[must_use]
|
||||
pub fn RSupportedFileFormats() -> *mut *const c_char;
|
||||
|
||||
#[must_use]
|
||||
pub fn RGetImageFileFormat(file: *const c_char) -> *mut c_char;
|
||||
}
|
||||
Reference in New Issue
Block a user