summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordcommander <dcommander@3789f03b-4d11-0410-bbf8-ca57d06f2519>2011-02-05 06:01:18 +0000
committerdcommander <dcommander@3789f03b-4d11-0410-bbf8-ca57d06f2519>2011-02-05 06:01:18 +0000
commitfd8e43480be238c8a68980277320e0076bbc508d (patch)
tree8c532691b2634e25d44ef1a274ba54a9a0f31a25
parent5e0da9c06ceca705ad8897eaf24935307a1b558d (diff)
Build JNI wrapper on Windows
git-svn-id: https://libjpeg-turbo.svn.sourceforge.net/svnroot/libjpeg-turbo@346 3789f03b-4d11-0410-bbf8-ca57d06f2519
-rw-r--r--trunk/BUILDING.txt29
-rw-r--r--trunk/CMakeLists.txt25
2 files changed, 47 insertions, 7 deletions
diff --git a/trunk/BUILDING.txt b/trunk/BUILDING.txt
index b3806a2..8b245d7 100644
--- a/trunk/BUILDING.txt
+++ b/trunk/BUILDING.txt
@@ -30,12 +30,12 @@ Build Requirements
-- GCC v4.1 or later recommended for best performance
--- The TurboJPEG/OSS JNI wrapper requires jni.h. Some systems, such as OS X
- 10.4 and Solaris 10, have this header pre-installed. On OS X 10.5 and
- later, the header can be obtained by installing the Java Developer Package,
- which can be downloaded from http://connect.apple.com. On Linux and other
- systems, the header can be obtained by installing the GCC Java development
- packages or the Oracle Java Development Kit (JDK).
+-- If building the TurboJPEG/OSS JNI wrapper, jni.h is required. Some systems,
+ such as OS X 10.4 and Solaris 10, have this header pre-installed. On OS X
+ 10.5 and later, the header can be obtained by installing the Java Developer
+ Package, which can be downloaded from http://connect.apple.com. On Linux
+ and other systems, the header can be obtained by installing the GCC Java
+ development packages or the Oracle Java Development Kit (JDK).
==================
@@ -315,6 +315,15 @@ Build Requirements
-- NASM (http://www.nasm.us/) 0.98 or later (NASM 2.05 or later is required for
a 64-bit build)
+-- If building the TurboJPEG/OSS JNI wrapper, jni.h is required. This header
+ can be obtained by installing the Oracle Java Development Kit (JDK).
+ * If using Visual C++, then add the appropriate Java include directories
+ (Example: c:\Program Files\Java\jdk1.6.0_23\include;c:\Program Files\Java\jdk1.6.0_23\include\win32)
+ to the INCLUDE environment variable prior to building libjpeg-turbo.
+ * If using MinGW, then add the appropriate Java include directories
+ (Example: /c/Program Files/Java/jdk1.6.0_23/include:/c/Program Files/Java/jdk1.6.0_23/include/win32)
+ to the CPATH environment variable prior to building libjpeg-turbo.
+
==================
Out-of-Tree Builds
@@ -454,6 +463,14 @@ add "-DWITH_ARITH_ENC=0" or "-DWITH_ARITH_DEC=0" to the cmake command line to
disable encoding or decoding (respectively.)
+TurboJPEG/OSS JNI Wrapper
+-------------------------
+Add "-DWITH_JNI=1" to the cmake command line to incorporate an optional Java
+Native Interface wrapper into the TurboJPEG/OSS dynamic library. This allows
+the dynamic library to be used directly from Java applications. See
+java/README for more details.
+
+
========================
Installing libjpeg-turbo
========================
diff --git a/trunk/CMakeLists.txt b/trunk/CMakeLists.txt
index b88da0d..6ac5316 100644
--- a/trunk/CMakeLists.txt
+++ b/trunk/CMakeLists.txt
@@ -58,6 +58,16 @@ else()
message(STATUS "Arithmetic decoding support disabled")
endif()
+if(NOT DEFINED WITH_JNI)
+ set(WITH_JNI 0)
+endif()
+
+if(WITH_JNI)
+ message(STATUS "TurboJPEG/OSS JNI wrapper enabled")
+else()
+ message(STATUS "TurboJPEG/OSS JNI wrapper disabled")
+endif()
+
set(JPEG_LIB_VERSION 62)
set(DLL_VERSION ${JPEG_LIB_VERSION})
set(FULLVERSION ${DLL_VERSION}.0.0)
@@ -107,6 +117,14 @@ configure_file(win/config.h.in config.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
+if(WITH_JNI)
+ include(CheckIncludeFiles)
+ check_include_files(jni.h HAVE_JNI_H)
+ if(NOT HAVE_JNI_H)
+ message(FATAL_ERROR "Cannot find jni.h. Be sure to add the Java include directories to the INCLUDE environment variable (MSVC) or the CPATH environment variable (GCC).")
+ endif()
+endif()
+
#
# Targets
@@ -157,7 +175,12 @@ if(WITH_SIMD)
add_dependencies(jpeg-static simd)
endif()
-add_library(turbojpeg SHARED turbojpegl.c)
+set(TURBOJPEG_SOURCES turbojpegl.c)
+if(WITH_JNI)
+ set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES} turbojpeg-jni.c)
+endif()
+
+add_library(turbojpeg SHARED ${TURBOJPEG_SOURCES})
set_target_properties(turbojpeg PROPERTIES DEFINE_SYMBOL DLLDEFINE)
target_link_libraries(turbojpeg jpeg-static)
set_target_properties(turbojpeg PROPERTIES LINK_INTERFACE_LIBRARIES "")