-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create shaderc-sys for FFI, building, and linking (#46)
This commit creates a new shaderc-sys crate for Shaderc library FFI, building and linking. This change separates the concerns and is the recommended way of handling low-level C libraries. This commit also enhances Shaderc-sys with the ability to detect and use pre-built Shaderc libraries. It has the following building and linking behavior: 1. The option `--features build-from-source` will prevent automatic library detection and force building from source. 2. If the `SHADERC_LIB_DIR` environment variable is set to `/path/to/shaderc/libs/`, it will take precedence and `libshaderc_combined.a` (and the glsang and SPIRV libraries on Linux) will be searched in the `/path/to/shaderc/libs/` directory. 3. On Linux, `/usr/lib/` will be automatically searched for system libraries if none of the above were given. 4. If no other option was set or succeeded, shaderc-sys will fall back to checking out and compiling a copy of shaderc. This procedure is quite slow. This commit also bumps version to 0.5.0. Version 0.4.0 has been skipped and tag will not be used. History for a prospective split at 0.4.0 into two repos has been obliterated.
- Loading branch information
1 parent
367a4dd
commit 675231a
Showing
15 changed files
with
691 additions
and
396 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
[submodule "build/spirv-headers"] | ||
path = build/spirv-headers | ||
path = shaderc-sys/build/spirv-headers | ||
url = https://github.com/KhronosGroup/SPIRV-Headers.git | ||
[submodule "build/spirv-tools"] | ||
path = build/spirv-tools | ||
path = shaderc-sys/build/spirv-tools | ||
url = https://github.com/KhronosGroup/SPIRV-Tools.git | ||
[submodule "build/glslang"] | ||
path = build/glslang | ||
path = shaderc-sys/build/glslang | ||
url = https://github.com/KhronosGroup/glslang.git | ||
[submodule "build/shaderc"] | ||
path = build/shaderc | ||
path = shaderc-sys/build/shaderc | ||
url = https://github.com/google/shaderc.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,5 @@ | ||
[package] | ||
name = "shaderc" | ||
version = "0.3.16" | ||
authors = ["Lei Zhang <antiagainst@gmail.com>"] | ||
|
||
build = "build/build.rs" | ||
|
||
description = "Rust bindings for shaderc" | ||
documentation = "https://docs.rs/shaderc" | ||
repository = "https://github.com/google/shaderc-rs" | ||
readme = "README.md" | ||
license = "Apache-2.0" | ||
keywords = ["shader", "compiler", "spirv", "glsl", "hlsl"] | ||
|
||
[lib] | ||
path = "src/lib.rs" | ||
|
||
[features] | ||
default = ["build-native-shaderc"] | ||
build-native-shaderc = [] # Clone and build the native C++ shaderc project | ||
|
||
[dependencies] | ||
libc = "0.2" | ||
|
||
[dev-dependencies] | ||
assert_matches = "1.3" | ||
|
||
[build-dependencies] | ||
cmake = "0.1" | ||
[workspace] | ||
members = [ | ||
"shaderc-rs", | ||
"shaderc-sys" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[package] | ||
name = "shaderc" | ||
version = "0.5.0" | ||
authors = ["Lei Zhang <antiagainst@gmail.com>"] | ||
description = "Rust bindings for shaderc" | ||
documentation = "https://docs.rs/shaderc" | ||
repository = "https://github.com/google/shaderc-rs" | ||
readme = "../README.md" | ||
license = "Apache-2.0" | ||
keywords = ["shader", "compiler", "spirv", "glsl", "hlsl"] | ||
|
||
[lib] | ||
path = "src/lib.rs" | ||
|
||
[dependencies] | ||
libc = "0.2" | ||
shaderc-sys = { version = "0.5.0", path = "../shaderc-sys", features = ["check-inverted-no-defaults"] } | ||
|
||
[dev-dependencies] | ||
assert_matches = "1.3" | ||
|
||
[features] | ||
build-from-source = ["shaderc-sys/build-from-source"] | ||
|
||
# NOTE: The following feature is deprecated. It will be removed in the next | ||
# release. | ||
|
||
# The `inverted-no-defaults` behavior is enabled by setting this feature. | ||
check-inverted-no-defaults = ["shaderc-sys/check-inverted-no-defaults"] | ||
# This feature is logically inverted, so you "set" it by clearing it, by passing | ||
# the --no-defaults option to cargo when building this crate. | ||
default = ["shaderc-sys/inverted-no-defaults"] |
Oops, something went wrong.