docs: more surgically avoid linux linking to windows symbols

This commit is contained in:
chyyran 2023-01-14 20:13:15 -05:00
parent 87a08a83f2
commit 831ba3d357
13 changed files with 17 additions and 40 deletions

2
.gitignore vendored
View file

@ -9,3 +9,5 @@ librashader_runtime_*.exe
/test/capi-tests/librashader-capi-tests/.vs/ /test/capi-tests/librashader-capi-tests/.vs/
/test/capi-tests/librashader-capi-tests/x64/ /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/x64/
/test/capi-tests/librashader-capi-tests/librashader-capi-tests/*.so
/test/capi-tests/librashader-capi-tests/librashader-capi-tests/*.out

View file

@ -20,6 +20,9 @@ runtime-opengl = ["gl", "librashader/gl"]
runtime-d3d11 = ["windows", "librashader/d3d11"] runtime-d3d11 = ["windows", "librashader/d3d11"]
runtime-vulkan = ["ash", "librashader/vk"] runtime-vulkan = ["ash", "librashader/vk"]
# Do not enable, for docs.rs build only.
docsrs = []
[dependencies] [dependencies]
librashader = { path = "../librashader", version = "0.1.0-beta.3" } librashader = { path = "../librashader", version = "0.1.0-beta.3" }
thiserror = "1.0.37" thiserror = "1.0.37"
@ -28,20 +31,10 @@ gl = { version = "0.14.0", optional = true }
rustc-hash = "1.1.0" rustc-hash = "1.1.0"
ash = { version = "0.37.2+1.3.238", optional = true } ash = { version = "0.37.2+1.3.238", optional = true }
[target.'cfg(windows)'.dependencies.windows] [dependencies.windows]
version = "0.43.0" version = "0.43.0"
features = [ features = [
"Win32_Foundation",
"Win32_Graphics_Dxgi_Common",
"Win32_Graphics_Direct3D",
"Win32_Graphics_Direct3D11", "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 optional = true
@ -49,4 +42,4 @@ optional = true
cbindgen = { git = "https://github.com/eqrion/cbindgen" } cbindgen = { git = "https://github.com/eqrion/cbindgen" }
[package.metadata.docs.rs] [package.metadata.docs.rs]
targets = ["x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu"] features = ["docsrs"]

View file

@ -14,7 +14,7 @@ pub type libra_error_t = Option<NonNull<LibrashaderError>>;
pub type libra_gl_filter_chain_t = Option<NonNull<librashader::runtime::gl::capi::FilterChainGL>>; pub type libra_gl_filter_chain_t = Option<NonNull<librashader::runtime::gl::capi::FilterChainGL>>;
/// A handle to a Direct3D11 filter chain. /// 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 = pub type libra_d3d11_filter_chain_t =
Option<NonNull<librashader::runtime::d3d11::capi::FilterChainD3D11>>; Option<NonNull<librashader::runtime::d3d11::capi::FilterChainD3D11>>;

View file

@ -28,7 +28,7 @@ pub enum LibrashaderError {
#[cfg(feature = "runtime-opengl")] #[cfg(feature = "runtime-opengl")]
#[error("There was an error in the OpenGL filter chain.")] #[error("There was an error in the OpenGL filter chain.")]
OpenGlFilterError(#[from] librashader::runtime::gl::error::FilterChainError), 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.")] #[error("There was an error in the D3D11 filter chain.")]
D3D11FilterError(#[from] librashader::runtime::d3d11::error::FilterChainError), D3D11FilterError(#[from] librashader::runtime::d3d11::error::FilterChainError),
#[cfg(feature = "runtime-vulkan")] #[cfg(feature = "runtime-vulkan")]
@ -180,7 +180,7 @@ impl LibrashaderError {
} }
#[cfg(feature = "runtime-opengl")] #[cfg(feature = "runtime-opengl")]
LibrashaderError::OpenGlFilterError(_) => LIBRA_ERRNO::RUNTIME_ERROR, 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, LibrashaderError::D3D11FilterError(_) => LIBRA_ERRNO::RUNTIME_ERROR,
#[cfg(feature = "runtime-vulkan")] #[cfg(feature = "runtime-vulkan")]
LibrashaderError::VulkanFilterError(_) => LIBRA_ERRNO::RUNTIME_ERROR, LibrashaderError::VulkanFilterError(_) => LIBRA_ERRNO::RUNTIME_ERROR,

View file

@ -2,7 +2,7 @@
#[cfg(feature = "runtime-opengl")] #[cfg(feature = "runtime-opengl")]
pub mod gl; 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; pub mod d3d11;
#[cfg(feature = "runtime-vulkan")] #[cfg(feature = "runtime-vulkan")]

View file

@ -24,7 +24,7 @@ ash = { version = "0.37.1+1.3.235", optional = true }
num-traits = "0.2.15" num-traits = "0.2.15"
[target.'cfg(windows)'.dependencies.windows] [dependencies.windows]
optional = true optional = true
version = "0.43.0" version = "0.43.0"
features = [ features = [
@ -33,6 +33,3 @@ features = [
"Win32_Graphics_Direct3D", "Win32_Graphics_Direct3D",
"Win32_Graphics_Direct3D11", "Win32_Graphics_Direct3D11",
] ]
[package.metadata.docs.rs]
targets = ["x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu"]

View file

@ -7,11 +7,11 @@ pub mod gl;
pub mod vk; pub mod vk;
/// DXGI common conversions. /// DXGI common conversions.
#[cfg(all(target_os = "windows", feature = "dxgi"))] #[cfg(feature = "dxgi")]
pub mod dxgi; pub mod dxgi;
/// Direct3D 11 common conversions. /// Direct3D 11 common conversions.
#[cfg(all(target_os = "windows", feature = "d3d11"))] #[cfg(feature = "d3d11")]
pub mod d3d11; pub mod d3d11;
mod viewport; mod viewport;

View file

@ -23,7 +23,7 @@ spirv_cross = "0.23.1"
rustc-hash = "1.1.0" rustc-hash = "1.1.0"
bytemuck = "1.12.3" bytemuck = "1.12.3"
[target.'cfg(windows)'.dependencies.windows] [dependencies.windows]
version = "0.43.0" version = "0.43.0"
features = [ features = [
"Win32_Foundation", "Win32_Foundation",
@ -41,7 +41,3 @@ features = [
[dev-dependencies] [dev-dependencies]
gfx-maths = "0.2.8" gfx-maths = "0.2.8"
[package.metadata.docs.rs]
default-target = "x86_64-pc-windows-msvc"
targets = []

View file

@ -1,7 +1,5 @@
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
#![feature(let_chains)] #![feature(let_chains)]
#![cfg(target_os = "windows")]
#[cfg(test)] #[cfg(test)]
mod hello_triangle; mod hello_triangle;

View file

@ -25,6 +25,3 @@ thiserror = "1.0.37"
[dev-dependencies] [dev-dependencies]
glfw = "0.47.0" glfw = "0.47.0"
[package.metadata.docs.rs]
targets = ["x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu"]

View file

@ -31,6 +31,3 @@ glfw = "0.49.0"
winit = "0.27.5" winit = "0.27.5"
raw-window-handle = "0.5" raw-window-handle = "0.5"
ash-window = "0.12.0" ash-window = "0.12.0"
[package.metadata.docs.rs]
targets = ["x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu"]

View file

@ -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 } ash = { version = "0.37.1+1.3.235", optional = true }
[target.'cfg(windows)'.dependencies.windows] [dependencies.windows]
version = "0.43.0" version = "0.43.0"
features = [ features = [
"Win32_Graphics_Direct3D11", "Win32_Graphics_Direct3D11",
@ -40,6 +40,3 @@ runtime = []
reflect = [] reflect = []
preprocess = [] preprocess = []
presets = [] presets = []
[package.metadata.docs.rs]
targets = ["x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu"]

View file

@ -122,7 +122,7 @@ pub mod runtime {
} }
} }
#[cfg(all(target_os = "windows", feature = "d3d11"))] #[cfg(feature = "d3d11")]
/// Shader runtime for Direct3D 11. /// Shader runtime for Direct3D 11.
pub mod d3d11 { pub mod d3d11 {
pub use librashader_runtime_d3d11::{ pub use librashader_runtime_d3d11::{