Skip to content

Commit

Permalink
Merge pull request #42 from Over-Run/stb-nfd
Browse files Browse the repository at this point in the history
[NFD] Rewrite NFD; [STB] Add STBRectPack
  • Loading branch information
squid233 authored Jan 30, 2024
2 parents 021f949 + 5680fb6 commit 06cfc42
Show file tree
Hide file tree
Showing 20 changed files with 945 additions and 783 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ jobs:
os: [ ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: |
${{ matrix.java }}
Expand All @@ -35,15 +35,15 @@ jobs:
with:
arguments: build --no-daemon -x :samples:test
- name: Upload build reports
if: failure()
uses: actions/upload-artifact@v3
if: ${{ runner.os == 'Linux' && matrix.java == '22-ea' && failure() }}
uses: actions/upload-artifact@v4
with:
name: build-reports
path: |
modules/**/build/reports/
- name: Capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '22-ea' }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Artifacts
path: |
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots" }
| stb_image_resize | Resize images larger/smaller with good quality. |
| stb_image_write | Image writing to disk: PNG, TGA, BMP |
| stb_perlin | Revised Perlin noise (3D input, 1D output). |
| stb_rect_pack | Simple 2D rectangle packer with decent quality. |
| stb_truetype | Parse, decode, and rasterize characters from truetype fonts. |
| stb_vorbis | Decode ogg vorbis files from file/memory to float/16-bit signed output. |

Expand Down
174 changes: 90 additions & 84 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
`java-platform`
`maven-publish`
signing
id("me.champeau.jmh") version "0.7.1" apply false
id("me.champeau.jmh") version "0.7.2" apply false
embeddedKotlin("jvm") apply false
}

Expand All @@ -34,10 +34,6 @@ val overrunMarshalVersion: String by rootProject
group = projGroupId
version = projVersion

project(":core").ext["subName"] = ""
Artifact.values().forEach { project(it.subprojectName).ext["subName"] = "-${it.subprojectName.substring(1)}" }
project(":samples").ext["subName"] = "-samples"

