By default, openjpip client can still built even without java compiler. Print a message to the user as warning.
This commit is contained in:
parent
07521a5dc2
commit
a9b7c7b0b4
@ -47,81 +47,86 @@ FOREACH(exe ${EXES})
|
||||
ENDFOREACH(exe)
|
||||
|
||||
# Build the two java clients:
|
||||
FIND_PACKAGE(Java 1.5 REQUIRED) # javac, jar
|
||||
FIND_PACKAGE(Java 1.5 COMPONENTS Development) # javac, jar
|
||||
|
||||
# 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
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${LIBRARY_OUTPUT_PATH}/opj_viewer.jar
|
||||
COMMAND ${Java_JAVAC_EXECUTABLE}
|
||||
${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
|
||||
ADD_CUSTOM_TARGET(OPJViewerJar ALL
|
||||
DEPENDS ${LIBRARY_OUTPUT_PATH}/opj_viewer.jar
|
||||
COMMENT "building opj_viewer.jar"
|
||||
)
|
||||
|
||||
# 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
|
||||
)
|
||||
# Only build the java viewer if dev is found:
|
||||
if(Java_Development_FOUND)
|
||||
# 1. opj_viewer
|
||||
# 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
|
||||
)
|
||||
file(GLOB java1_srcs "opj_viewer/src/*.java")
|
||||
|
||||
# make sure target javac dir exists:
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/classes2)
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/classes1)
|
||||
# Build java
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${LIBRARY_OUTPUT_PATH}/opj_viewer_xerces.jar
|
||||
OUTPUT ${LIBRARY_OUTPUT_PATH}/opj_viewer.jar
|
||||
COMMAND ${Java_JAVAC_EXECUTABLE}
|
||||
-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"
|
||||
${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
|
||||
ADD_CUSTOM_TARGET(OPJViewerXercesJar ALL
|
||||
DEPENDS ${LIBRARY_OUTPUT_PATH}/opj_viewer_xerces.jar
|
||||
COMMENT "building opj_viewer_xerces.jar"
|
||||
ADD_CUSTOM_TARGET(OPJViewerJar ALL
|
||||
DEPENDS ${LIBRARY_OUTPUT_PATH}/opj_viewer.jar
|
||||
COMMENT "building opj_viewer.jar"
|
||||
)
|
||||
|
||||
# 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
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${LIBRARY_OUTPUT_PATH}/opj_viewer_xerces.jar
|
||||
COMMAND ${Java_JAVAC_EXECUTABLE}
|
||||
-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"
|
||||
)
|
||||
endif()
|
||||
else(Java_Development_FOUND)
|
||||
message(WARNING "No java compiler found. Wont be able to build java viewer")
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user