2011-11-02 01:49:20 +01:00
|
|
|
# Headers file are located here:
|
|
|
|
INCLUDE_DIRECTORIES(
|
|
|
|
${OPENJPEG_SOURCE_DIR}/applications/jpip/libopenjpip
|
2012-01-25 10:42:00 +01:00
|
|
|
${FCGI_INCLUDE_DIRS}
|
2011-11-02 01:49:20 +01:00
|
|
|
)
|
|
|
|
|
2012-04-20 13:15:48 +02:00
|
|
|
# Tool to embed metadata into JP2 file
|
|
|
|
ADD_EXECUTABLE(addXMLinJP2 addXMLinJP2.c)
|
|
|
|
# Install exe
|
|
|
|
INSTALL(TARGETS addXMLinJP2
|
|
|
|
EXPORT OpenJPEGTargets
|
|
|
|
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
|
|
|
|
)
|
|
|
|
|
2012-01-25 17:30:03 +01:00
|
|
|
IF(BUILD_JPIP_SERVER)
|
|
|
|
|
|
|
|
SET(OPJ_SERVER_SRCS
|
2011-12-12 10:42:44 +01:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/opj_server.c
|
|
|
|
)
|
2012-01-25 17:30:03 +01:00
|
|
|
|
|
|
|
# Build executable
|
|
|
|
ADD_EXECUTABLE(opj_server ${OPJ_SERVER_SRCS})
|
|
|
|
TARGET_LINK_LIBRARIES(opj_server openjpip_server)
|
|
|
|
SET_PROPERTY(
|
|
|
|
TARGET opj_server
|
|
|
|
APPEND PROPERTY
|
|
|
|
COMPILE_DEFINITIONS SERVER QUIT_SIGNAL="quitJPIP"
|
|
|
|
)
|
2011-11-02 01:49:20 +01:00
|
|
|
|
2012-01-25 17:30:03 +01:00
|
|
|
# On unix you need to link to the math library:
|
|
|
|
IF(UNIX)
|
|
|
|
TARGET_LINK_LIBRARIES(opj_server m)
|
|
|
|
ENDIF(UNIX)
|
2011-11-02 01:49:20 +01:00
|
|
|
|
2012-01-25 17:30:03 +01:00
|
|
|
# Install exe
|
|
|
|
INSTALL(TARGETS opj_server
|
|
|
|
EXPORT OpenJPEGTargets
|
|
|
|
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
|
|
|
|
)
|
|
|
|
ENDIF(BUILD_JPIP_SERVER)
|
2011-11-02 01:49:20 +01:00
|
|
|
|
2011-12-12 10:42:44 +01:00
|
|
|
SET(EXES
|
|
|
|
opj_dec_server
|
|
|
|
jpip_to_jp2
|
|
|
|
jpip_to_j2k
|
|
|
|
test_index
|
2011-11-02 01:49:20 +01:00
|
|
|
)
|
2011-12-12 10:42:44 +01:00
|
|
|
FOREACH(exe ${EXES})
|
|
|
|
ADD_EXECUTABLE(${exe} ${exe}.c)
|
|
|
|
TARGET_LINK_LIBRARIES(${exe} openjpip_local)
|
|
|
|
INSTALL(TARGETS ${exe}
|
|
|
|
EXPORT OpenJPEGTargets
|
|
|
|
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
|
|
|
|
)
|
2011-11-02 01:49:20 +01:00
|
|
|
ENDFOREACH(exe)
|
2012-02-06 16:00:04 +01:00
|
|
|
|
|
|
|
# Build the two java clients:
|
2012-02-13 12:41:31 +01:00
|
|
|
FIND_PACKAGE(Java 1.5 COMPONENTS Development) # javac, jar
|
2012-02-06 16:00:04 +01:00
|
|
|
|
2014-03-18 15:58:14 +01:00
|
|
|
# User can override this:
|
|
|
|
if(NOT DEFINED JAVA_SOURCE_VERSION)
|
|
|
|
set(JAVA_SOURCE_VERSION 1.5)
|
|
|
|
endif()
|
|
|
|
if(NOT DEFINED JAVA_TARGET_VERSION)
|
|
|
|
set(JAVA_TARGET_VERSION 1.5)
|
|
|
|
endif()
|
|
|
|
|
2012-02-13 12:41:31 +01:00
|
|
|
# Only build the java viewer if dev is found:
|
2012-02-14 12:46:53 +01:00
|
|
|
if(Java_Development_FOUND AND Java_JAVAC_EXECUTABLE)
|
2012-02-17 12:33:31 +01:00
|
|
|
set(jflags $ENV{JFLAGS})
|
2012-02-13 12:41:31 +01:00
|
|
|
# 1. opj_viewer
|
2012-02-06 16:00:04 +01:00
|
|
|
# build dep list:
|
2012-02-13 12:41:31 +01:00
|
|
|
file(GLOB java1_srcs "opj_viewer/src/*.java")
|
2012-02-06 16:00:04 +01:00
|
|
|
|
|
|
|
# make sure target javac dir exists:
|
2012-02-13 12:41:31 +01:00
|
|
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/classes1)
|
2012-02-06 16:00:04 +01:00
|
|
|
# Build java
|
|
|
|
ADD_CUSTOM_COMMAND(
|
2012-02-13 12:41:31 +01:00
|
|
|
OUTPUT ${LIBRARY_OUTPUT_PATH}/opj_viewer.jar
|
2012-02-17 12:33:31 +01:00
|
|
|
COMMAND ${Java_JAVAC_EXECUTABLE} ${jflags}
|
2014-03-18 15:58:14 +01:00
|
|
|
-source ${JAVA_SOURCE_VERSION} -target ${JAVA_TARGET_VERSION}
|
2012-02-13 12:41:31 +01:00
|
|
|
${java1_srcs} -d ${CMAKE_CURRENT_BINARY_DIR}/classes1
|
|
|
|
COMMAND ${Java_JAR_EXECUTABLE} cfm ${LIBRARY_OUTPUT_PATH}/opj_viewer.jar
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer/dist/manifest.txt -C
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/classes1 .
|
|
|
|
DEPENDS ${java1_srcs}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer/dist/manifest.txt
|
|
|
|
COMMENT "javac *.java; jar cvf -> opj_viewer.jar"
|
2012-02-06 16:00:04 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
# name the target
|
2012-02-13 12:41:31 +01:00
|
|
|
ADD_CUSTOM_TARGET(OPJViewerJar ALL
|
|
|
|
DEPENDS ${LIBRARY_OUTPUT_PATH}/opj_viewer.jar
|
|
|
|
COMMENT "building opj_viewer.jar"
|
|
|
|
)
|
|
|
|
|
2012-04-19 14:30:30 +02:00
|
|
|
INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/opj_viewer.jar
|
2012-04-19 14:40:28 +02:00
|
|
|
DESTINATION ${OPENJPEG_INSTALL_SHARE_DIR} COMPONENT JavaModule
|
2012-04-19 14:30:30 +02:00
|
|
|
)
|
|
|
|
|
2012-02-13 12:41:31 +01:00
|
|
|
# 2. opj_viewer_xerces
|
|
|
|
# search for package org.apache.xerces.parsers
|
|
|
|
find_file(APACHE_XERCES_JAR
|
|
|
|
NAMES xerces-j2.jar xercesImpl.jar
|
|
|
|
PATHS /usr/share/java/
|
|
|
|
NO_DEFAULT_PATH
|
2012-02-06 16:00:04 +01:00
|
|
|
)
|
2012-02-13 12:41:31 +01:00
|
|
|
mark_as_advanced(APACHE_XERCES_JAR)
|
|
|
|
|
|
|
|
if(EXISTS ${APACHE_XERCES_JAR})
|
|
|
|
configure_file(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer_xerces/dist/manifest.txt.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/opj_viewer_xerces/dist/manifest.txt
|
|
|
|
@ONLY
|
|
|
|
)
|
|
|
|
# build dep list:
|
|
|
|
file(GLOB java2_srcs "opj_viewer_xerces/src/*.java")
|
|
|
|
|
|
|
|
# Need some common files:
|
|
|
|
list(APPEND java2_srcs
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer/src/ImageManager.java
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer/src/ImgdecClient.java
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer/src/JPIPHttpClient.java
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer/src/MML.java
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer/src/PnmImage.java
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer/src/RegimViewer.java
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer/src/ResizeListener.java
|
|
|
|
)
|
|
|
|
|
|
|
|
# make sure target javac dir exists:
|
|
|
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/classes2)
|
|
|
|
# Build java
|
|
|
|
ADD_CUSTOM_COMMAND(
|
|
|
|
OUTPUT ${LIBRARY_OUTPUT_PATH}/opj_viewer_xerces.jar
|
2012-02-17 12:33:31 +01:00
|
|
|
COMMAND ${Java_JAVAC_EXECUTABLE} ${jflags}
|
2014-03-18 15:58:14 +01:00
|
|
|
-source ${JAVA_SOURCE_VERSION} -target ${JAVA_TARGET_VERSION}
|
2012-02-13 12:41:31 +01:00
|
|
|
-classpath ${APACHE_XERCES_JAR}
|
|
|
|
${java2_srcs} -d ${CMAKE_CURRENT_BINARY_DIR}/classes2
|
|
|
|
COMMAND ${Java_JAR_EXECUTABLE} cfm ${LIBRARY_OUTPUT_PATH}/opj_viewer_xerces.jar
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/opj_viewer_xerces/dist/manifest.txt
|
|
|
|
-C ${CMAKE_CURRENT_BINARY_DIR}/classes2 .
|
|
|
|
DEPENDS ${java2_srcs}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer_xerces/dist/manifest.txt.in
|
|
|
|
COMMENT "javac *.java; jar cvf -> opj_viewer_xerces.jar"
|
|
|
|
)
|
|
|
|
|
|
|
|
# name the target
|
|
|
|
ADD_CUSTOM_TARGET(OPJViewerXercesJar ALL
|
|
|
|
DEPENDS ${LIBRARY_OUTPUT_PATH}/opj_viewer_xerces.jar
|
|
|
|
COMMENT "building opj_viewer_xerces.jar"
|
|
|
|
)
|
2012-04-19 14:30:30 +02:00
|
|
|
|
|
|
|
INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/opj_viewer_xerces.jar
|
2012-04-19 14:40:28 +02:00
|
|
|
DESTINATION ${OPENJPEG_INSTALL_SHARE_DIR} COMPONENT JavaModule
|
2012-04-19 14:30:30 +02:00
|
|
|
)
|
2012-02-13 12:41:31 +01:00
|
|
|
endif()
|
|
|
|
else(Java_Development_FOUND)
|
|
|
|
message(WARNING "No java compiler found. Wont be able to build java viewer")
|
2012-02-06 16:00:04 +01:00
|
|
|
endif()
|