<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <!-- Reusable 2D game engine (Vulkan, LWJGL); knows nothing about any game -->
    <groupId>cz.nestplan</groupId>
    <artifactId>engine</artifactId>
    <!-- Development version; releases are cut by pushing a tag vX.Y.Z (see README) -->
    <version>0.1.0</version>

    <name>Engine</name>
    <url>https://git.nestplan.cz/tomas/game-engine</url>

    <scm>
        <url>https://git.nestplan.cz/tomas/game-engine</url>
        <connection>scm:git:https://git.nestplan.cz/tomas/game-engine.git</connection>
    </scm>

    <!-- Forgejo package registry; credentials come from a <server> with this id in settings.xml -->
    <distributionManagement>
        <repository>
            <id>forgejo</id>
            <url>https://git.nestplan.cz/api/packages/tomas/maven</url>
        </repository>
        <snapshotRepository>
            <id>forgejo</id>
            <url>https://git.nestplan.cz/api/packages/tomas/maven</url>
        </snapshotRepository>
    </distributionManagement>

    <properties>
        <maven.compiler.release>25</maven.compiler.release>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <lwjgl.version>3.4.3</lwjgl.version>
        <lwjgl.natives>natives-linux</lwjgl.natives>
        <imgui.version>1.92.7.1</imgui.version>
        <junit.version>6.0.3</junit.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.lwjgl</groupId>
                <artifactId>lwjgl-bom</artifactId>
                <version>${lwjgl.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>${junit.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency><groupId>org.lwjgl</groupId><artifactId>lwjgl</artifactId></dependency>
        <dependency><groupId>org.lwjgl</groupId><artifactId>lwjgl-glfw</artifactId></dependency>
        <dependency><groupId>org.lwjgl</groupId><artifactId>lwjgl-vulkan</artifactId></dependency>
        <dependency><groupId>org.lwjgl</groupId><artifactId>lwjgl-shaderc</artifactId></dependency>
        <dependency><groupId>org.lwjgl</groupId><artifactId>lwjgl-stb</artifactId></dependency>
        <dependency><groupId>org.lwjgl</groupId><artifactId>lwjgl-openal</artifactId></dependency>

        <!-- The Vulkan loader (libvulkan.so) comes from the system, so lwjgl-vulkan has no native JAR on Linux -->
        <dependency><groupId>org.lwjgl</groupId><artifactId>lwjgl</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-shaderc</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-openal</artifactId><classifier>${lwjgl.natives}</classifier></dependency>

        <!-- Dear ImGui (debug / tuning UI); we render it with our own Vulkan backend -->
        <dependency><groupId>io.github.spair</groupId><artifactId>imgui-java-binding</artifactId><version>${imgui.version}</version></dependency>
        <dependency><groupId>io.github.spair</groupId><artifactId>imgui-java-natives-linux</artifactId><version>${imgui.version}</version></dependency>
        <dependency>
            <groupId>io.github.spair</groupId>
            <artifactId>imgui-java-lwjgl3</artifactId>
            <version>${imgui.version}</version>
            <exclusions>
                <!-- only the GLFW platform backend is used; OpenGL / SDL backends are not needed -->
                <exclusion><groupId>org.lwjgl</groupId><artifactId>lwjgl-opengl</artifactId></exclusion>
                <exclusion><groupId>org.lwjgl</groupId><artifactId>lwjgl-sdl</artifactId></exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.5.6</version>
                <configuration>
                    <!-- Talk to the test JVM over TCP: native libraries (GLFW, Vulkan layers)
                         write straight to stdout, which would corrupt the default pipe -->
                    <forkNode implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory"/>
                    <argLine>--enable-native-access=ALL-UNNAMED</argLine>
                    <!-- Audio tests use a loopback device -->
                    <systemPropertyVariables>
                        <audio>false</audio>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
            <!-- Sources next to the JAR, so IDEs in game projects show engine code and docs -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.3.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals><goal>jar-no-fork</goal></goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
