2011-10-25 23:10:48 +02:00
|
|
|
# Headers file are located here:
|
2012-08-30 19:14:39 +02:00
|
|
|
include_directories(
|
2012-07-25 15:10:21 +02:00
|
|
|
${OPENJPEG_SOURCE_DIR}/libopenjpeg # opj_stdint.h
|
2011-10-25 23:10:48 +02:00
|
|
|
${OPENJPEG_SOURCE_DIR}/applications/jpip/libopenjpip
|
2012-03-02 11:23:20 +01:00
|
|
|
${FCGI_INCLUDE_DIRS}
|
2011-10-25 23:10:48 +02:00
|
|
|
)
|
|
|
|
|
2012-07-25 15:10:21 +02:00
|
|
|
# Tool to embed metadata into JP2 file
|
2012-08-30 19:14:39 +02:00
|
|
|
add_executable(addXMLinJP2 addXMLinJP2.c)
|
2012-07-25 15:10:21 +02:00
|
|
|
# Install exe
|
2012-08-30 19:14:39 +02:00
|
|
|
install(TARGETS addXMLinJP2
|
2012-07-25 15:10:21 +02:00
|
|
|
EXPORT OpenJPEGTargets
|
|
|
|
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
|
|
|
|
)
|
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
if(BUILD_JPIP_SERVER)
|
2012-08-30 19:20:03 +02:00
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
set(OPJ_SERVER_SRCS
|
2011-11-24 11:42:47 +01:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/opj_server.c
|
|
|
|
)
|
2012-08-30 19:20:03 +02:00
|
|
|
|
2012-03-02 11:23:20 +01:00
|
|
|
# Build executable
|
2012-08-30 19:14:39 +02:00
|
|
|
add_executable(opj_server ${OPJ_SERVER_SRCS})
|
|
|
|
target_link_libraries(opj_server openjpip_server)
|
|
|
|
set_property(
|
2012-03-02 11:23:20 +01:00
|
|
|
TARGET opj_server
|
|
|
|
APPEND PROPERTY
|
|
|
|
COMPILE_DEFINITIONS SERVER QUIT_SIGNAL="quitJPIP"
|
|
|
|
)
|
2011-10-25 23:10:48 +02:00
|
|
|
|
2012-03-02 11:23:20 +01:00
|
|
|
# On unix you need to link to the math library:
|
2012-08-30 19:14:39 +02:00
|
|
|
if(UNIX)
|
|
|
|
target_link_libraries(opj_server m)
|
2012-08-30 19:20:03 +02:00
|
|
|
endif()
|
2011-10-25 23:10:48 +02:00
|
|
|
|
2012-03-02 11:23:20 +01:00
|
|
|
# Install exe
|
2012-08-30 19:14:39 +02:00
|
|
|
install(TARGETS opj_server
|
2012-03-02 11:23:20 +01:00
|
|
|
EXPORT OpenJPEGTargets
|
|
|
|
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
|
|
|
|
)
|
2012-08-30 19:20:03 +02:00
|
|
|
endif()
|
2011-10-25 23:10:48 +02:00
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
set(EXES
|
2011-11-24 11:42:47 +01:00
|
|
|
opj_dec_server
|
|
|
|
jpip_to_jp2
|
|
|
|
jpip_to_j2k
|
|
|
|
test_index
|
2011-10-25 23:10:48 +02:00
|
|
|
)
|
2012-08-30 19:14:39 +02:00
|
|
|
foreach(exe ${EXES})
|
|
|
|
add_executable(${exe} ${exe}.c)
|
|
|
|
target_link_libraries(${exe} openjpip_local)
|
|
|
|
install(TARGETS ${exe}
|
2011-11-24 11:42:47 +01:00
|
|
|
EXPORT OpenJPEGTargets
|
|
|
|
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
|
|
|
|
)
|
2012-08-30 19:20:03 +02:00
|
|
|
endforeach()
|
2012-03-02 11:23:20 +01:00
|
|
|
|
|
|
|
# Build the two java clients:
|
2012-08-30 19:14:39 +02:00
|
|
|
find_package(Java 1.5 COMPONENTS Development) # javac, jar
|
2012-03-02 11:23:20 +01:00
|
|
|
|
|
|
|
# Only build the java viewer if dev is found:
|
|
|
|
if(Java_Development_FOUND AND Java_JAVAC_EXECUTABLE)
|
|
|
|
set(jflags $ENV{JFLAGS})
|
|
|
|
# 1. opj_viewer
|
|
|
|
# build dep list:
|
|
|
|
file(GLOB java1_srcs "opj_viewer/src/*.java")
|
|
|
|
|
|
|
|
# make sure target javac dir exists:
|
|
|
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/classes1)
|
|
|
|
# Build java
|
2012-08-30 19:14:39 +02:00
|
|
|
add_custom_command(
|
2012-03-02 11:23:20 +01:00
|
|
|
OUTPUT ${LIBRARY_OUTPUT_PATH}/opj_viewer.jar
|
|
|
|
COMMAND ${Java_JAVAC_EXECUTABLE} ${jflags}
|
|
|
|
${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"
|
|
|
|
)
|
|
|
|
|
|
|
|
# name the target
|
2012-08-30 19:14:39 +02:00
|
|
|
add_custom_target(OPJViewerJar ALL
|
2012-03-02 11:23:20 +01:00
|
|
|
DEPENDS ${LIBRARY_OUTPUT_PATH}/opj_viewer.jar
|
|
|
|
COMMENT "building opj_viewer.jar"
|
|
|
|
)
|
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
install(FILES ${LIBRARY_OUTPUT_PATH}/opj_viewer.jar
|
2012-07-25 15:10:21 +02:00
|
|
|
DESTINATION ${OPENJPEG_INSTALL_SHARE_DIR} COMPONENT JavaModule
|
|
|
|
)
|
|
|
|
|
2012-03-02 11:23:20 +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
|
|
|
|
)
|
|
|
|
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
|
2012-08-30 19:14:39 +02:00
|
|
|
add_custom_command(
|
2012-03-02 11:23:20 +01:00
|
|
|
OUTPUT ${LIBRARY_OUTPUT_PATH}/opj_viewer_xerces.jar
|
|
|
|
COMMAND ${Java_JAVAC_EXECUTABLE} ${jflags}
|
|
|
|
-classpath ${APACHE_XERCES_JAR}
|
|
|
|
${java2_srcs} -d ${CMAKE_CURRENT_BINARY_DIR}/classes2
|
|
|
|
COMMAND ${Java_JAR_EXECUTABLE} cfm ${LIBRARY_OUTPUT_PATH}/opj_viewer_xerces.jar
|
2012-08-30 19:20:03 +02:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/opj_viewer_xerces/dist/manifest.txt
|
2012-03-02 11:23:20 +01:00
|
|
|
-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
|
2012-08-30 19:14:39 +02:00
|
|
|
add_custom_target(OPJViewerXercesJar ALL
|
2012-03-02 11:23:20 +01:00
|
|
|
DEPENDS ${LIBRARY_OUTPUT_PATH}/opj_viewer_xerces.jar
|
|
|
|
COMMENT "building opj_viewer_xerces.jar"
|
|
|
|
)
|
2012-07-25 15:10:21 +02:00
|
|
|
|
2012-08-30 19:14:39 +02:00
|
|
|
install(FILES ${LIBRARY_OUTPUT_PATH}/opj_viewer_xerces.jar
|
2012-07-25 15:10:21 +02:00
|
|
|
DESTINATION ${OPENJPEG_INSTALL_SHARE_DIR} COMPONENT JavaModule
|
|
|
|
)
|
2012-03-02 11:23:20 +01:00
|
|
|
endif()
|
2012-08-30 19:20:03 +02:00
|
|
|
else()
|
2012-03-02 11:23:20 +01:00
|
|
|
message(WARNING "No java compiler found. Wont be able to build java viewer")
|
|
|
|
endif()
|