Publish vulkano-macros (#2175)

* Publish vulkano-macros

* Document `vulkano-macros`

* Make macros dependency optional

* Document `macros` feature

* Fix outdated docs

* Derp
This commit is contained in:
marc0246 2023-04-03 06:33:01 +02:00 committed by GitHub
parent 1f31e85c5e
commit 096d3bc660
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 45 additions and 21 deletions

View File

@ -2,7 +2,8 @@
members = [
"examples",
"vulkano",
"vulkano-macros",
"vulkano-shaders",
"vulkano-win",
"vulkano-util",
"vulkano-win",
]

View File

@ -2,13 +2,16 @@
name = "vulkano-macros"
version = "0.33.0"
edition = "2021"
authors = ["Pierre Krieger <pierre.krieger1708@gmail.com>", "The vulkano contributors"]
authors = [
"Pierre Krieger <pierre.krieger1708@gmail.com>",
"The vulkano contributors",
]
repository = "https://github.com/vulkano-rs/vulkano"
description = "Macros used by Vulkano"
license = "MIT/Apache-2.0"
documentation = "https://docs.rs/vulkano"
homepage = "https://vulkano.rs"
publish = false
publish = true
[lib]
proc-macro = true
@ -20,4 +23,4 @@ proc-macro2 = "1.0"
proc-macro-crate = "1.2"
[dev-dependencies]
vulkano = { path = ".." }
vulkano = { path = "../vulkano" }

View File

@ -7,6 +7,10 @@
// notice may not be copied, modified, or distributed except
// according to those terms.
//! Macros for [`vulkano`].
//!
//! [`vulkano`]: https://crates.io/crates/vulkano
use proc_macro::TokenStream;
use proc_macro_crate::{crate_name, FoundCrate};
use syn::{parse_macro_input, DeriveInput, Error};
@ -14,6 +18,9 @@ use syn::{parse_macro_input, DeriveInput, Error};
mod derive_buffer_contents;
mod derive_vertex;
/// Derives the [`Vertex`] trait.
///
/// [`Vertex`]: https://docs.rs/vulkano/latest/vulkano/pipeline/graphics/vertex_input/trait.Vertex.html
#[proc_macro_derive(Vertex, attributes(name, format))]
pub fn derive_vertex(input: TokenStream) -> TokenStream {
let ast = parse_macro_input!(input as DeriveInput);
@ -23,6 +30,9 @@ pub fn derive_vertex(input: TokenStream) -> TokenStream {
.into()
}
/// Derives the [`BufferContents`] trait.
///
/// [`BufferContents`]: https://docs.rs/vulkano/latest/vulkano/buffer/trait.BufferContents.html
#[proc_macro_derive(BufferContents)]
pub fn derive_buffer_contents(input: TokenStream) -> TokenStream {
let ast = parse_macro_input!(input as DeriveInput);

View File

@ -2,7 +2,10 @@
name = "vulkano-shaders"
version = "0.33.0"
edition = "2021"
authors = ["Pierre Krieger <pierre.krieger1708@gmail.com>", "The vulkano contributors"]
authors = [
"Pierre Krieger <pierre.krieger1708@gmail.com>",
"The vulkano contributors",
]
repository = "https://github.com/vulkano-rs/vulkano"
description = "Shaders rust code generation macro"
license = "MIT/Apache-2.0"
@ -21,7 +24,7 @@ proc-macro2 = "1.0"
quote = "1.0"
shaderc = "0.8"
syn = { version = "1.0", features = ["full", "extra-traits"] }
vulkano = { version = "0.33.0", path = "../vulkano" }
vulkano = { version = "0.33.0", path = "../vulkano", default-features = false }
[features]
shaderc-build-from-source = ["shaderc/build-from-source"]

View File

@ -13,6 +13,6 @@ categories = ["rendering::graphics-api"]
[dependencies]
ahash = "0.8"
vulkano = { version = "0.33.0", path = "../vulkano" }
vulkano = { version = "0.33.0", path = "../vulkano", default-features = false }
vulkano-win = { version = "0.33.0", path = "../vulkano-win" }
winit = { version = "0.28" }

View File

@ -2,7 +2,10 @@
name = "vulkano-win"
version = "0.33.0"
edition = "2021"
authors = ["Pierre Krieger <pierre.krieger1708@gmail.com>", "The vulkano contributors"]
authors = [
"Pierre Krieger <pierre.krieger1708@gmail.com>",
"The vulkano contributors",
]
repository = "https://github.com/vulkano-rs/vulkano"
description = "Link between vulkano and winit"
license = "MIT/Apache-2.0"
@ -20,7 +23,7 @@ winit_ = ["dep:winit", "dep:objc", "dep:core-graphics-types"]
[dependencies]
raw-window-handle = { version = "0.5", optional = true }
vulkano = { version = "0.33.0", path = "../vulkano" }
vulkano = { version = "0.33.0", path = "../vulkano", default-features = false }
winit = { version = "0.28", optional = true }
[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies]

View File

@ -1,9 +1,9 @@
//! # Cargo features
//!
//! | Feature | Description |
//! |----------------------|----------------------------------------------------------------------------|
//! | `raw_window_handle_` | Include support for the [`raw_window_handle`] library. Enabled by default. |
//! | `winit_` | Include support for the [`winit`] library. Enabled by default. |
//! | Feature | Description |
//! |----------------------|---------------------------------------------------------------------------|
//! | `raw_window_handle` | Include support for the [`raw_window_handle`] library. Enabled by default. |
//! | `winit` | Include support for the [`winit`] library. Enabled by default. |
//!
//! [`raw_window_handle`]: https://crates.io/crates/raw_window_handle
//! [`winit`]: https://crates.io/crates/winit

View File

@ -30,7 +30,7 @@ parking_lot = { version = "0.12", features = ["send_guard"] }
serde = { version = "1.0", optional = true }
smallvec = "1.8"
thread_local = "1.1"
vulkano-macros = { path = "macros", version = "0.33.0" }
vulkano-macros = { path = "../vulkano-macros", version = "0.33.0", optional = true }
[target.'cfg(target_os = "ios")'.dependencies]
objc = "0.2.5"
@ -53,4 +53,6 @@ cgmath = "0.18"
nalgebra = "0.32"
[features]
default = ["macros"]
macros = ["vulkano-macros"]
document_unchecked = []

View File

@ -36,6 +36,7 @@ use std::{
thread,
};
#[cfg(feature = "macros")]
pub use vulkano_macros::BufferContents;
/// A subpart of a buffer.

View File

@ -96,14 +96,12 @@
//!
//! # Cargo features
//!
//! | Feature | Description |
//! |----------------------|-------------------------------------------------------------------------------|
//! | `document_unchecked` | Include `_unchecked` functions in the generated documentation. |
//! | `serde` | Enables (de)serialization of certain types using [`serde`]. |
//! | Feature | Description |
//! |----------------------|---------------------------------------------------------------||
//! | `macros` | Include reexports from [`vulkano-macros`]. Enabled by default. |
//! | `document_unchecked` | Include `_unchecked` functions in the generated documentation. |
//! | `serde` | Enables (de)serialization of certain types using [`serde`]. |
//!
//! [`cgmath`]: https://crates.io/crates/cgmath
//! [`nalgebra`]: https://crates.io/crates/nalgebra
//! [`serde`]: https://crates.io/crates/serde
//! [`VulkanLibrary`]: crate::VulkanLibrary
//! [`Instance`]: crate::instance::Instance
//! [`Surface`]: crate::swapchain::Surface
@ -125,6 +123,8 @@
//! [`PipelineLayout`]: crate::pipeline::layout
//! [`RenderPass`]: crate::render_pass::RenderPass
//! [`Framebuffer`]: crate::render_pass::Framebuffer
//! [`vulkano-macros`]: vulkano_macros
//! [`serde`]: https://crates.io/crates/serde
//#![warn(missing_docs)] // TODO: activate
#![warn(

View File

@ -10,6 +10,7 @@
use super::VertexInputRate;
use crate::{buffer::BufferContents, format::Format};
use std::collections::HashMap;
#[cfg(feature = "macros")]
pub use vulkano_macros::Vertex;
/// Describes an individual `Vertex`. In other words a collection of attributes that can be read