Fix maven and flake conf
This commit is contained in:
parent
a07c55cf0f
commit
cb0fa04383
8 changed files with 292 additions and 107 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,3 +3,4 @@
|
||||||
target
|
target
|
||||||
.idea/
|
.idea/
|
||||||
*.iml
|
*.iml
|
||||||
|
dependency-reduced-pom.xml
|
15
.vscode/launch.json
vendored
Normal file
15
.vscode/launch.json
vendored
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"type": "java",
|
||||||
|
"name": "App",
|
||||||
|
"request": "launch",
|
||||||
|
"mainClass": "fr.mrdev023.vulkan_java.App",
|
||||||
|
"projectName": "vulkan_java"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"java.configuration.updateBuildConfiguration": "automatic",
|
||||||
|
"java.maven.downloadSources": true,
|
||||||
|
"java.maven.downloadJavadocs": true
|
||||||
|
}
|
21
README.md
Normal file
21
README.md
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# Project
|
||||||
|
|
||||||
|
## Usefull command
|
||||||
|
|
||||||
|
1. Compile
|
||||||
|
|
||||||
|
```console
|
||||||
|
mvn compile
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Run
|
||||||
|
|
||||||
|
```console
|
||||||
|
mvn exec:java
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Package
|
||||||
|
|
||||||
|
```console
|
||||||
|
mvn package
|
||||||
|
```
|
|
@ -10,10 +10,15 @@
|
||||||
flake-utils.lib.eachSystem flake-utils.lib.allSystems (system:
|
flake-utils.lib.eachSystem flake-utils.lib.allSystems (system:
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs { inherit system; };
|
pkgs = import nixpkgs { inherit system; };
|
||||||
|
|
||||||
|
buildInputs = with pkgs; [ vulkan-headers vulkan-loader vulkan-validation-layers renderdoc ];
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
devShells = {
|
devShells = {
|
||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell {
|
||||||
|
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;
|
||||||
|
VK_LAYER_PATH = "${pkgs.vulkan-validation-layers}/share/vulkan/explicit_layer.d:${pkgs.renderdoc}/share/vulkan/implicit_layer.d";
|
||||||
|
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
jdk22
|
jdk22
|
||||||
maven
|
maven
|
||||||
|
|
313
pom.xml
313
pom.xml
|
@ -12,27 +12,184 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<main.class>fr.mrdev023.vulkan_java.App</main.class>
|
||||||
<maven.compiler.release>21</maven.compiler.release>
|
<maven.compiler.release>21</maven.compiler.release>
|
||||||
<lwjgl.version>3.3.4</lwjgl.version>
|
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
|
||||||
|
<maven-shade-plugin.version>3.6.0</maven-shade-plugin.version>
|
||||||
|
<lwjgl.version>3.3.6</lwjgl.version>
|
||||||
<joml.version>1.10.8</joml.version>
|
<joml.version>1.10.8</joml.version>
|
||||||
<tinylog.version>2.7.0</tinylog.version>
|
<tinylog.version>2.7.0</tinylog.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>lwjgl-natives-linux-amd64</id>
|
||||||
|
<activation>
|
||||||
|
<os>
|
||||||
|
<family>unix</family>
|
||||||
|
<name>linux</name>
|
||||||
|
<arch>amd64</arch>
|
||||||
|
</os>
|
||||||
|
</activation>
|
||||||
|
<properties>
|
||||||
|
<lwjgl.natives>natives-linux</lwjgl.natives>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
|
<profile>
|
||||||
|
<id>lwjgl-natives-linux-aarch64</id>
|
||||||
|
<activation>
|
||||||
|
<os>
|
||||||
|
<family>unix</family>
|
||||||
|
<name>linux</name>
|
||||||
|
<arch>aarch64</arch>
|
||||||
|
</os>
|
||||||
|
</activation>
|
||||||
|
<properties>
|
||||||
|
<lwjgl.natives>natives-linux-arm64</lwjgl.natives>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
|
<profile>
|
||||||
|
<id>lwjgl-natives-macos-aarch64</id>
|
||||||
|
<activation>
|
||||||
|
<os>
|
||||||
|
<family>mac</family>
|
||||||
|
<arch>aarch64</arch>
|
||||||
|
</os>
|
||||||
|
</activation>
|
||||||
|
<properties>
|
||||||
|
<lwjgl.natives>natives-macos-arm64</lwjgl.natives>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.lwjgl</groupId>
|
||||||
|
<artifactId>lwjgl-vulkan</artifactId>
|
||||||
|
<classifier>natives-macos-arm64</classifier>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</profile>
|
||||||
|
<profile>
|
||||||
|
<id>lwjgl-natives-windows-amd64</id>
|
||||||
|
<activation>
|
||||||
|
<os>
|
||||||
|
<family>windows</family>
|
||||||
|
<arch>amd64</arch>
|
||||||
|
</os>
|
||||||
|
</activation>
|
||||||
|
<properties>
|
||||||
|
<lwjgl.natives>natives-windows</lwjgl.natives>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
|
<profile>
|
||||||
|
<id>lwjgl-natives-windows-aarch64</id>
|
||||||
|
<activation>
|
||||||
|
<os>
|
||||||
|
<family>windows</family>
|
||||||
|
<arch>aarch64</arch>
|
||||||
|
</os>
|
||||||
|
</activation>
|
||||||
|
<properties>
|
||||||
|
<lwjgl.natives>natives-windows-arm64</lwjgl.natives>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.lwjgl</groupId>
|
||||||
|
<artifactId>lwjgl-bom</artifactId>
|
||||||
|
<version>${lwjgl.version}</version>
|
||||||
|
<scope>import</scope>
|
||||||
|
<type>pom</type>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.lwjgl</groupId>
|
<groupId>org.lwjgl</groupId>
|
||||||
<artifactId>lwjgl</artifactId>
|
<artifactId>lwjgl</artifactId>
|
||||||
<version>${lwjgl.version}</version>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.lwjgl</groupId>
|
||||||
|
<artifactId>lwjgl-assimp</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.lwjgl</groupId>
|
<groupId>org.lwjgl</groupId>
|
||||||
<artifactId>lwjgl-glfw</artifactId>
|
<artifactId>lwjgl-glfw</artifactId>
|
||||||
<version>${lwjgl.version}</version>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.lwjgl</groupId>
|
||||||
|
<artifactId>lwjgl-llvm</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.lwjgl</groupId>
|
||||||
|
<artifactId>lwjgl-openal</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.lwjgl</groupId>
|
||||||
|
<artifactId>lwjgl-shaderc</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.lwjgl</groupId>
|
||||||
|
<artifactId>lwjgl-spvc</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.lwjgl</groupId>
|
||||||
|
<artifactId>lwjgl-stb</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.lwjgl</groupId>
|
||||||
|
<artifactId>lwjgl-vma</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.lwjgl</groupId>
|
<groupId>org.lwjgl</groupId>
|
||||||
<artifactId>lwjgl-vulkan</artifactId>
|
<artifactId>lwjgl-vulkan</artifactId>
|
||||||
<version>${lwjgl.version}</version>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.lwjgl</groupId>
|
||||||
|
<artifactId>lwjgl</artifactId>
|
||||||
|
<classifier>${lwjgl.natives}</classifier>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.lwjgl</groupId>
|
||||||
|
<artifactId>lwjgl-assimp</artifactId>
|
||||||
|
<classifier>${lwjgl.natives}</classifier>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.lwjgl</groupId>
|
||||||
|
<artifactId>lwjgl-glfw</artifactId>
|
||||||
|
<classifier>${lwjgl.natives}</classifier>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.lwjgl</groupId>
|
||||||
|
<artifactId>lwjgl-llvm</artifactId>
|
||||||
|
<classifier>${lwjgl.natives}</classifier>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.lwjgl</groupId>
|
||||||
|
<artifactId>lwjgl-openal</artifactId>
|
||||||
|
<classifier>${lwjgl.natives}</classifier>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.lwjgl</groupId>
|
||||||
|
<artifactId>lwjgl-shaderc</artifactId>
|
||||||
|
<classifier>${lwjgl.natives}</classifier>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.lwjgl</groupId>
|
||||||
|
<artifactId>lwjgl-spvc</artifactId>
|
||||||
|
<classifier>${lwjgl.natives}</classifier>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.lwjgl</groupId>
|
||||||
|
<artifactId>lwjgl-stb</artifactId>
|
||||||
|
<classifier>${lwjgl.natives}</classifier>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.lwjgl</groupId>
|
||||||
|
<artifactId>lwjgl-vma</artifactId>
|
||||||
|
<classifier>${lwjgl.natives}</classifier>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.joml</groupId>
|
<groupId>org.joml</groupId>
|
||||||
|
@ -44,105 +201,59 @@
|
||||||
<artifactId>tinylog-impl</artifactId>
|
<artifactId>tinylog-impl</artifactId>
|
||||||
<version>${tinylog.version}</version>
|
<version>${tinylog.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Natives -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.lwjgl</groupId>
|
|
||||||
<artifactId>lwjgl</artifactId>
|
|
||||||
<version>${lwjgl.version}</version>
|
|
||||||
<classifier>${native.target}</classifier>
|
|
||||||
<scope>runtime</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.lwjgl</groupId>
|
|
||||||
<artifactId>lwjgl-glfw</artifactId>
|
|
||||||
<version>${lwjgl.version}</version>
|
|
||||||
<classifier>${native.target}</classifier>
|
|
||||||
<scope>runtime</scope>
|
|
||||||
</dependency>
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>org.lwjgl</groupId>-->
|
|
||||||
<!-- <artifactId>lwjgl-vulkan</artifactId>-->
|
|
||||||
<!-- <version>${lwjgl.version}</version>-->
|
|
||||||
<!-- <classifier>${native.target}</classifier>-->
|
|
||||||
<!-- <scope>runtime</scope>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
|
<sourceDirectory>src</sourceDirectory>
|
||||||
<plugins>
|
<resources>
|
||||||
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
|
<resource>
|
||||||
<plugin>
|
<directory>res</directory>
|
||||||
<artifactId>maven-clean-plugin</artifactId>
|
</resource>
|
||||||
<version>3.4.0</version>
|
</resources>
|
||||||
</plugin>
|
<plugins>
|
||||||
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
|
<plugin>
|
||||||
<plugin>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<artifactId>maven-resources-plugin</artifactId>
|
<version>${maven-compiler-plugin.version}</version>
|
||||||
<version>3.3.1</version>
|
</plugin>
|
||||||
</plugin>
|
<plugin>
|
||||||
<plugin>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>exec-maven-plugin</artifactId>
|
||||||
<version>3.13.0</version>
|
<version>3.1.0</version>
|
||||||
</plugin>
|
<configuration>
|
||||||
<plugin>
|
<mainClass>${main.class}</mainClass>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
</configuration>
|
||||||
<version>3.3.0</version>
|
</plugin>
|
||||||
</plugin>
|
<plugin>
|
||||||
<plugin>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
<version>${maven-shade-plugin.version}</version>
|
||||||
<version>3.4.2</version>
|
<executions>
|
||||||
</plugin>
|
<execution>
|
||||||
<plugin>
|
<phase>package</phase>
|
||||||
<artifactId>maven-install-plugin</artifactId>
|
<goals>
|
||||||
<version>3.1.2</version>
|
<goal>shade</goal>
|
||||||
</plugin>
|
</goals>
|
||||||
<plugin>
|
<configuration>
|
||||||
<artifactId>maven-deploy-plugin</artifactId>
|
<filters>
|
||||||
<version>3.1.2</version>
|
<filter>
|
||||||
</plugin>
|
<!-- exclude files that sign a jar -->
|
||||||
<plugin>
|
<artifact>*:*</artifact>
|
||||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
<excludes>
|
||||||
<version>3.6.1</version>
|
<exclude>META-INF/*.SF</exclude>
|
||||||
</plugin>
|
<exclude>META-INF/*.RSA</exclude>
|
||||||
</plugins>
|
<exclude>META-INF/*.DSA</exclude>
|
||||||
</pluginManagement>
|
</excludes>
|
||||||
|
</filter>
|
||||||
|
</filters>
|
||||||
|
<transformers>
|
||||||
|
<transformer
|
||||||
|
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
||||||
|
<mainClass>${main.class}</mainClass>
|
||||||
|
</transformer>
|
||||||
|
</transformers>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<profiles>
|
|
||||||
<profile>
|
|
||||||
<id>windows-profile</id>
|
|
||||||
<activation>
|
|
||||||
<os>
|
|
||||||
<family>Windows</family>
|
|
||||||
</os>
|
|
||||||
</activation>
|
|
||||||
<properties>
|
|
||||||
<native.target>natives-windows</native.target>
|
|
||||||
</properties>
|
|
||||||
</profile>
|
|
||||||
<profile>
|
|
||||||
<id>linux-profile</id>
|
|
||||||
<activation>
|
|
||||||
<os>
|
|
||||||
<family>Linux</family>
|
|
||||||
</os>
|
|
||||||
</activation>
|
|
||||||
<properties>
|
|
||||||
<native.target>natives-linux</native.target>
|
|
||||||
</properties>
|
|
||||||
</profile>
|
|
||||||
<profile>
|
|
||||||
<id>OSX-profile</id>
|
|
||||||
<activation>
|
|
||||||
<os>
|
|
||||||
<family>mac</family>
|
|
||||||
</os>
|
|
||||||
</activation>
|
|
||||||
<properties>
|
|
||||||
<native.target>natives-macos</native.target>
|
|
||||||
</properties>
|
|
||||||
</profile>
|
|
||||||
</profiles>
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -22,8 +22,20 @@ public class Display {
|
||||||
|
|
||||||
TITLE = title;
|
TITLE = title;
|
||||||
displayMode = new DisplayMode(width, height);
|
displayMode = new DisplayMode(width, height);
|
||||||
|
|
||||||
|
// Configure GLFW for Vulkan
|
||||||
|
glfwDefaultWindowHints();
|
||||||
|
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); // Tell GLFW not to create an OpenGL context
|
||||||
|
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
|
||||||
|
glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE);
|
||||||
|
|
||||||
|
// Create the window
|
||||||
window = glfwCreateWindow(displayMode.getWidth(), displayMode.getHeight(), TITLE, NULL, NULL);
|
window = glfwCreateWindow(displayMode.getWidth(), displayMode.getHeight(), TITLE, NULL, NULL);
|
||||||
glfwMakeContextCurrent(window);
|
if (window == NULL)
|
||||||
|
throw new RuntimeException("Failed to create the GLFW window");
|
||||||
|
|
||||||
|
// Make the window visible
|
||||||
|
glfwShowWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setMouseGrabbed(boolean a) {
|
public static void setMouseGrabbed(boolean a) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package fr.mrdev023.vulkan_java.window;
|
package fr.mrdev023.vulkan_java.window;
|
||||||
|
|
||||||
import static org.lwjgl.glfw.GLFW.*;
|
import static org.lwjgl.glfw.GLFW.*;
|
||||||
|
import static org.lwjgl.system.MemoryUtil.NULL;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.Map.*;
|
import java.util.Map.*;
|
||||||
|
@ -26,16 +27,30 @@ public class Input {
|
||||||
private static double ywheel = 0;
|
private static double ywheel = 0;
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
glfwSetScrollCallback(Display.getWindow(), scroll = new GLFWScrollCallback() {
|
long window = Display.getWindow();
|
||||||
|
if (window == NULL) {
|
||||||
|
throw new IllegalStateException("Window not initialized");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize scroll callback
|
||||||
|
scroll = new GLFWScrollCallback() {
|
||||||
|
@Override
|
||||||
public void invoke(long window, double xoffset, double yoffset) {
|
public void invoke(long window, double xoffset, double yoffset) {
|
||||||
scroll(window, xoffset, yoffset);
|
scroll(window, xoffset, yoffset);
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
glfwSetCursorPosCallback(Display.getWindow(), mousePos = new GLFWCursorPosCallback() {
|
glfwSetScrollCallback(window, scroll);
|
||||||
|
|
||||||
|
// Initialize cursor position callback
|
||||||
|
mousePos = new GLFWCursorPosCallback() {
|
||||||
|
@Override
|
||||||
public void invoke(long window, double xpos, double ypos) {
|
public void invoke(long window, double xpos, double ypos) {
|
||||||
mousepos(window, xpos, ypos);
|
mousepos(window, xpos, ypos);
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
glfwSetCursorPosCallback(window, mousePos);
|
||||||
|
|
||||||
|
// Initialize input state
|
||||||
for (int i = 0; i < NBRE_KEY; i++) {
|
for (int i = 0; i < NBRE_KEY; i++) {
|
||||||
state.put(i, NONE);
|
state.put(i, NONE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue