Skip to content

Commit cb59ba9

Browse files
committed
work on this
1 parent e912e57 commit cb59ba9

File tree

13 files changed

+565
-158
lines changed

13 files changed

+565
-158
lines changed

.github/workflows/CI.yaml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: CI
2+
3+
permissions:
4+
pages: write
5+
id-token: write
6+
7+
on:
8+
push:
9+
branches: [ master ]
10+
pull_request:
11+
branches: [ master ]
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
rust: [stable, beta, nightly]
20+
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
with:
25+
submodules: true
26+
27+
- name: Set up Rust
28+
uses: actions-rs/toolchain@v1
29+
with:
30+
toolchain: ${{ matrix.rust }}
31+
override: true
32+
components: rustfmt, clippy
33+
34+
- name: Cache Cargo registry
35+
uses: actions/cache@v4
36+
with:
37+
path: |
38+
~/.cargo/registry
39+
~/.cargo/git
40+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
41+
restore-keys: |
42+
${{ runner.os }}-cargo-registry-
43+
44+
- name: Build
45+
run: cargo build --verbose --workspace --all-targets --all-features
46+
47+
- name: Run cargo check
48+
run: cargo check --verbose --workspace --all-targets --all-features
49+
50+
- name: Run Clippy
51+
run: cargo clippy --verbose --workspace --all-targets --all-features -- -D warnings
52+
53+
- name: Check formatting
54+
run: cargo fmt --all -- --check
55+
56+
- name: Run tests
57+
run: cargo test --verbose --workspace --all-targets --all-features --no-fail-fast --lib --bins --examples --tests --benches
58+
59+
- name: Check for uncommitted changes
60+
run: git diff --exit-code
61+
62+
- name: Generate cargo docs
63+
if: ${{ github.event_name == 'push' && matrix.rust == 'stable' }}
64+
run: cargo doc --workspace --no-deps
65+
66+
- name: Upload artifact
67+
if: ${{ github.event_name == 'push' && matrix.rust == 'stable' }}
68+
uses: actions/upload-pages-artifact@v3
69+
with:
70+
path: "./target/doc"
71+
72+
- name: Deploy to GitHub Pages
73+
if: ${{ github.event_name == 'push' && matrix.rust == 'stable' }}
74+
id: deployment
75+
uses: actions/deploy-pages@v4

Cargo.lock

Lines changed: 28 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ categories = ["command-line-utilities"]
1111
readme = "README.md"
1212

1313
[features]
14-
default = ["linked"]
15-
linked = ["ash/linked"]
14+
default = ["ash/linked"]
1615
loaded = ["ash/loaded"]
1716

1817
[dependencies]
19-
ash ={version = "0.38.0", default-features = false, features = ["std"] }
18+
ash = { version = "0.38.0", default-features = false, features = ["std"] }
19+
20+
[build-dependencies]
21+
pkg-config = "0.3.31"

build.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
fn main() {
2+
match pkg_config::probe_library("vulkan") {
3+
Ok(_) => {}
4+
Err(e) => {
5+
panic!(
6+
"Feature `vulkan` is enabled but failed to find the Vulkan loader: {}",
7+
e
8+
);
9+
}
10+
}
11+
}

flake.lock

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
description = "Rust development environment";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
};
8+
9+
outputs = {
10+
self,
11+
nixpkgs,
12+
flake-utils,
13+
}:
14+
flake-utils.lib.eachDefaultSystem (
15+
system: let
16+
pkgs = nixpkgs.legacyPackages.${system};
17+
libPath = with pkgs;
18+
lib.makeLibraryPath [
19+
# load external libraries that you need in your rust project here
20+
];
21+
in {
22+
devShells.default = pkgs.mkShell rec {
23+
nativeBuildInputs = [pkgs.pkg-config];
24+
buildInputs = with pkgs; [
25+
clang
26+
llvmPackages.bintools
27+
rustup
28+
git
29+
vulkan-loader
30+
];
31+
32+
RUSTC_VERSION = "stable";
33+
34+
# https://github.com/rust-lang/rust-bindgen#environment-variables
35+
LIBCLANG_PATH = pkgs.lib.makeLibraryPath [pkgs.llvmPackages_latest.libclang.lib];
36+
37+
shellHook = ''
38+
export PATH=$PATH:''${CARGO_HOME:-~/.cargo}/bin
39+
export PATH=$PATH:''${RUSTUP_HOME:-~/.rustup}/toolchains/$RUSTC_VERSION-x86_64-unknown-linux-gnu/bin/
40+
41+
export LD_LIBRARY_PATH="${libPath}:$LD_LIBRARY_PATH";
42+
export LIBCLANG_PATH="${pkgs.llvmPackages.libclang.lib}/lib"
43+
fish
44+
'';
45+
46+
# Add precompiled library to rustc search path
47+
RUSTFLAGS = builtins.map (a: ''-L ${a}/lib'') [
48+
# add libraries here (e.g. pkgs.libvmi)
49+
];
50+
51+
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (buildInputs ++ nativeBuildInputs);
52+
53+
# Add glibc, clang, glib, and other headers to bindgen search path
54+
BINDGEN_EXTRA_CLANG_ARGS =
55+
# Includes normal include path
56+
(builtins.map (a: ''-I"${a}/include"'') [
57+
# add dev libraries here (e.g. pkgs.libvmi.dev)
58+
pkgs.glibc.dev
59+
])
60+
# Includes with special directory paths
61+
++ [
62+
''-I"${pkgs.llvmPackages_latest.libclang.lib}/lib/clang/${pkgs.llvmPackages_latest.libclang.version}/include"''
63+
''-I"${pkgs.glib.dev}/include/glib-2.0"''
64+
''-I${pkgs.glib.out}/lib/glib-2.0/include/''
65+
];
66+
};
67+
}
68+
);
69+
}

lint.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

shell.nix

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)