-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,18 @@ | ||
val enablePreview: Boolean by rootProject.ext | ||
|
||
sourceSets { | ||
create("generator") | ||
} | ||
|
||
tasks.named<JavaCompile>("compileGeneratorJava") { | ||
javaCompiler.set(javaToolchains.compilerFor { | ||
languageVersion.set(JavaLanguageVersion.of(20)) | ||
}) | ||
} | ||
|
||
tasks.register<JavaExec>("generate") { | ||
classpath(sourceSets["generator"].runtimeClasspath) | ||
jvmArgs("--enable-preview") | ||
if (enablePreview) jvmArgs("--enable-preview") | ||
mainClass.set("overrungl.opengl.OpenGLGenerator") | ||
workingDir = File("src/main/java/overrungl/opengl") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
val enablePreview: Boolean by rootProject.ext | ||
|
||
sourceSets { | ||
create("generator") | ||
} | ||
|
||
tasks.named<JavaCompile>("compileGeneratorJava") { | ||
javaCompiler.set(javaToolchains.compilerFor { | ||
targetCompatibility = "20" | ||
}) | ||
} | ||
|
||
tasks.register<JavaExec>("generate") { | ||
classpath(sourceSets["generator"].runtimeClasspath) | ||
if (enablePreview) jvmArgs("--enable-preview") | ||
mainClass.set("overrungl.stb.STBGeneratorKt") | ||
workingDir = File("src/main/java/overrungl/stb") | ||
} |
49 changes: 49 additions & 0 deletions
49
modules/overrungl.stb/src/generator/kotlin/overrungl/stb/STBGenerator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) 2023 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.stb | ||
|
||
class Function { | ||
} | ||
|
||
class STBClass { | ||
private val functions = ArrayList<Function>() | ||
|
||
operator fun String.invoke(name: String) { | ||
} | ||
|
||
fun generate() { | ||
TODO() | ||
} | ||
} | ||
|
||
operator fun String.invoke(block: STBClass.() -> Unit) { | ||
STBClass().also(block).generate() | ||
} | ||
|
||
fun vorbis() { | ||
"STBVorbis" { | ||
"stb_vorbis_get_info"("getInfo") | ||
} | ||
} | ||
|
||
/** | ||
* @author squid233 | ||
* @since 0.1.0 | ||
*/ | ||
fun main() { | ||
vorbis() | ||
} |