Skip to content

Commit

Permalink
Make dynamic linking default for crates.io.
Browse files Browse the repository at this point in the history
  • Loading branch information
kenba committed Dec 15, 2024
1 parent 3410826 commit 96df90b
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 27 deletions.
56 changes: 34 additions & 22 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,42 @@ env:
CARGO_TERM_COLOR: always

jobs:
# Tests "runs-on:" a GPU hosted runner which requires an enterprise subscription...
# test:
# name: Tests
# runs-on: ubuntu-latest
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable
- name: Unit test
run: cargo check

build:
name: Build
runs-on: ubuntu-latest

# steps:
# - name: Load OpenCL
# run: |
# wget -qO - https://repositories.intel.com/graphics/intel-graphics.key |
# sudo apt-key add -
# sudo add-apt-repository \
# 'deb [arch=amd64] https://repositories.intel.com/graphics/ubuntu focal main'
# sudo apt-get update
# sudo apt-get install \
# intel-opencl-icd \
# intel-level-zero-gpu level-zero \
# intel-media-va-driver-non-free libmfx1
# sudo apt-get install ocl-icd-opencl-dev
steps:
- name: Load OpenCL
run: |
wget -qO - https://repositories.intel.com/graphics/intel-graphics.key |
sudo apt-key add -
sudo add-apt-repository \
'deb [arch=amd64] https://repositories.intel.com/graphics/ubuntu focal main'
sudo apt-get update
sudo apt-get install \
intel-opencl-icd \
intel-level-zero-gpu level-zero \
intel-media-va-driver-non-free libmfx1
sudo apt-get install ocl-icd-opencl-dev
# - uses: actions/checkout@v4
# - name: Install Rust
# run: rustup update stable
# - name: Unit test
# run: cargo test --verbose -- --test-threads=1
- uses: actions/checkout@v4
- name: Install Rust
run: rustup update stable
- name: Build
run: cargo build --verbose
# Tests "runs-on:" a GPU hosted runner which requires an enterprise subscription...
# - name: Run tests
# run: cargo test -- --test-threads=1

clippy:
name: Clippy
Expand Down
9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,17 @@ cl_loader_layers = ["cl3/cl_loader_layers"]
# Use dynamic linking instead of static linking
dynamic = ["cl3/dynamic"]

# Default features:
default = ["dynamic"]

[dependencies]
libc = "0.2"
# cl3 = "0.10"
cl3 = { git = "https://github.com/kenba/cl3", branch = "develop" }
cl3 = "0.11"
serde = { version = "1.0", optional = true }

[dev-dependencies]
serde_json = "1.0"
opencl3 = { path = ".", features = ["serde", "static", "CL_VERSION_1_1", "CL_VERSION_1_2", "CL_VERSION_2_0"] }
# opencl3 = { path = ".", features = ["serde", "dynamic"] }
opencl3 = { path = ".", features = ["dynamic", "serde"] }

[lints.clippy]
enum_glob_use = "deny"
Expand Down
2 changes: 1 addition & 1 deletion src/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ pub fn get_platforms() -> Result<Vec<Platform>> {
.collect::<Vec<Platform>>())
}

#[cfg(feature = "cl_khr_icd")]
#[cfg(any(feature = "cl_khr_icd", feature = "dynamic"))]
pub fn icd_get_platform_ids_khr() -> Result<Vec<Platform>> {
let platform_ids = ext::icd_get_platform_ids_khr()?;
Ok(platform_ids
Expand Down

0 comments on commit 96df90b

Please sign in to comment.