Build JNI wrapper on Windows

This commit is contained in:
DRC
2011-02-05 06:01:18 +00:00
parent 345c3eed92
commit 74ff1aac8e
2 changed files with 47 additions and 7 deletions

View File

@@ -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
========================

View File

@@ -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 "")