<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>onl.mdw</groupId>
    <artifactId>mathcat4j-jni-parent</artifactId>
    <version>0.7.2-2</version>
  </parent>
  <artifactId>mathcat4j-jni-libs</artifactId>
  <version>0.7.2-2</version>
  <name>MathCAT4j JNI native libraries</name>
  <description>Native libraries for the mathcat4j-jni module.</description>
  <url>https://github.com/mwhapples/MathCAT4J-JNI</url>
  <licenses>
    <license>
      <name>Mozilla Public License Version 2.0</name>
      <url>https://www.mozilla.org/MPL/2.0/</url>
    </license>
  </licenses>
  <properties>
    <mathcat4j.jni.lib.directory>${project.build.directory}/classes/onl/mdw/mathcat4j/jni/libs</mathcat4j.jni.lib.directory>
  </properties>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-source-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <attach>true</attach>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <attach>true</attach>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>build-current-platform</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.questdb</groupId>
            <artifactId>rust-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>mathcat4j-jni</id>
                <goals>
                  <goal>build</goal>
                </goals>
                <configuration>
                  <path>src/main/rust/mathcat4j</path>
                  <release>true</release>
                  <copyTo>${mathcat4j.jni.lib.directory}/</copyTo>
                  <copyWithPlatformDir>true</copyWithPlatformDir>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>build-all-platforms</id>
      <activation />
      <build>
        <plugins>
          <plugin>
            <groupId>org.questdb</groupId>
            <artifactId>rust-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>build-mathcat-jni-win32-x86-64</id>
                <goals>
                  <goal>build</goal>
                </goals>
                <configuration>
                  <path>src/main/rust/mathcat4j</path>
                  <release>true</release>
                  <extraArgs>
                    <extraArg>--target=x86_64-pc-windows-gnu</extraArg>
                  </extraArgs>
                </configuration>
              </execution>
              <execution>
                <id>build-mathcat-jni-win32-x86</id>
                <goals>
                  <goal>build</goal>
                </goals>
                <configuration>
                  <path>src/main/rust/mathcat4j</path>
                  <release>true</release>
                  <extraArgs>
                    <extraArg>--target=i686-pc-windows-gnu</extraArg>
                  </extraArgs>
                </configuration>
              </execution>
              <execution>
                <id>build-mathcat-jni-linux-x86-64</id>
                <goals>
                  <goal>build</goal>
                </goals>
                <configuration>
                  <path>src/main/rust/mathcat4j</path>
                  <release>true</release>
                  <extraArgs>
                    <extraArg>--target=x86_64-unknown-linux-gnu</extraArg>
                  </extraArgs>
                </configuration>
              </execution>
              <execution>
                <id>build-mathcat-jni-linux-x86</id>
                <goals>
                  <goal>build</goal>
                </goals>
                <configuration>
                  <path>src/main/rust/mathcat4j</path>
                  <release>true</release>
                  <extraArgs>
                    <extraArg>--target=i686-unknown-linux-gnu</extraArg>
                  </extraArgs>
                </configuration>
              </execution>
              <execution>
                <id>build-mathcat-jni-linux-aarch64</id>
                <goals>
                  <goal>build</goal>
                </goals>
                <configuration>
                  <path>src/main/rust/mathcat4j</path>
                  <release>true</release>
                  <extraArgs>
                    <extraArg>--target=aarch64-unknown-linux-gnu</extraArg>
                  </extraArgs>
                </configuration>
              </execution>
              <execution>
                <id>build-mathcat-jni-linux-arm</id>
                <goals>
                  <goal>build</goal>
                </goals>
                <configuration>
                  <path>src/main/rust/mathcat4j</path>
                  <release>true</release>
                  <extraArgs>
                    <extraArg>--target=arm-unknown-linux-gnueabihf</extraArg>
                  </extraArgs>
                </configuration>
              </execution>
              <execution>
                <id>build-mathcat-jni-darwin-x86-64</id>
                <goals>
                  <goal>build</goal>
                </goals>
                <configuration>
                  <path>src/main/rust/mathcat4j</path>
                  <release>true</release>
                  <extraArgs>
                    <extraArg>--target=x86_64-apple-darwin</extraArg>
                  </extraArgs>
                  <environmentVariables>
                    <CC>o64-clang</CC>
                    <CXX>o64-clang++</CXX>
                  </environmentVariables>
                </configuration>
              </execution>
              <execution>
                <id>build-mathcat-jni-darwin-aarch64</id>
                <goals>
                  <goal>build</goal>
                </goals>
                <configuration>
                  <path>src/main/rust/mathcat4j</path>
                  <release>true</release>
                  <extraArgs>
                    <extraArg>--target=aarch64-apple-darwin</extraArg>
                  </extraArgs>
                  <environmentVariables>
                    <CC>oa64-clang</CC>
                    <CXX>oa64-clang++</CXX>
                  </environmentVariables>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <executions>
              <execution>
                <id>copy-mathcat-jni-win32-x86-64</id>
                <phase>process-classes</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <resources>
                    <resource>
                      <directory>${project.build.directory}/rust-maven-plugin/mathcat4j/x86_64-pc-windows-gnu/release/</directory>
                      <includes>
                        <include>mathcat4j.dll</include>
                      </includes>
                    </resource>
                  </resources>
                  <outputDirectory>${mathcat4j.jni.lib.directory}/win32-x86-64</outputDirectory>
                </configuration>
              </execution>
              <execution>
                <id>copy-mathcat-jni-win32-x86</id>
                <phase>process-classes</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <resources>
                    <resource>
                      <directory>${project.build.directory}/rust-maven-plugin/mathcat4j/i686-pc-windows-gnu/release/</directory>
                      <includes>
                        <include>mathcat4j.dll</include>
                      </includes>
                    </resource>
                  </resources>
                  <outputDirectory>${mathcat4j.jni.lib.directory}/win32-x86</outputDirectory>
                </configuration>
              </execution>
              <execution>
                <id>copy-mathcat-jni-linux-x86-64</id>
                <phase>process-classes</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <resources>
                    <resource>
                      <directory>${project.build.directory}/rust-maven-plugin/mathcat4j/x86_64-unknown-linux-gnu/release/</directory>
                      <includes>
                        <include>libmathcat4j.so</include>
                      </includes>
                    </resource>
                  </resources>
                  <outputDirectory>${mathcat4j.jni.lib.directory}/linux-x86-64</outputDirectory>
                </configuration>
              </execution>
              <execution>
                <id>copy-mathcat-jni-linux-x86</id>
                <phase>process-classes</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <resources>
                    <resource>
                      <directory>${project.build.directory}/rust-maven-plugin/mathcat4j/i686-unknown-linux-gnu/release/</directory>
                      <includes>
                        <include>libmathcat4j.so</include>
                      </includes>
                    </resource>
                  </resources>
                  <outputDirectory>${mathcat4j.jni.lib.directory}/linux-x86</outputDirectory>
                </configuration>
              </execution>
              <execution>
                <id>copy-mathcat-jni-linux-aarch64</id>
                <phase>process-classes</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <resources>
                    <resource>
                      <directory>${project.build.directory}/rust-maven-plugin/mathcat4j/aarch64-unknown-linux-gnu/release/</directory>
                      <includes>
                        <include>libmathcat4j.so</include>
                      </includes>
                    </resource>
                  </resources>
                  <outputDirectory>${mathcat4j.jni.lib.directory}/linux-aarch64</outputDirectory>
                </configuration>
              </execution>
              <execution>
                <id>copy-mathcat-jni-linux-arm</id>
                <phase>process-classes</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <resources>
                    <resource>
                      <directory>${project.build.directory}/rust-maven-plugin/mathcat4j/arm-unknown-linux-gnueabihf/release/</directory>
                      <includes>
                        <include>libmathcat4j.so</include>
                      </includes>
                    </resource>
                  </resources>
                  <outputDirectory>${mathcat4j.jni.lib.directory}/linux-arm</outputDirectory>
                </configuration>
              </execution>
              <execution>
                <id>copy-mathcat-jni-darwin-x86-64</id>
                <phase>process-classes</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <resources>
                    <resource>
                      <directory>${project.build.directory}/rust-maven-plugin/mathcat4j/x86_64-apple-darwin/release/</directory>
                      <includes>
                        <include>libmathcat4j.dylib</include>
                      </includes>
                    </resource>
                  </resources>
                  <outputDirectory>${mathcat4j.jni.lib.directory}/darwin-x86-64</outputDirectory>
                </configuration>
              </execution>
              <execution>
                <id>copy-mathcat-jni-darwin-aarch64</id>
                <phase>process-classes</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <resources>
                    <resource>
                      <directory>${project.build.directory}/rust-maven-plugin/mathcat4j/aarch64-apple-darwin/release/</directory>
                      <includes>
                        <include>libmathcat4j.dylib</include>
                      </includes>
                    </resource>
                  </resources>
                  <outputDirectory>${mathcat4j.jni.lib.directory}/darwin-aarch64</outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
