2010-11-17 11:26:05 +01:00
|
|
|
#JavaOpenJPEG/CMakeLists.txt
|
2007-12-10 14:16:01 +01:00
|
|
|
|
|
|
|
# First thing define the common source:
|
2012-08-30 19:14:39 +02:00
|
|
|
set(openjpegjni_SRCS
|
2012-03-02 10:20:13 +01:00
|
|
|
JavaOpenJPEGDecoder.c
|
|
|
|
JavaOpenJPEG.c
|
2012-10-15 11:43:28 +02:00
|
|
|
${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_getopt.c
|
|
|
|
${OPENJPEG_SOURCE_DIR}/src/bin/jp2/convert.c
|
|
|
|
index.c
|
2007-12-10 14:16:01 +01:00
|
|
|
)
|
|
|
|
|
2012-03-02 10:20:13 +01:00
|
|
|
# JNI binding:
|
|
|
|
find_package(JNI REQUIRED)
|
|
|
|
include_directories(${JNI_INCLUDE_DIRS})
|
2007-12-10 14:16:01 +01:00
|
|
|
|
2012-03-02 10:20:13 +01:00
|
|
|
# required header file:
|
|
|
|
include_directories(
|
2012-10-01 09:49:52 +02:00
|
|
|
${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h
|
2012-10-10 15:26:29 +02:00
|
|
|
${OPENJPEG_SOURCE_DIR}/src/lib/openmj2
|
2012-09-28 10:17:02 +02:00
|
|
|
${OPENJPEG_SOURCE_DIR}/src/bin/common
|
|
|
|
${OPENJPEG_SOURCE_DIR}/src/bin/jp2
|
2007-12-10 14:16:01 +01:00
|
|
|
)
|
|
|
|
|
2012-03-02 10:20:13 +01:00
|
|
|
add_library(openjpegjni MODULE
|
|
|
|
${openjpegjni_SRCS}
|
|
|
|
)
|
2012-10-22 12:49:22 +02:00
|
|
|
# Java module should not have a SONAME:
|
|
|
|
set_property(TARGET openjpegjni PROPERTY NO_SONAME 1)
|
|
|
|
|
2012-10-15 11:43:28 +02:00
|
|
|
# FIXME (need to use old API):
|
|
|
|
if(BUILD_MJ2)
|
|
|
|
target_link_libraries(openjpegjni openmj2)
|
|
|
|
endif()
|
|
|
|
target_link_libraries(openjpegjni
|
|
|
|
${PNG_LIBNAME} ${TIFF_LIBNAME} ${LCMS_LIBNAME} ${Z_LIBNAME}
|
|
|
|
)
|
|
|
|
if(UNIX)
|
|
|
|
target_link_libraries(openjpegjni m)
|
|
|
|
endif()
|
2012-03-02 10:20:13 +01:00
|
|
|
|
2012-10-22 12:41:44 +02:00
|
|
|
install(TARGETS openjpegjni
|
|
|
|
EXPORT OpenJPEGTargets
|
|
|
|
LIBRARY DESTINATION ${OPENJPEG_INSTALL_JNI_DIR} COMPONENT Libraries
|
|
|
|
)
|
|
|
|
|
2012-03-02 10:20:13 +01:00
|
|
|
# build jar:
|
2012-08-30 19:14:39 +02:00
|
|
|
find_package(Java 1.5 REQUIRED) # javac, jar
|
2012-03-02 10:20:13 +01:00
|
|
|
|
|
|
|
# build dep list:
|
|
|
|
file(GLOB java_srcs "java-sources/org/openJpeg/*.java")
|
2007-12-10 14:16:01 +01:00
|
|
|
|
2012-03-02 10:20:13 +01:00
|
|
|
# make sure target javac dir exists:
|
|
|
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/classes)
|
|
|
|
# Build java
|
2012-08-30 19:14:39 +02:00
|
|
|
add_custom_command(
|
2012-03-02 10:20:13 +01:00
|
|
|
OUTPUT ${LIBRARY_OUTPUT_PATH}/openjpeg.jar
|
|
|
|
COMMAND ${Java_JAVAC_EXECUTABLE} -sourcepath "${CMAKE_CURRENT_SOURCE_DIR}/java-sources"
|
|
|
|
${java_srcs} -d ${CMAKE_CURRENT_BINARY_DIR}/classes
|
|
|
|
COMMAND ${Java_JAR_EXECUTABLE} cvf ${LIBRARY_OUTPUT_PATH}/openjpeg.jar org
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/classes
|
|
|
|
DEPENDS ${java_srcs}
|
|
|
|
COMMENT "javac *.java; jar cvf -> openjpeg.jar"
|
|
|
|
)
|
2007-12-10 14:16:01 +01:00
|
|
|
|
2012-03-02 10:20:13 +01:00
|
|
|
# name the target
|
2012-08-30 19:14:39 +02:00
|
|
|
add_custom_target(OpenJPEGJavaJar ALL
|
2012-03-02 10:20:13 +01:00
|
|
|
DEPENDS ${LIBRARY_OUTPUT_PATH}/openjpeg.jar
|
|
|
|
COMMENT "building openjpeg.jar"
|
|
|
|
)
|
2012-10-22 12:41:44 +02:00
|
|
|
|
|
|
|
install(FILES ${LIBRARY_OUTPUT_PATH}/openjpeg.jar
|
|
|
|
DESTINATION ${OPENJPEG_INSTALL_SHARE_DIR} COMPONENT JavaModule
|
|
|
|
)
|