File tree 3 files changed +15
-3
lines changed
3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -89,15 +89,16 @@ are passed through to shaderc-sys when building shaderc-rs:
89
89
static shaderc library.
90
90
1 . If the ` VULKAN_SDK ` environment variable is set, then ` $VULKAN_SDK/lib ` will
91
91
be searched for native dynamic or static shaderc library.
92
+ 1 . If ` pkg-config ` is available, use it to find the path to search for libraries.
92
93
1 . On Linux, system library paths like ` /usr/lib/ ` will additionally be searched
93
94
for native dynamic or shaderc library, if the ` SHADERC_LIB_DIR ` is not set.
94
95
1 . Building from source, if the native shaderc library is not found via the
95
96
above steps.
96
97
97
98
For each library directory, the build script will try to find and link to the
98
- dynamic native shaderc library ` shaderc_shared ` first and the static native
99
- shaderc library ` shaderc_combined ` next. To prefer searching for the static
100
- library first and the dynamic library next, the option
99
+ dynamic native shaderc library ` shaderc ` / ` shaderc_shared ` first and the static
100
+ native shaderc library ` shaderc_combined ` next. To prefer searching for the
101
+ static library first and the dynamic library next, the option
101
102
` --features prefer-static-linking ` may be used.
102
103
103
104
Building from Source
Original file line number Diff line number Diff line change @@ -24,4 +24,5 @@ link-cplusplus = "1.0"
24
24
25
25
[build-dependencies ]
26
26
cmake = " ^0.1.37"
27
+ pkg-config = " 0.3"
27
28
roxmltree = " 0.20"
Original file line number Diff line number Diff line change @@ -211,6 +211,16 @@ fn main() {
211
211
} ;
212
212
}
213
213
214
+ if search_dir. is_none ( ) {
215
+ search_dir = if let Ok ( pkg_lib) = pkg_config:: Config :: new ( ) . probe ( SHADERC_SHARED_LIB0 ) {
216
+ let pkg_dir = pkg_lib. link_paths [ 0 ] . as_path ( ) . to_string_lossy ( ) ;
217
+ println ! ( "cargo:warning=shaderc: searching native shaderc libraries in '{pkg_dir}' from pkg-config" ) ;
218
+ Some ( pkg_dir. to_string ( ) )
219
+ } else {
220
+ None
221
+ } ;
222
+ }
223
+
214
224
// If no explicit path is set and no explicit request is made to build from
215
225
// source, check known system locations before falling back to build from source.
216
226
// This set `search_dir` for later usage.
You can’t perform that action at this time.
0 commit comments