Skip to content

Commit

Permalink
add wgpu-native 0.19.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Sahnvour committed May 12, 2024
1 parent 419272f commit a384f69
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 0 deletions.
40 changes: 40 additions & 0 deletions recipes/wgpu_native/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
sources:
"0.19.4.1":
Linux:
"x86_64":
Release:
url: "https://github.com/gfx-rs/wgpu-native/releases/download/v0.19.4.1/wgpu-linux-x86_64-release.zip"
sha256: "7d73bd7af2be60b632e5ab814996acb381d1b459975d6629f91c468049c8866a"
Debug:
url: "https://github.com/gfx-rs/wgpu-native/releases/download/v0.19.4.1/wgpu-linux-x86_64-debug.zip"
sha256: "1feb5419a84eb2a5710b5686b8f8c30c70f24cea5c39774853c2c5406a3857fd"
"armv8":
Release:
url: "https://github.com/gfx-rs/wgpu-native/releases/download/v0.19.4.1/wgpu-linux-aarch64-release.zip"
sha256: "6e53aa3f0aec4b2b65cb0d7635000cf39bddd672bcb6138a593bf8cb8134f621"
Debug:
url: "https://github.com/gfx-rs/wgpu-native/releases/download/v0.19.4.1/wgpu-linux-aarch64-debug.zip"
sha256: "0b0598c2dda670c9c02379ba23d3ab36a6a4d4b113ba916419f92a7e7618ebee"
Windows:
"x86_64":
Release:
url: "https://github.com/gfx-rs/wgpu-native/releases/download/v0.19.4.1/wgpu-windows-x86_64-release.zip"
sha256: "9e1591d60c2d2ee20d6d4a63bc01c7c5eecf7734761673160aa639e550a1ba4d"
Debug:
url: "https://github.com/gfx-rs/wgpu-native/releases/download/v0.19.4.1/wgpu-windows-x86_64-debug.zip"
sha256: "cac41053da833f7f40ba56fb58561ee66a373cb2e96f1658b243b7edfa3b8767"
Macos:
"x86_64":
Release:
url: "https://github.com/gfx-rs/wgpu-native/releases/download/v0.19.4.1/wgpu-macos-x86_64-release.zip"
sha256: "e41a35bf4f2b1c7dd87092cfcb932b7a96118971129a6213b7be240deb07e614"
Debug:
url: "https://github.com/gfx-rs/wgpu-native/releases/download/v0.19.4.1/wgpu-macos-x86_64-debug.zip"
sha256: "e0f4628ce95f98295079fa6c35545d1c60fa6e82e9c7dcc5f07d35b5b1898346"
"armv8":
Release:
url: "https://github.com/gfx-rs/wgpu-native/releases/download/v0.19.4.1/wgpu-macos-aarch64-release.zip"
sha256: "21cf8e69a4a775ea63f437f170a93e371df0f72c83119c81c25a668611c1771d"
Debug:
url: "https://github.com/gfx-rs/wgpu-native/releases/download/v0.19.4.1/wgpu-macos-aarch64-debug.zip"
sha256: "f8f93d888f4f9d2d7252a638e9c8f432ef0125f436c4b6735ce91dcfbd64c676"
52 changes: 52 additions & 0 deletions recipes/wgpu_native/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.files import copy, get
import os


class wgpu_nativeConanfile(ConanFile):
name = "wgpu_native"
description = "Native WebGPU implementation based on wgpu-core"
license = "MIT OR Apache-2.0"
homepage = "https://github.com/gfx-rs/wgpu-native"
url = "https://github.com/conan-io/conan-center-index"
topics = ("webgpu", "wgpu", "gpu", "graphics", "rendering", "3d", "2d")

settings = "os", "build_type", "arch"
options = {"shared": [True, False]}
default_options = {"shared": False}


def validate(self):
os = self.settings.os

Check warning on line 21 in recipes/wgpu_native/all/conanfile.py

View workflow job for this annotation

GitHub Actions / Lint changed conanfile.py (v2 migration)

Redefining name 'os' from outer scope (line 4)
if os not in ("Linux", "Windows", "Macos"):
raise ConanInvalidConfiguration(f"No prebuilt binaries exist for your OS ({os})")

arch = self.settings.arch
if arch not in ("x86_64", "armv8"):
raise ConanInvalidConfiguration(f"No prebuilt binaries exist for your architecture ({arch})")

if os is "Windows" and arch is not "x86_64":
raise ConanInvalidConfiguration(f"No prebuilt binaries exist for your architecture ({arch})")

if self.settings.build_type not in ("Debug", "Release"):
raise ConanInvalidConfiguration("Only Debug and Release build types are supported")

def build(self):
os = str(self.settings.os)

Check warning on line 36 in recipes/wgpu_native/all/conanfile.py

View workflow job for this annotation

GitHub Actions / Lint changed conanfile.py (v2 migration)

Redefining name 'os' from outer scope (line 4)
arch = str(self.settings.arch)
build_type = str(self.settings.build_type)
get(self, **self.conan_data["sources"][self.version][os][arch][build_type])

def package(self):
copy(self, pattern="*.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include"), keep_path=False)

patterns = ["*.so", "*.dll", "*.dylib"] if self.options.shared else ["*.a", "*.lib"]
for p in patterns:
copy(self, pattern=p, src=self.source_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False)

def package_info(self):
self.cpp_info.libs = ["wgpu_native"]

if self.settings.os is "Linux":
self.cpp_info.system_libs.extend(["m", "pthread", "dl"])
26 changes: 26 additions & 0 deletions recipes/wgpu_native/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import os
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.meson import MesonToolchain, Meson

Check warning on line 4 in recipes/wgpu_native/all/test_package/conanfile.py

View workflow job for this annotation

GitHub Actions / Lint changed test_package/conanfile.py (v2 migration)

Unused MesonToolchain imported from conan.tools.meson
from conan.tools.layout import basic_layout


class wgpu_nativeTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "PkgConfigDeps", "MesonToolchain"

def requirements(self):
self.requires(self.tested_reference_str)

def build(self):
meson = Meson(self)
meson.configure()
meson.build()

def layout(self):
basic_layout(self)

def test(self):
if can_run(self):
cmd = os.path.join(self.cpp.build.bindir, "example")
self.run(cmd, env="conanrun")
3 changes: 3 additions & 0 deletions recipes/wgpu_native/all/test_package/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
project('Testwgpu-native', 'cpp')
wgpu_native = dependency('wgpu_native', version: '>=0.19.4.1')
executable('example', 'src/example.cpp', dependencies: wgpu_native)
9 changes: 9 additions & 0 deletions recipes/wgpu_native/all/test_package/src/example.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "webgpu.h"
#include "wgpu.h"

#include <cstdlib>

int main() {
uint32_t version = wgpuGetVersion();
return version >= 1246209 ? EXIT_SUCCESS : EXIT_FAILURE;
}
3 changes: 3 additions & 0 deletions recipes/wgpu_native/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"0.19.4.1":
folder: all

0 comments on commit a384f69

Please sign in to comment.