sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1801739 - in /sis/branches/JDK8/storage/sis-gdal/src/main: c/Makefile c/org_apache_sis_storage_gdal_PJ.c resources/native/ resources/native/darwin/ resources/native/linux/ resources/native/windows/
Date Wed, 12 Jul 2017 14:26:35 GMT
Author: desruisseaux
Date: Wed Jul 12 14:26:35 2017
New Revision: 1801739

URL: http://svn.apache.org/viewvc?rev=1801739&view=rev
Log:
Better handling of Linux and MacOS platforms for native binding.

Added:
    sis/branches/JDK8/storage/sis-gdal/src/main/resources/native/
    sis/branches/JDK8/storage/sis-gdal/src/main/resources/native/darwin/
    sis/branches/JDK8/storage/sis-gdal/src/main/resources/native/linux/
    sis/branches/JDK8/storage/sis-gdal/src/main/resources/native/windows/
Modified:
    sis/branches/JDK8/storage/sis-gdal/src/main/c/Makefile
    sis/branches/JDK8/storage/sis-gdal/src/main/c/org_apache_sis_storage_gdal_PJ.c

Modified: sis/branches/JDK8/storage/sis-gdal/src/main/c/Makefile
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-gdal/src/main/c/Makefile?rev=1801739&r1=1801738&r2=1801739&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-gdal/src/main/c/Makefile (original)
+++ sis/branches/JDK8/storage/sis-gdal/src/main/c/Makefile Wed Jul 12 14:26:35 2017
@@ -21,23 +21,55 @@
 # on MacOS, etc). The Proj.4 header files are expected to be found either in the "/usr/local/include"
directory (for
 # example on Linux distributions), or "/opt/local/include" on some other platforms.
 #
-# Options reminder:
+# HOW TO BUILD:
+# C/C++ compilation is currently not part of Maven build. Compilation shall be done manually
like below:
+#
+#     cd storage/sis-gdal/src/main/c
+#     make
+#
+# The executable will be created in the "storage/sis-gdal/src/resources/native/<platform>/"
directory for inclusion
+# in the JAR file. Only the executable for the current platform will be updated. If the JNI
have been updated, then
+# 'make' will need to be executed on all supported platforms.
+#
+# GCC options reminder:
 #    -shared		Produce a shared object which can then be linked with other objects to form
an executable.
 #    -shared-libgcc	Use the shared version of libgcc.
 #    -fpic		Generate position-independent code suitable for use in a shared library.
 #    -O2		Performs nearly all supported optimizations that do not involve a space-speed tradeoff.
 #
-FLAG=-shared -shared-libgcc -fpic -O2
+FLAG   = -shared -shared-libgcc -fpic -O2
+LIB    = -lm -ldl -lproj
+SRC    = org_apache_sis_storage_gdal_PJ.c
+OUT    = libproj-binding.so
+
+ifndef JAVA_HOME
+    $(error JAVA_HOME is not set.)
+endif
+
+INCLUDE_DIR = -I$(JAVA_HOME)/include -I/usr/local/include -I/opt/local/include
+
+ifndef OS
+    OS = $(shell uname)
+endif
+
+ifeq ($(OS),Windows_NT)
+    OUTDIR = window
+endif
 
-# TODO: include either "linux" or "darwnin" but not both.
-INCLUDE_DIR=-I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -I$(JAVA_HOME)/include/darwin
-I/usr/local/include -I/opt/local/include
+ifeq ($(OS),Linux)
+    INCLUDE_DIR += -I$(JAVA_HOME)/include/linux
+    OUTDIR = linux
+endif
 
-#TODO: MacOS needs -L/opt/local/lib
-LIB=-lm -ldl -lproj
-SRC=org_apache_sis_storage_gdal_PJ.c
-OUT=libproj-binding.so
+ifeq ($(OS),Darwin)
+    INCLUDE_DIR += -I$(JAVA_HOME)/include/darwin
+    LIB += -L/opt/local/lib
+    OUTDIR = darwin
+endif
 
+ifndef OUTDIR
+    $(error The $(OS) platform is not supported by this makefile.)
+endif
 
 all:
-	gcc $(FLAG) $(INCLUDE_DIR) $(LIB) -o $(OUT) $(SRC)
-	mv $(OUT) ../resources/
+	gcc $(FLAG) $(INCLUDE_DIR) $(LIB) -o ../resources/native/$(OUTDIR)/$(OUT) $(SRC)

Modified: sis/branches/JDK8/storage/sis-gdal/src/main/c/org_apache_sis_storage_gdal_PJ.c
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-gdal/src/main/c/org_apache_sis_storage_gdal_PJ.c?rev=1801739&r1=1801738&r2=1801739&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-gdal/src/main/c/org_apache_sis_storage_gdal_PJ.c [UTF-8]
(original)
+++ sis/branches/JDK8/storage/sis-gdal/src/main/c/org_apache_sis_storage_gdal_PJ.c [UTF-8]
Wed Jul 12 14:26:35 2017
@@ -17,7 +17,6 @@
 #include <math.h>
 #include <string.h>
 #include <projects.h>
-#include <jni.h>
 #include "org_apache_sis_storage_gdal_PJ.h"
 
 



Mime
View raw message