Skip to content

Commit

Permalink
Update to libecl 2.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
matteodg committed Sep 20, 2020
1 parent 8bbf496 commit ea3cd41
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 66 deletions.
32 changes: 27 additions & 5 deletions libecl/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
JavaCPP Presets for libecl
==========================

License Agreements
------------------
By downloading these archives, you agree to the [terms and conditions for accessing or otherwise using libecl](https://github.com/equinor/libecl/blob/master/LICENSE).


Introduction
------------
This directory contains the JavaCPP Presets module for:

* libecl 2018.10 https://github.com/equinor/libecl
* libecl 2.9.1 https://github.com/equinor/libecl

Please refer to the parent README.md file for more detailed information about the JavaCPP Presets.

Expand All @@ -21,17 +26,34 @@ Sample Usage
------------
Here is a simple example of libecl ported to Java from this C source file:

* https://github.com/equinor/libecl/blob/2018.10/applications/ecl/kw_list.c
* https://github.com/equinor/libecl/blob/2.9.1/applications/ecl/kw_list.c

We can use [Maven 3](http://maven.apache.org/) to download and install automatically all the class
files as well as the native binaries. To run this sample code, after creating the `pom.xml` and
`KeywordsList.java` source files below, simply execute on the command line:
We can use [Maven 3](http://maven.apache.org/) to download and install automatically all the class files as well as the native binaries. To run this sample code, after creating the `pom.xml` and `KeywordsList.java` source files below, simply execute on the command line:
```bash
$ mvn compile exec:java
```

### The `pom.xml` build file
```xml
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.bytedeco.libecl</groupId>
<artifactId>simple</artifactId>
<version>1.5.4</version>
<properties>
<exec.mainClass>KeywordsList</exec.mainClass>
</properties>
<dependencies>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>libecl-platform</artifactId>
<version>2.9.1-1.5.4</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>.</sourceDirectory>
</build>
</project>
```

### The `KeywordsList.java` source file
Expand Down
3 changes: 1 addition & 2 deletions libecl/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if [[ -z "$PLATFORM" ]]; then
exit
fi

LIBECL_VERSION=2.4.0
LIBECL_VERSION=2.9.1
download https://github.com/equinor/libecl/archive/$LIBECL_VERSION.zip libecl-$LIBECL_VERSION.zip

mkdir -p $PLATFORM
Expand All @@ -19,7 +19,6 @@ unzip -o ../libecl-$LIBECL_VERSION.zip


cd libecl-$LIBECL_VERSION
sed -i 's/etr/ert/g' lib/include/ert/ecl/ecl_grav_calc.hpp

mkdir -p build
cd build
Expand Down
110 changes: 56 additions & 54 deletions libecl/pom.xml
Original file line number Diff line number Diff line change
@@ -1,63 +1,65 @@
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.bytedeco</groupId>
<artifactId>javacpp-presets</artifactId>
<version>1.5.1-SNAPSHOT</version>
</parent>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.bytedeco</groupId>
<artifactId>libecl</artifactId>
<version>${revision}</version>
<name>JavaCPP Presets for libecl</name>
<artifactId>javacpp-presets</artifactId>
<version>1.5.5-SNAPSHOT</version>
</parent>

<properties>
<revision>2018.10-${project.parent.version}</revision>
</properties>
<groupId>org.bytedeco</groupId>
<artifactId>libecl</artifactId>
<version>${libecl.version}-${project.parent.version}</version>
<name>JavaCPP Presets for libecl</name>

<dependencies>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacpp</artifactId>
</dependency>
</dependencies>
<dependencies>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacpp</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.bytedeco</groupId>
<artifactId>javacpp</artifactId>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</build>
<properties>
<libecl.version>2.9.1</libecl.version>
</properties>

<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.bytedeco</groupId>
<artifactId>javacpp</artifactId>
<configuration>
<includePaths>
<includePath>${basedir}/cppbuild/${javacpp.platform}/include/</includePath>
<includePath>${basedir}/cppbuild/${javacpp.platform}/include/libecl-2.9.1/lib/private-include/</includePath>
</includePaths>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
5 changes: 2 additions & 3 deletions libecl/samples/KeywordsList.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,15 @@
public class KeywordsList {

public static void main(String[] args) {
int i;
for (i = 1; i < args.length; i++) {
for (int i = 0; i < args.length; i++) {
kw_list(args[i]);
}
}

private static void kw_list(String filename) {
fortio_type fortio;
ecl_kw_type ecl_kw = ecl_kw_alloc_empty();
boolean fmt_file;
BooleanPointer fmt_file = new BooleanPointer();
if (ecl_util_fmt_file(filename, fmt_file)) {

System.out.println("-----------------------------------------------------------------");
Expand Down
4 changes: 2 additions & 2 deletions libecl/src/main/java/org/bytedeco/libecl/presets/libecl.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
"ert/util/timer.hpp",
"ert/util/timer.h",
//"type_traits",
"ert/util/atomic.h",
//"ert/util/atomic.h",
"ert/util/ecl_version.hpp",
"ert/util/ecl_version.h",
//"stdexcept",
Expand Down Expand Up @@ -255,7 +255,7 @@ public void init(ClassProperties properties) {
if (!includePaths.isEmpty()) {
String include = includePaths.get(0);
if (include.endsWith("/" + platform + "/include/")) {
String privateInclude = include.replace("/include/", "/libecl-2.4.0/lib/private-include/");
String privateInclude = include.replace("/include/", "/libecl-2.9.1/lib/private-include/");
if (!includePaths.contains(privateInclude)) {
includePaths.add(privateInclude);
}
Expand Down

0 comments on commit ea3cd41

Please sign in to comment.