diff --git a/.gitignore b/.gitignore index e6fd5e8..7f0455b 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ librashader_runtime_*.exe /test/capi-tests/librashader-capi-tests/.vs/ /test/capi-tests/librashader-capi-tests/x64/ /test/capi-tests/librashader-capi-tests/librashader-capi-tests/x64/ +/test/capi-tests/librashader-capi-tests/librashader-capi-tests/*.so +/test/capi-tests/librashader-capi-tests/librashader-capi-tests/*.out diff --git a/librashader-capi/Cargo.toml b/librashader-capi/Cargo.toml index 784f531..f991475 100644 --- a/librashader-capi/Cargo.toml +++ b/librashader-capi/Cargo.toml @@ -20,6 +20,9 @@ runtime-opengl = ["gl", "librashader/gl"] runtime-d3d11 = ["windows", "librashader/d3d11"] runtime-vulkan = ["ash", "librashader/vk"] +# Do not enable, for docs.rs build only. +docsrs = [] + [dependencies] librashader = { path = "../librashader", version = "0.1.0-beta.3" } thiserror = "1.0.37" @@ -28,20 +31,10 @@ gl = { version = "0.14.0", optional = true } rustc-hash = "1.1.0" ash = { version = "0.37.2+1.3.238", optional = true } -[target.'cfg(windows)'.dependencies.windows] +[dependencies.windows] version = "0.43.0" features = [ - "Win32_Foundation", - "Win32_Graphics_Dxgi_Common", - "Win32_Graphics_Direct3D", "Win32_Graphics_Direct3D11", - "Win32_Graphics_Direct3D_Fxc", - "Win32_Graphics_Gdi", - "Win32_Security", - "Win32_System_LibraryLoader", - "Win32_System_Threading", - "Win32_System_WindowsProgramming", - "Win32_UI_WindowsAndMessaging", ] optional = true @@ -49,4 +42,4 @@ optional = true cbindgen = { git = "https://github.com/eqrion/cbindgen" } [package.metadata.docs.rs] -targets = ["x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu"] +features = ["docsrs"] diff --git a/librashader-capi/src/ctypes.rs b/librashader-capi/src/ctypes.rs index 1d03eed..b6caab9 100644 --- a/librashader-capi/src/ctypes.rs +++ b/librashader-capi/src/ctypes.rs @@ -14,7 +14,7 @@ pub type libra_error_t = Option>; pub type libra_gl_filter_chain_t = Option>; /// A handle to a Direct3D11 filter chain. -#[cfg(all(target_os = "windows", feature = "runtime-d3d11"))] +#[cfg(all(feature = "runtime-d3d11"))] pub type libra_d3d11_filter_chain_t = Option>; diff --git a/librashader-capi/src/error.rs b/librashader-capi/src/error.rs index b974f16..d5acf0f 100644 --- a/librashader-capi/src/error.rs +++ b/librashader-capi/src/error.rs @@ -28,7 +28,7 @@ pub enum LibrashaderError { #[cfg(feature = "runtime-opengl")] #[error("There was an error in the OpenGL filter chain.")] OpenGlFilterError(#[from] librashader::runtime::gl::error::FilterChainError), - #[cfg(all(target_os = "windows", feature = "runtime-d3d11"))] + #[cfg(any(feature = "docsrs", all(target_os = "windows", feature = "runtime-d3d11")))] #[error("There was an error in the D3D11 filter chain.")] D3D11FilterError(#[from] librashader::runtime::d3d11::error::FilterChainError), #[cfg(feature = "runtime-vulkan")] @@ -180,7 +180,7 @@ impl LibrashaderError { } #[cfg(feature = "runtime-opengl")] LibrashaderError::OpenGlFilterError(_) => LIBRA_ERRNO::RUNTIME_ERROR, - #[cfg(all(target_os = "windows", feature = "runtime-d3d11"))] + #[cfg(any(feature = "docsrs", all(target_os = "windows", feature = "runtime-d3d11")))] LibrashaderError::D3D11FilterError(_) => LIBRA_ERRNO::RUNTIME_ERROR, #[cfg(feature = "runtime-vulkan")] LibrashaderError::VulkanFilterError(_) => LIBRA_ERRNO::RUNTIME_ERROR, diff --git a/librashader-capi/src/runtime/mod.rs b/librashader-capi/src/runtime/mod.rs index 1f66a10..eddd1b1 100644 --- a/librashader-capi/src/runtime/mod.rs +++ b/librashader-capi/src/runtime/mod.rs @@ -2,7 +2,7 @@ #[cfg(feature = "runtime-opengl")] pub mod gl; -#[cfg(all(target_os = "windows", feature = "runtime-d3d11"))] +#[cfg(any(feature = "docsrs", all(target_os = "windows", feature = "runtime-d3d11")))] pub mod d3d11; #[cfg(feature = "runtime-vulkan")] diff --git a/librashader-common/Cargo.toml b/librashader-common/Cargo.toml index 270e1f4..a49ae88 100644 --- a/librashader-common/Cargo.toml +++ b/librashader-common/Cargo.toml @@ -24,7 +24,7 @@ ash = { version = "0.37.1+1.3.235", optional = true } num-traits = "0.2.15" -[target.'cfg(windows)'.dependencies.windows] +[dependencies.windows] optional = true version = "0.43.0" features = [ @@ -33,6 +33,3 @@ features = [ "Win32_Graphics_Direct3D", "Win32_Graphics_Direct3D11", ] - -[package.metadata.docs.rs] -targets = ["x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu"] diff --git a/librashader-common/src/lib.rs b/librashader-common/src/lib.rs index 857666f..9e209c7 100644 --- a/librashader-common/src/lib.rs +++ b/librashader-common/src/lib.rs @@ -7,11 +7,11 @@ pub mod gl; pub mod vk; /// DXGI common conversions. -#[cfg(all(target_os = "windows", feature = "dxgi"))] +#[cfg(feature = "dxgi")] pub mod dxgi; /// Direct3D 11 common conversions. -#[cfg(all(target_os = "windows", feature = "d3d11"))] +#[cfg(feature = "d3d11")] pub mod d3d11; mod viewport; diff --git a/librashader-runtime-d3d11/Cargo.toml b/librashader-runtime-d3d11/Cargo.toml index 922455a..1fe6fd5 100644 --- a/librashader-runtime-d3d11/Cargo.toml +++ b/librashader-runtime-d3d11/Cargo.toml @@ -23,7 +23,7 @@ spirv_cross = "0.23.1" rustc-hash = "1.1.0" bytemuck = "1.12.3" -[target.'cfg(windows)'.dependencies.windows] +[dependencies.windows] version = "0.43.0" features = [ "Win32_Foundation", @@ -41,7 +41,3 @@ features = [ [dev-dependencies] gfx-maths = "0.2.8" - -[package.metadata.docs.rs] -default-target = "x86_64-pc-windows-msvc" -targets = [] diff --git a/librashader-runtime-d3d11/src/lib.rs b/librashader-runtime-d3d11/src/lib.rs index 352811a..769e563 100644 --- a/librashader-runtime-d3d11/src/lib.rs +++ b/librashader-runtime-d3d11/src/lib.rs @@ -1,7 +1,5 @@ #![feature(type_alias_impl_trait)] #![feature(let_chains)] -#![cfg(target_os = "windows")] - #[cfg(test)] mod hello_triangle; diff --git a/librashader-runtime-gl/Cargo.toml b/librashader-runtime-gl/Cargo.toml index 12dda60..c26e785 100644 --- a/librashader-runtime-gl/Cargo.toml +++ b/librashader-runtime-gl/Cargo.toml @@ -25,6 +25,3 @@ thiserror = "1.0.37" [dev-dependencies] glfw = "0.47.0" - -[package.metadata.docs.rs] -targets = ["x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu"] diff --git a/librashader-runtime-vk/Cargo.toml b/librashader-runtime-vk/Cargo.toml index c8d2f4b..4fd9b41 100644 --- a/librashader-runtime-vk/Cargo.toml +++ b/librashader-runtime-vk/Cargo.toml @@ -31,6 +31,3 @@ glfw = "0.49.0" winit = "0.27.5" raw-window-handle = "0.5" ash-window = "0.12.0" - -[package.metadata.docs.rs] -targets = ["x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu"] diff --git a/librashader/Cargo.toml b/librashader/Cargo.toml index 8b9683a..3f05e73 100644 --- a/librashader/Cargo.toml +++ b/librashader/Cargo.toml @@ -24,7 +24,7 @@ librashader-runtime-vk = { path = "../librashader-runtime-vk", version = "0.1.0- ash = { version = "0.37.1+1.3.235", optional = true } -[target.'cfg(windows)'.dependencies.windows] +[dependencies.windows] version = "0.43.0" features = [ "Win32_Graphics_Direct3D11", @@ -40,6 +40,3 @@ runtime = [] reflect = [] preprocess = [] presets = [] - -[package.metadata.docs.rs] -targets = ["x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu"] diff --git a/librashader/src/lib.rs b/librashader/src/lib.rs index 47536e7..bb20a53 100644 --- a/librashader/src/lib.rs +++ b/librashader/src/lib.rs @@ -122,7 +122,7 @@ pub mod runtime { } } - #[cfg(all(target_os = "windows", feature = "d3d11"))] + #[cfg(feature = "d3d11")] /// Shader runtime for Direct3D 11. pub mod d3d11 { pub use librashader_runtime_d3d11::{