enum class NativePlatform(
val osFamilyName: String,
val osArch: String,
Expand Down Expand Up @@ -82,7 +78,8 @@ enum class Artifact(
val projectDescription: String,
val subprojectName: String,
val mavenName: String,
val nativeBinding: NativeBinding? = null
val nativeBinding: NativeBinding? = null,
val nativeCIVersion: String? = null
) {
CORE(
"overrungl", "OverrunGL",
Expand Down Expand Up @@ -112,7 +109,7 @@ enum class Artifact(
STB(
"overrungl-stb", "OverrunGL - stb bindings",
"Single-file public domain libraries for fonts, images, ogg vorbis files and more.",
":stb", "Stb", NativeBinding.STB
":stb", "Stb", NativeBinding.STB, nativeCIVersion = "0.1.0-alpha.6"
),
//VULKAN("overrungl-vulkan", "OverrunGL - Vulkan bindings",
// "A new generation graphics and compute API that provides high-efficiency, cross-platform access to modern GPUs used in a wide variety of devices from PCs and consoles to mobile phones and embedded platforms.",
Expand All @@ -125,95 +122,104 @@ enum class Artifact(
}
}

subprojects {
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "java-library")
apply(plugin = "idea")
apply(plugin = "me.champeau.jmh")

group = projGroupId
version = projVersion
val artifactName = "$projArtifactId${ext["subName"]}"

repositories {
mavenCentral()
// temporary maven repositories
maven { url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots") }
maven { url = uri("https://s01.oss.sonatype.org/content/repositories/releases") }
maven { url = uri("https://maven.aliyun.com/repository/central") }
}
Artifact.values().forEach { project(it.subprojectName).ext["subName"] = "-${it.subprojectName.substring(1)}" }
project(Artifact.CORE.subprojectName).ext["subName"] = ""
project(":samples").ext["subName"] = "-samples"

val annotationProcessor by configurations
val api by configurations
val compileOnly by configurations
val implementation by configurations
dependencies {
compileOnly("org.jetbrains:annotations:24.1.0")
api("io.github.over-run:marshal:$overrunMarshalVersion")
if (project.name != "core") {
implementation(project(":core"))
buildList {
addAll(Artifact.values().map { it.subprojectName })
add(":samples")
}.forEach {
project(it) {
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "java-library")
apply(plugin = "idea")
apply(plugin = "me.champeau.jmh")

group = projGroupId
version = projVersion
val artifactName = "$projArtifactId${ext["subName"]}"

repositories {
mavenCentral()
// temporary maven repositories
maven { url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots") }
maven { url = uri("https://s01.oss.sonatype.org/content/repositories/releases") }
maven { url = uri("https://maven.aliyun.com/repository/central") }
}
}

tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
if (jdkEnablePreview.toBoolean()) options.compilerArgs.add("--enable-preview")
options.release.set(targetJavaVersion)
}
val annotationProcessor by configurations
val api by configurations
val compileOnly by configurations
val implementation by configurations
dependencies {
compileOnly("org.jetbrains:annotations:24.1.0")
api("io.github.over-run:marshal:$overrunMarshalVersion")
if (project.name != "core") {
implementation(project(Artifact.CORE.subprojectName))
}
}

tasks.withType<KotlinCompile> {
kotlinOptions { jvmTarget = kotlinTargetJdkVersion }
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
if (jdkEnablePreview.toBoolean()) options.compilerArgs.add("--enable-preview")
options.release.set(targetJavaVersion)
}

tasks.withType<Test> {
if (jdkEnablePreview.toBoolean()) jvmArgs("--enable-preview")
}
tasks.withType<KotlinCompile> {
kotlinOptions { jvmTarget = kotlinTargetJdkVersion }
}

extensions.configure<JavaPluginExtension>("java") {
val javaVersion = JavaVersion.toVersion(targetJavaVersion)
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion.set(JavaLanguageVersion.of(targetJavaVersion))
tasks.withType<Test> {
if (jdkEnablePreview.toBoolean()) jvmArgs("--enable-preview")
}
withJavadocJar()
withSourcesJar()
}

tasks.named<Jar>("jar") {
manifestContentCharset = "utf-8"
metadataCharset = "utf-8"
manifest.attributes(
"Specification-Title" to projName,
"Specification-Vendor" to "Overrun Organization",
"Specification-Version" to projVersion.split('.', limit = 2)[0],
"Implementation-Title" to projName,
"Implementation-Vendor" to "Overrun Organization",
"Implementation-Version" to projVersion
)
archiveBaseName.set(artifactName)
from("LICENSE")
}
extensions.configure<JavaPluginExtension>("java") {
val javaVersion = JavaVersion.toVersion(targetJavaVersion)
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion.set(JavaLanguageVersion.of(targetJavaVersion))
}
withJavadocJar()
withSourcesJar()
}

tasks.named<Jar>("sourcesJar") {
dependsOn(tasks["classes"])
archiveBaseName.set(artifactName)
archiveClassifier.set("sources")
from(sourceSets["main"].allSource, "LICENSE")
}
tasks.named<Jar>("jar") {
manifestContentCharset = "utf-8"
metadataCharset = "utf-8"
manifest.attributes(
"Specification-Title" to projName,
"Specification-Vendor" to "Overrun Organization",
"Specification-Version" to projVersion.split('.', limit = 2)[0],
"Implementation-Title" to projName,
"Implementation-Vendor" to "Overrun Organization",
"Implementation-Version" to projVersion
)
archiveBaseName.set(artifactName)
from("LICENSE")
}

tasks.named<Jar>("javadocJar") {
val javadoc by tasks
dependsOn(javadoc)
archiveBaseName.set(artifactName)
archiveClassifier.set("javadoc")
from(javadoc, "LICENSE")
}
tasks.named<Jar>("sourcesJar") {
dependsOn(tasks["classes"])
archiveBaseName.set(artifactName)
archiveClassifier.set("sources")
from(sourceSets["main"].allSource, "LICENSE")
}

artifacts {
archives(tasks["sourcesJar"])
archives(tasks["javadocJar"])
}
tasks.named<Jar>("javadocJar") {
val javadoc by tasks
dependsOn(javadoc)
archiveBaseName.set(artifactName)
archiveClassifier.set("javadoc")
from(javadoc, "LICENSE")
}

the<IdeaModel>().module.inheritOutputDirs = true
artifacts {
archives(tasks["sourcesJar"])
archives(tasks["javadocJar"])
}

the<IdeaModel>().module.inheritOutputDirs = true
}
}

tasks.register("assembleJavadocArgs") {
Expand Down
5 changes: 3 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jdkEnablePreview=true
jdkEarlyAccessDoc=jdk22
kotlinTargetJdkVersion=21

projModules=core, glfw, nfd, joml, opengl, stb
overrunMarshalVersion=0.1.0-alpha.8-jdk22
overrunMarshalVersion=0.1.0-alpha.9-jdk22
overrunPlatformVersion=1.0.0

cLibraryVersion=0.1.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public final class OverrunGL {
/**
* The version of STB native libraries.
*/
public static final String STB_VERSION = "0.1.0.1";
public static final String STB_VERSION = "0.1.0.2";
private static final Consumer<String> DEFAULT_LOGGER = System.err::println;
private static Consumer<String> apiLogger = DEFAULT_LOGGER;

Expand Down
Loading

0 comments on commit 06cfc42

Please sign in to comment.