Skip to content

Commit

Permalink
[Vulkan] Prepare Vulkan
Browse files Browse the repository at this point in the history
  • Loading branch information
squid233 committed Apr 14, 2024
1 parent 9240063 commit 260ae89
Show file tree
Hide file tree
Showing 145 changed files with 31,749 additions and 53 deletions.
6 changes: 3 additions & 3 deletions buildSrc/src/main/kotlin/myproject.java-conventions.gradle.kt
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ enum class Artifact(
"Single-file public domain libraries for fonts, images, ogg vorbis files and more.",
":stb", "Stb", NativeBinding.STB
),
//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.",
// ":vulkan", "Vulkan", null),
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.",
":vulkan", "Vulkan", null),
;

fun nativeFileName(platform: NativePlatform): String? {
Expand Down
48 changes: 48 additions & 0 deletions generators/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
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 { embeddedKotlin("jvm") }

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> {
kotlinOptions { jvmTarget = kotlinTargetJdkVersion }
}

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

subprojects {
val implementation by configurations

dependencies {
implementation(project(":generators"))
}
}
20 changes: 0 additions & 20 deletions generators/opengl/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,25 +1,5 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
embeddedKotlin("jvm")
}

repositories { mavenCentral() }

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

tasks.withType<KotlinCompile> {
kotlinOptions { jvmTarget = kotlinTargetJdkVersion }
}

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

tasks.register<JavaExec>("generate") {
classpath(sourceSets["main"].runtimeClasspath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

package overrungl.opengl

import overrungl.gen.fileHeader
import overrungl.opengl.OpenGLExt.*
import java.nio.file.Files
import kotlin.io.path.Path
Expand Down Expand Up @@ -64,24 +65,6 @@ data class Type(val name: String, val layout: String?) {
override fun toString(): String = name
}

const val fileHeader = """/*
* MIT License
*
* Copyright (c) 2022-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.
*/
// This file is auto-generated. DO NOT EDIT!"""

private val generatedFunctions = ArrayList<Function>()
private val generatedExtFunctions = ArrayList<Function>()
private val generatedClasses = ArrayList<OpenGLFile>()
Expand Down
33 changes: 33 additions & 0 deletions generators/src/main/kotlin/overrungl/gen/constants.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package overrungl.gen/*
* 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.
*/

const val fileHeader = """/*
* MIT License
*
* Copyright (c) 2022-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.
*/
// This file is auto-generated. DO NOT EDIT!"""
28 changes: 28 additions & 0 deletions generators/vulkan/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* 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.
*/

val jdkVersion: String by rootProject
val jdkEnablePreview: String by rootProject

tasks.register<JavaExec>("generate") {
classpath(sourceSets["main"].runtimeClasspath)
javaLauncher.set(javaToolchains.launcherFor {
languageVersion.set(JavaLanguageVersion.of(jdkVersion))
})
if (jdkEnablePreview.toBoolean()) jvmArgs("--enable-preview")
mainClass.set("overrungl.vulkan.VulkanGeneratorKt")
workingDir = project(":vulkan").projectDir.resolve("src/main/java/overrungl/vulkan")
}
Loading

0 comments on commit 260ae89

Please sign in to comment.