Skip to content

Commit

Permalink
add basic documentation (#24)
Browse files Browse the repository at this point in the history
* Update README with badges and detailed project description

Added multiple badges for status, version, license, and Discord, improving project visibility. Expanded the project description to highlight functionality, platform compatibility, and backend details. Included a link to the demo folder for better usability guidance.

* Update README with usage guide and project description

Added a detailed "How to use" section for integrating the library into multiplatform projects. Clarified the project description to emphasize its role as a Kotlin binding for the wgpu library.

* Update version references in README and build script

Adjusted the displayed version in the README badge to v22.0.1 for consistency. Updated the default version in build.gradle.kts to v22.0.2-SNAPSHOT.
  • Loading branch information
ygdrasil-io authored Jan 19, 2025
1 parent 19b7d38 commit 545d0d3
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 3 deletions.
112 changes: 110 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,111 @@
# wgpu4k-native
# wgpu4k native : a Kotlin binding of wgpu library

This is a subproject of [wgpu4k](https://github.com/wgpu4k/wgpu4k) that fetches native libraries and generates Kotlin multiplatform libraries from them.
[![Tests](https://github.com/wgpu4k/wgpu4k-native/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/wgpu4k/wgpu4k-native/actions/workflows/test.yml)
![Static Badge](https://img.shields.io/badge/Status-Stable-green?style=plastic)
![Static Badge](https://img.shields.io/badge/Latest%20version-v22.0.1-green?style=plastic)
[![Static Badge](https://img.shields.io/badge/Licence-MIT-blue?style=plastic)](https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FMIT_License)
[![Static Badge](https://img.shields.io/badge/Discord-wgpu4k-purple?style=plastic)](https://discord.gg/qy9KQAP9Kc)

## About
This project is a WebGPU binding compatible with Desktop and Mobile.

If you are looking for an experience that also covers the web, you can use the [wgpu4k](https://github.com/wgpu4k/wgpu4k) project.

This library uses the Firefox backend written in Rust, [available here](https://github.com/gfx-rs/wgpu-native).

## How to use

From a basic multiplatform project, create a common native source set and add the library:

``` kotlin
private val hierarchyTemplate = KotlinHierarchyTemplate {
/* natural hierarchy is only applied to default 'main'/'test' compilations (by default) */
withSourceSetTree(KotlinSourceSetTree.main, KotlinSourceSetTree.test)

common {
/* All compilations shall be added to the common group by default */
withCompilations { true }

group("commonNative") {
group("native") {
withNative()

group("apple") {
withApple()

group("ios") {
withIos()
}

group("tvos") {
withTvos()
}

group("watchos") {
withWatchos()
}

group("macos") {
withMacos()
}
}

group("linux") {
withLinux()
}

group("mingw") {
withMingw()
}

}

withJvm()
withAndroidTarget()
}
}
}

kotlin {
...
jvm {
compilerOptions {
jvmTarget = JvmTarget.JVM_22
}
}

iosX64()
iosArm64()
iosSimulatorArm64()
macosArm64()
macosX64()
linuxArm64()
linuxX64()
mingwX64()

androidTarget {
compilerOptions {
jvmTarget = JvmTarget.JVM_22
}

publishLibraryVariants("release", "debug")
}

applyHierarchyTemplate(hierarchyTemplate)

sourceSets {

...
val commonNativeMain by getting {
dependencies { api("io.ygdrasil:wgpu4k-native:<library version>) }
}
...
}
...
}
```
Check the [demo folder](https://github.com/wgpu4k/wgpu4k-native/tree/main/demo) to see how to use the library.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ allprojects {
}

group = "io.ygdrasil"
version = System.getenv("VERSION")?.takeIf { it.isNotBlank() } ?: "v22.0.0-SNAPSHOT"
version = System.getenv("VERSION")?.takeIf { it.isNotBlank() } ?: "v22.0.2-SNAPSHOT"
}


0 comments on commit 545d0d3

Please sign in to comment.