Skip to content

Commit

Permalink
Merge pull request #59 from Over-Run/update
Browse files Browse the repository at this point in the history
  • Loading branch information
squid233 authored Aug 28, 2024
2 parents 9839838 + 3e59753 commit 766007b
Show file tree
Hide file tree
Showing 21 changed files with 548 additions and 113 deletions.
10 changes: 7 additions & 3 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
plugins {
kotlin("jvm") version "2.0.0"
plugins { `kotlin-dsl` }

dependencies {
implementation("org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:2.0.20")
}

repositories { mavenCentral() }
repositories {
mavenCentral()
}
38 changes: 38 additions & 0 deletions buildSrc/src/main/kotlin/GenerateTask.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import gradle.kotlin.dsl.accessors._8758bf21ec0488ee6f70886b9f0e8378.sourceSets
import org.gradle.api.tasks.JavaExec
import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.provideDelegate

/*
* MIT License
*
* Copyright (c) 2024 Overrun Organization
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*/

/**
* @author squid233
* @since 0.1.0
*/
open class GenerateTask : JavaExec() {
private val jdkVersion: String by project
private val jdkEnablePreview: String by project

init {
classpath(project.sourceSets["main"].runtimeClasspath)
javaLauncher.set(javaToolchainService.launcherFor {
languageVersion.set(JavaLanguageVersion.of(jdkVersion))
})
if (jdkEnablePreview.toBoolean()) jvmArgs("--enable-preview")
}
}
20 changes: 20 additions & 0 deletions buildSrc/src/main/kotlin/generator.java-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins { kotlin("jvm") }

val jdkVersion: String by rootProject
val kotlinTargetJdkVersion: String by rootProject

repositories { mavenCentral() }

tasks.withType<KotlinCompile> {
compilerOptions { jvmTarget.set(JvmTarget.fromTarget(kotlinTargetJdkVersion)) }
}

tasks.withType<JavaCompile> {
javaCompiler.set(javaToolchains.compilerFor {
targetCompatibility = kotlinTargetJdkVersion
languageVersion.set(JavaLanguageVersion.of(jdkVersion))
})
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
/*
* MIT License
*
* Copyright (c) 2024 Overrun Organization
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*/

enum class NativePlatform(
val osFamilyName: String,
val osArch: String,
Expand All @@ -33,16 +17,20 @@ enum class NativePlatform(
WIN_ARM64("windows", "arm64", nativeLibPrefix = "", nativeLibSuffix = ".dll");

val classifier = "natives-$classifier"

companion object {
val enumEntries = values().toList()
}
}

enum class NativeBinding(
val bindingName: String,
val basename: String,
val platforms: List<NativePlatform>
) {
GLFW("glfw", "glfw", NativePlatform.entries),
NFD("nfd", "nfd", NativePlatform.entries),
STB("stb", "stb", NativePlatform.entries)
GLFW("glfw", "glfw", NativePlatform.enumEntries),
NFD("nfd", "nfd", NativePlatform.enumEntries),
STB("stb", "stb", NativePlatform.enumEntries),
}

enum class Artifact(
Expand Down
50 changes: 2 additions & 48 deletions generators/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,49 +1,3 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

/*
* MIT License
*
* Copyright (c) 2024 Overrun Organization
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*/

plugins { kotlin("jvm") version "2.0.0" }

allprojects {
apply(plugin = "org.jetbrains.kotlin.jvm")

val javaToolchains: JavaToolchainService by extensions
val jdkVersion: String by rootProject
val kotlinTargetJdkVersion: String by rootProject

repositories { mavenCentral() }

tasks.withType<KotlinCompile> {
compilerOptions { jvmTarget.set(JvmTarget.fromTarget(kotlinTargetJdkVersion)) }
}

tasks.withType<JavaCompile> {
javaCompiler.set(javaToolchains.compilerFor {
targetCompatibility = kotlinTargetJdkVersion
languageVersion.set(JavaLanguageVersion.of(jdkVersion))
})
}
}

subprojects {
val implementation by configurations

dependencies {
implementation(project(":generators"))
}
plugins {
id("generator.java-conventions")
}
12 changes: 12 additions & 0 deletions generators/nfd/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
plugins {
id("generator.java-conventions")
}

dependencies {
implementation(project(":generators"))
}

tasks.register<GenerateTask>("generate") {
mainClass = "overrungl.nfd.NFDGeneratorKt"
workingDir = project(":nfd").projectDir.resolve("src/main/java/overrungl/nfd")
}
24 changes: 24 additions & 0 deletions generators/nfd/src/main/java/overrungl/nfd/NFDGenerator.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* MIT License
*
* Copyright (c) 2024 Overrun Organization
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*/

package overrungl.nfd

/**
* @author squid233
* @since 0.1.0
*/
fun main() {
}
16 changes: 8 additions & 8 deletions generators/opengl/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
val jdkVersion: String by rootProject
val jdkEnablePreview: String by rootProject
plugins {
id("generator.java-conventions")
}

dependencies {
implementation(project(":generators"))
}

tasks.register<JavaExec>("generate") {
classpath(sourceSets["main"].runtimeClasspath)
javaLauncher.set(javaToolchains.launcherFor {
languageVersion.set(JavaLanguageVersion.of(jdkVersion))
})
if (jdkEnablePreview.toBoolean()) jvmArgs("--enable-preview")
tasks.register<GenerateTask>("generate") {
mainClass.set("overrungl.opengl.OpenGLGeneratorKt")
workingDir = project(":opengl").projectDir.resolve("src/main/java/overrungl/opengl")
}
3 changes: 2 additions & 1 deletion generators/src/main/kotlin/overrungl/gen/constants.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package overrungl.gen/*
/*
* MIT License
*
* Copyright (c) 2024 Overrun Organization
Expand All @@ -13,6 +13,7 @@ package overrungl.gen/*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*/
package overrungl.gen

const val fileHeader = """/*
* MIT License
Expand Down
30 changes: 7 additions & 23 deletions generators/vulkan/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,28 +1,12 @@
/*
* MIT License
*
* Copyright (c) 2024 Overrun Organization
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*/
plugins {
id("generator.java-conventions")
}

val jdkVersion: String by rootProject
val jdkEnablePreview: String by rootProject
dependencies {
implementation(project(":generators"))
}

tasks.register<JavaExec>("generate") {
classpath(sourceSets["main"].runtimeClasspath)
javaLauncher.set(javaToolchains.launcherFor {
languageVersion.set(JavaLanguageVersion.of(jdkVersion))
})
if (jdkEnablePreview.toBoolean()) jvmArgs("--enable-preview")
tasks.register<GenerateTask>("generate") {
mainClass.set("overrungl.vulkan.VulkanGeneratorKt")
workingDir = project(":vulkan").projectDir.resolve("src/main/java/overrungl/vulkan")
}
4 changes: 2 additions & 2 deletions modules/overrungl.core/src/main/java/overrungl/OverrunGL.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ public final class OverrunGL {
/**
* The version of NFD native libraries.
*/
public static final String NFD_VERSION = "1.1.1.0";
public static final String NFD_VERSION = "1.2.1.0";
/**
* The version of STB native libraries.
*/
public static final String STB_VERSION = "0.1.0.4";
public static final String STB_VERSION = "0.1.0.5";
private static final Consumer<String> DEFAULT_LOGGER = System.err::println;
private static Consumer<String> apiLogger = DEFAULT_LOGGER;

Expand Down
Loading

0 comments on commit 766007b

Please sign in to comment.