[trunk] import JPIP modifications for build-system from 1.5

This commit is contained in:
Mathieu Malaterre 2012-03-02 10:23:20 +00:00
parent 3d9a41e4b4
commit 472c390e75
25 changed files with 325 additions and 380 deletions

View File

@ -1,3 +1,16 @@
# lib and utils
# required dep for server:
IF(BUILD_JPIP_SERVER)
FIND_PACKAGE(CURL REQUIRED)
FIND_PACKAGE(FCGI REQUIRED)
FIND_PACKAGE(Threads REQUIRED)
IF(NOT CMAKE_USE_PTHREADS_INIT)
MESSAGE(FATAL_ERROR "Only pthread are supported")
ENDIF(NOT CMAKE_USE_PTHREADS_INIT)
ENDIF(BUILD_JPIP_SERVER)
# JPIP library:
ADD_SUBDIRECTORY(libopenjpip)
# JPIP binaries:
ADD_SUBDIRECTORY(util)

View File

@ -1,11 +0,0 @@
default: t_libopenjpip t_util
t_libopenjpip:
make -C libopenjpip -f Makefile.nix
t_util:
make -C util -f Makefile.nix
clean:
make clean -C libopenjpip -f Makefile.nix
make clean -C util -f Makefile.nix

View File

@ -2,63 +2,69 @@ INCLUDE_REGULAR_EXPRESSION("^.*$")
INCLUDE_DIRECTORIES(
${OPENJPEG_SOURCE_DIR}/libopenjpeg
${FCGI_INCLUDE_DIRNAME}
${FCGI_INCLUDE_DIRS}
${CURL_INCLUDE_DIRS}
)
# Defines the source code for the library
SET(OPENJPIP_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/boxheader_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/codestream_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/imgreg_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/marker_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/msgqueue_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/box_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/faixbox_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/index_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/metadata_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/placeholder_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/byte_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/ihdrbox_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/manfbox_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/mhixbox_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/target_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/cachemodel_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/j2kheader_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/jp2k_encoder.c
${CMAKE_CURRENT_SOURCE_DIR}/openjpip.c
${CMAKE_CURRENT_SOURCE_DIR}/query_parser.c
${CMAKE_CURRENT_SOURCE_DIR}/channel_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/session_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/jpip_parser.c
)
${CMAKE_CURRENT_SOURCE_DIR}/boxheader_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/codestream_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/imgreg_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/marker_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/msgqueue_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/box_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/faixbox_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/index_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/metadata_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/placeholder_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/byte_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/ihdrbox_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/manfbox_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/mhixbox_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/target_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/cachemodel_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/j2kheader_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/jp2k_encoder.c
${CMAKE_CURRENT_SOURCE_DIR}/openjpip.c
${CMAKE_CURRENT_SOURCE_DIR}/query_parser.c
${CMAKE_CURRENT_SOURCE_DIR}/channel_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/session_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/jpip_parser.c
)
SET(SERVER_SRCS
)
SET(LOCAL_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/jp2k_decoder.c
${CMAKE_CURRENT_SOURCE_DIR}/imgsock_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/jpipstream_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/cache_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/dec_clientmsg_handler.c
)
${CMAKE_CURRENT_SOURCE_DIR}/jp2k_decoder.c
${CMAKE_CURRENT_SOURCE_DIR}/imgsock_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/jpipstream_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/cache_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/dec_clientmsg_handler.c
)
# Build the library
ADD_LIBRARY(openjpip_local STATIC ${OPENJPIP_SRCS} ${LOCAL_SRCS})
TARGET_LINK_LIBRARIES(openjpip_local ${OPENJPEG_LIBRARY_NAME})
IF(WIN32)
# add Winsock on windows+mingw
TARGET_LINK_LIBRARIES(openjpip_local ws2_32)
ENDIF(WIN32)
ADD_LIBRARY(openjpip_server STATIC ${OPENJPIP_SRCS})
TARGET_LINK_LIBRARIES(openjpip_server ${FCGI_LIBNAME})
SET_TARGET_PROPERTIES(openjpip_server
PROPERTIES COMPILE_FLAGS "-DSERVER"
# Install library
INSTALL(TARGETS openjpip_local
EXPORT OpenJPEGTargets
DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
)
# As far as I understand the design openjpip_ libs do not have stable API
# This is why they are build as static. Thus they should NOT be installed as of yet
# Install library
#INSTALL(TARGETS openjpip_local
# EXPORT OpenJPEGTargets
# DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
# )
#
#INSTALL(TARGETS openjpip_server
# EXPORT OpenJPEGTargets
# DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
# )
IF(BUILD_JPIP_SERVER)
ADD_LIBRARY(openjpip_server STATIC ${OPENJPIP_SRCS} ${SERVER_SRCS})
TARGET_LINK_LIBRARIES(openjpip_server ${FCGI_LIBRARIES} ${CURL_LIBRARIES} ${CMAKE_THREAD_LIBS})
SET_TARGET_PROPERTIES(openjpip_server
PROPERTIES COMPILE_FLAGS "-DSERVER")
INSTALL(TARGETS openjpip_server
EXPORT OpenJPEGTargets
DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
)
ENDIF(BUILD_JPIP_SERVER)

View File

@ -3,7 +3,15 @@ MAINTAINERCLEANFILES = Makefile.in
includesdir = $(includedir)/openjpeg-$(MAJOR_NR).$(MINOR_NR)
includes_HEADERS =
lib_LTLIBRARIES = libopenjpip_server.la libopenjpip_local.la
lib_LTLIBRARIES =
if WANT_JPIP
lib_LTLIBRARIES += libopenjpip_local.la
endif
if WANT_JPIP_SERVER
lib_LTLIBRARIES += libopenjpip_server.la
endif
JPIP_SRC = \
openjpip.c \
@ -29,6 +37,8 @@ target_manager.c \
cachemodel_manager.c \
j2kheader_manager.c \
jp2k_encoder.c \
sock_manager.c \
openjpip.h \
bool.h \
boxheader_manager.h \
box_manager.h \
@ -51,7 +61,12 @@ jp2k_encoder.h \
query_parser.h \
channel_manager.h \
session_manager.h \
jpip_parser.h
jpip_parser.h \
jp2k_decoder.h \
sock_manager.h
SERVER_SRC = auxtrans_manager.c \
auxtrans_manager.h
LOCAL_SRC = jp2k_decoder.c \
imgsock_manager.c \
@ -68,24 +83,27 @@ libopenjpip_server_la_CPPFLAGS = \
-I$(top_srcdir)/applications/jpip/libopenjpip \
-I$(top_builddir)/applications/jpip/libopenjpip \
@FCGI_CFLAGS@ \
@LIBCURL_CFLAGS@ \
-DSERVER
libopenjpip_server_la_CFLAGS =
libopenjpip_server_la_LIBADD = @FCGI_LIBS@ -lm
libopenjpip_server_la_CFLAGS = @THREAD_CFLAGS@
libopenjpip_server_la_LIBADD = @FCGI_LIBS@ @LIBCURL_LIBS@ @THREAD_LIBS@ -lm
libopenjpip_server_la_LDFLAGS = -no-undefined -version-info @lt_version@
libopenjpip_server_la_SOURCES = $(JPIP_SRC)
libopenjpip_server_la_SOURCES = $(JPIP_SRC) $(SERVER_SRC)
libopenjpip_local_la_CPPFLAGS = \
-I. \
-I$(top_srcdir)/libopenjpeg \
-I$(top_builddir)/libopenjpeg \
-I$(top_srcdir)/applications/jpip/libopenjpip \
-I$(top_builddir)/applications/jpip/libopenjpip
libopenjpip_local_la_CFLAGS =
-I$(top_builddir)/applications/jpip/libopenjpip \
@LIBCURL_CFLAGS@
libopenjpip_local_la_CFLAGS =
libopenjpip_local_la_LIBADD = $(top_builddir)/libopenjpeg/libopenjpeg.la -lm
libopenjpip_local_la_LDFLAGS = -no-undefined -version-info @lt_version@
libopenjpip_local_la_SOURCES = $(JPIP_SRC) $(LOCAL_SRC)
install-data-hook:
if WANT_JPIP_SERVER
@echo -e " (LA)\t$(libdir)/libopenjpip_server.la" >> $(top_builddir)/report.txt
if BUILD_SHARED
@( $(call solist_s) ) >> $(top_builddir)/report.txt
@ -93,6 +111,8 @@ endif
if BUILD_STATIC
@echo -e " (A)\t$(base_s)/$(a_s)" >> $(top_builddir)/report.txt
endif
endif
if WANT_JPIP
@echo -e " (LA)\t$(libdir)/libopenjpip_local.la" >> $(top_builddir)/report.txt
if BUILD_SHARED
@( $(call solist_c) ) >> $(top_builddir)/report.txt
@ -100,6 +120,7 @@ endif
if BUILD_STATIC
@echo -e " (A)\t$(base_c)/$(a_c)" >> $(top_builddir)/report.txt
endif
endif
solist_s = $(foreach f, $(dll_s) $(so_s), echo -e ' $(SO_PREFIX)\t$(base_s)/$(f)' ;)
get_tok_s = $(shell grep -E "^$(1)=" libopenjpip_server.la | cut -d "'" -f 2)

View File

@ -1,10 +0,0 @@
default: local server
local:
make -f comMakefile.mk
server:
rm *.o && make jpipserver=yes -f comMakefile.mk
clean:
rm -f *.a *.o *~

View File

@ -1,29 +0,0 @@
ifdef jpipserver
CFLAGS = -O3 -Wall -m32 -DSERVER
LIBNAME = libopenjpip_server.a
else
J2KINCDIR = ../../../libopenjpeg
CFLAGS = -O3 -Wall -I$(J2KINCDIR)
LIBNAME = libopenjpip_local.a
endif
all: $(LIBNAME)
ifdef jpipserver
$(LIBNAME): openjpip.o target_manager.o byte_manager.o box_manager.o boxheader_manager.o manfbox_manager.o \
mhixbox_manager.o marker_manager.o codestream_manager.o faixbox_manager.o index_manager.o \
msgqueue_manager.o metadata_manager.o placeholder_manager.o ihdrbox_manager.o imgreg_manager.o \
cachemodel_manager.o j2kheader_manager.o jp2k_encoder.o query_parser.o channel_manager.o \
session_manager.o jpip_parser.o
ar r $@ $^
else
$(LIBNAME): openjpip.o target_manager.o byte_manager.o box_manager.o boxheader_manager.o manfbox_manager.o \
mhixbox_manager.o marker_manager.o codestream_manager.o faixbox_manager.o index_manager.o \
msgqueue_manager.o metadata_manager.o placeholder_manager.o ihdrbox_manager.o imgreg_manager.o \
cachemodel_manager.o j2kheader_manager.o jp2k_encoder.o query_parser.o channel_manager.o \
session_manager.o jpip_parser.o jp2k_decoder.o imgsock_manager.o jpipstream_manager.o cache_manager.o \
dec_clientmsg_handler.o
ar r $@ $^
endif
clean:
rm -f $(LIBNAME) *.o *~

View File

@ -1,31 +1,36 @@
# Headers file are located here:
INCLUDE_DIRECTORIES(
${OPENJPEG_SOURCE_DIR}/applications/jpip/libopenjpip
${FCGI_INCLUDE_DIRNAME}
${FCGI_INCLUDE_DIRS}
)
SET(OPJ_SERVER_SRCS
IF(BUILD_JPIP_SERVER)
SET(OPJ_SERVER_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/opj_server.c
)
# 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"
)
# Build executable
ADD_EXECUTABLE(opj_server ${OPJ_SERVER_SRCS})
TARGET_LINK_LIBRARIES(opj_server openjpip_server ${FCGI_LIBNAME})
SET_TARGET_PROPERTIES(opj_server
PROPERTIES COMPILE_FLAGS "-DSERVER -DQUIT_SIGNAL=\\\"quitJPIP\\\""
)
# On unix you need to link to the math library:
IF(UNIX)
TARGET_LINK_LIBRARIES(opj_server m)
ENDIF(UNIX)
# On unix you need to link to the math library:
IF(UNIX)
TARGET_LINK_LIBRARIES(opj_server m)
ENDIF(UNIX)
# Install exe
INSTALL(TARGETS opj_server
EXPORT OpenJPEGTargets
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
)
ENDIF(BUILD_JPIP_SERVER)
# Install exe
INSTALL(TARGETS opj_server
EXPORT OpenJPEGTargets
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
)
#
SET(EXES
opj_dec_server
jpip_to_jp2
@ -40,3 +45,89 @@ FOREACH(exe ${EXES})
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
)
ENDFOREACH(exe)
# Build the two java clients:
FIND_PACKAGE(Java 1.5 COMPONENTS Development) # javac, jar
# 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
ADD_CUSTOM_COMMAND(
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
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} ${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
${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()

View File

@ -1,19 +1,27 @@
MAINTAINERCLEANFILES = Makefile.in
bin_PROGRAMS = opj_server opj_dec_server jpip_to_jp2 jpip_to_j2k test_index
bin_PROGRAMS =
if WANT_JPIP
bin_PROGRAMS += opj_dec_server test_index jpip_to_j2k jpip_to_jp2
endif
if WANT_JPIP_SERVER
bin_PROGRAMS += opj_server
endif
opj_server_CPPFLAGS = \
@FCGI_CFLAGS@ \
-I. \
-I$(top_srcdir)/applications/jpip/libopenjpip \
-I$(top_builddir)/applications/jpip/libopenjpip
#
opj_server_CFLAGS = -DSERVER -DQUIT_SIGNAL=\"quitJPIP\"
-I$(top_builddir)/applications/jpip/libopenjpip \
-DSERVER \
-DQUIT_SIGNAL=\"quitJPIP\"
#
opj_server_LDADD = $(top_builddir)/applications/jpip/libopenjpip/libopenjpip_server.la @FCGI_LIBS@ -lm
#
opj_server_SOURCES = \
opj_server.c
opj_server_SOURCES = opj_server.c
#-------------
opj_dec_server_CPPFLAGS = \
-I. \
@ -23,6 +31,7 @@ opj_dec_server_CPPFLAGS = \
opj_dec_server_CFLAGS =
opj_dec_server_LDADD = $(top_builddir)/applications/jpip/libopenjpip/libopenjpip_local.la
opj_dec_server_SOURCES = opj_dec_server.c
#-------------
jpip_to_jp2_CPPFLAGS = \
-I. \
@ -32,6 +41,7 @@ jpip_to_jp2_CPPFLAGS = \
jpip_to_jp2_CFLAGS =
jpip_to_jp2_LDADD = $(top_builddir)/applications/jpip/libopenjpip/libopenjpip_local.la
jpip_to_jp2_SOURCES = jpip_to_jp2.c
#-------------
jpip_to_j2k_CPPFLAGS = \
-I. \
@ -41,6 +51,7 @@ jpip_to_j2k_CPPFLAGS = \
jpip_to_j2k_CFLAGS =
jpip_to_j2k_LDADD = $(top_builddir)/applications/jpip/libopenjpip/libopenjpip_local.la
jpip_to_j2k_SOURCES = jpip_to_j2k.c
#-------------
test_index_CPPFLAGS = \
-I. \
@ -50,10 +61,15 @@ test_index_CPPFLAGS = \
test_index_CFLAGS =
test_index_LDADD = $(top_builddir)/applications/jpip/libopenjpip/libopenjpip_local.la
test_index_SOURCES = test_index.c
#-------------
install-data-hook:
if WANT_JPIP_SERVER
@echo -e " (B)\t$(bindir)/opj_server$(EXEEXT)" >> $(top_builddir)/report.txt
endif
if WANT_JPIP
@echo -e " (B)\t$(bindir)/opj_dec_server$(EXEEXT)" >> $(top_builddir)/report.txt
@echo -e " (B)\t$(bindir)/jpip_to_jp2$(EXEEXT)" >> $(top_builddir)/report.txt
@echo -e " (B)\t$(bindir)/jpip_to_j2k$(EXEEXT)" >> $(top_builddir)/report.txt
@echo -e " (B)\t$(bindir)/test_index$(EXEEXT)" >> $(top_builddir)/report.txt
endif

View File

@ -1,33 +0,0 @@
JPIPLIBDIR = ../libopenjpip
SLIBFNAME = $(JPIPLIBDIR)/libopenjpip_server.a
SCFLAGS = -O3 -Wall -m32 -I$(JPIPLIBDIR) -DSERVER -DQUIT_SIGNAL=\"quitJPIP\"
SLDFLAGS = -L$(JPIPLIBDIR) -lm -lfcgi -lopenjpip_server
J2KINCDIR = ../../../libopenjpeg
J2KLIBDIR = $(J2KINCDIR)/.libs
LIBFNAME = $(JPIPLIBDIR)/libopenjpip_local.a $(J2KLIBDIR)/libopenjpeg.a
CFLAGS = -O3 -Wall -I$(JPIPLIBDIR)
LDFLAGS = -L$(JPIPLIBDIR) -L$(J2KLIBDIR) -lm -lopenjpip_local
ALL = opj_server opj_dec_server jpip_to_jp2 jpip_to_j2k test_index addXMLinJP2
all: $(ALL)
opj_server: opj_server.c $(SLIBFNAME)
$(CC) $(SCFLAGS) $< $(SLDFLAGS) $(SLIBFNAME) -o $@
opj_dec_server: opj_dec_server.c $(LIBFNAME)
$(CC) $(CFLAGS) $< $(LDFLAGS) $(LIBFNAME) -o $@
jpip_to_jp2: jpip_to_jp2.c $(LIBFNAME)
$(CC) $(CFLAGS) $< $(LDFLAGS) $(LIBFNAME) -o $@
jpip_to_j2k: jpip_to_j2k.c $(LIBFNAME)
$(CC) $(CFLAGS) $< $(LDFLAGS) $(LIBFNAME) -o $@
test_index: test_index.c $(LIBFNAME)
$(CC) $(CFLAGS) $< $(LDFLAGS) $(LIBFNAME) -o $@
clean:
rm -f $(ALL) *.o *~

View File

@ -64,7 +64,7 @@ int main(int argc,char *argv[])
if(!( fwrite_jp2k( argv[2], dec)))
return -1;
// output_log( true, false, false, dec);
/* output_log( true, false, false, dec); */
destroy_jpipdecoder( &dec);

View File

@ -1,35 +0,0 @@
<project name="opj_viewer" default="dist" basedir=".">
<description>OpenJPIP client image viewer</description>
<property name="src" location="src" />
<property name="build" location="build"/>
<property name="dist" location="dist" />
<target name="init">
<tstamp/>
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="init">
<javac srcdir="${src}" destdir="${build}"/>
</target>
<target name="dist" depends="compile">
<mkdir dir="${dist}"/>
<jar jarfile="${dist}/opj_viewer-${DSTAMP}.jar"
basedir="${build}" manifest="${dist}/manifest.txt"/>
<exec dir="${dist}" executable="ln">
<arg line="-sf opj_viewer-${DSTAMP}.jar opj_viewer.jar"/>
</exec>
</target>
<target name="clean">
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
<target name="test" depends="dist">
<exec executable="appletviewer"><arg line="dist.html"/></exec>
</target>
<target name="build_test" depends="compile">
<exec executable="appletviewer"><arg line="compile.html"/></exec>
</target>
<target name="build_testj" depends="compile">
<exec executable="java"><arg line="-classpath build ImageWindow girl"/></exec>
</target>
</project>

View File

@ -151,4 +151,4 @@ public class PnmImage extends Component
return createImage(prod);
}
}
}

View File

@ -111,4 +111,4 @@ public class RegimViewer extends JPanel
{
return (new Dimension( vw, vh));
}
}
}

View File

@ -64,4 +64,4 @@ class ResizeListener implements ComponentListener
}
public void componentShown(ComponentEvent e) {}
}
}

View File

@ -1,35 +0,0 @@
<project name="opj_viewer_xerces" default="dist" basedir=".">
<description>OpenJPIP client image viewer</description>
<property name="src" location="src" />
<property name="build" location="build"/>
<property name="dist" location="dist" />
<target name="init">
<tstamp/>
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="init">
<javac srcdir="${src}" destdir="${build}"/>
</target>
<target name="dist" depends="compile">
<mkdir dir="${dist}"/>
<jar jarfile="${dist}/opj_viewer_xerces-${DSTAMP}.jar"
basedir="${build}" manifest="${dist}/manifest.txt"/>
<exec dir="${dist}" executable="ln">
<arg line="-sf opj_viewer_xerces-${DSTAMP}.jar opj_viewer_xerces.jar"/>
</exec>
</target>
<target name="clean">
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
<target name="test" depends="dist">
<exec executable="appletviewer"><arg line="dist.html"/></exec>
</target>
<target name="build_test" depends="compile">
<exec executable="appletviewer"><arg line="compile.html"/></exec>
</target>
<target name="build_testj" depends="compile">
<exec executable="java"><arg line="-classpath build ImageWindow girl"/></exec>
</target>
</project>

View File

@ -2,4 +2,4 @@ Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: Kaori Hagihara
Main-Class: ImageWindow
Class-Path: /usr/share/java/xerces-j2.jar
Class-Path: @APACHE_XERCES_JAR@

View File

@ -1 +0,0 @@
../../opj_viewer/src/ImageManager.java

View File

@ -1 +0,0 @@
../../opj_viewer/src/ImgdecClient.java

View File

@ -1 +0,0 @@
../../opj_viewer/src/JPIPHttpClient.java

View File

@ -1 +0,0 @@
../../opj_viewer/src/MML.java

View File

@ -1 +0,0 @@
../../opj_viewer/src/PnmImage.java

View File

@ -1 +0,0 @@
../../opj_viewer/src/RegimViewer.java

View File

@ -1 +0,0 @@
../../opj_viewer/src/ResizeListener.java

View File

@ -41,7 +41,11 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifdef _WIN32
#include <io.h>
#else
#include <unistd.h>
#endif
#include "openjpip.h"
int
@ -49,6 +53,7 @@ main(int argc, char *argv[])
{
int fd;
index_t *jp2idx;
if( argc < 2 ) return 1;
if( (fd = open( argv[1], O_RDONLY)) == -1){
fprintf( stderr, "Error: Target %s not found\n", argv[1]);

View File

@ -1,161 +1,114 @@
IF(UNIX OR CYGWIN)
SET(CMAKE_INCLUDE_PATH /usr/include /usr/local/include /opt/include
/opt/local/include /usr/include/libpng /usr/include/libpng14
/usr/include/libpng12 /usr/local/include/libpng
/usr/local/include/libpng14 /usr/local/include/libpng12
/opt/include/libpng /opt/include/libpng14 /opt/include/libpng12
/opt/local/include/libpng /opt/local/include/libpng14)
SET(CMAKE_LIBRARY_PATH /usr/lib /usr/local/lib /opt/lib /opt/local/lib)
ENDIF(UNIX OR CYGWIN)
# 3rd party libs
#------------
# Try to find lib Z
FIND_PACKAGE(ZLIB)
IF(ZLIB_FOUND)
SET(Z_LIBNAME ${ZLIB_LIBRARIES} PARENT_SCOPE)
SET(Z_INCLUDE_DIRNAME ${ZLIB_INCLUDE_DIRS} PARENT_SCOPE)
message(STATUS "Your system seems to have a Z lib available, we will use it to generate PNG lib")
ELSE (ZLIB_FOUND) # not found
IF(BUILD_THIRDPARTY)
# Try to build it
message(STATUS "We will build Z lib from thirdparty")
ADD_SUBDIRECTORY(libz)
SET(Z_LIBNAME z PARENT_SCOPE)
SET(Z_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/include PARENT_SCOPE)
SET(ZLIB_FOUND 1)
ELSE (BUILD_THIRDPARTY)
message(WARNING "Z lib not found, activate BUILD_THIRDPARTY if you want build it (necessary to build libPNG)")
ENDIF(BUILD_THIRDPARTY)
IF(BUILD_THIRDPARTY)
# Try to build it
message(STATUS "We will build Z lib from thirdparty")
ADD_SUBDIRECTORY(libz)
SET(Z_LIBNAME z PARENT_SCOPE)
SET(Z_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/include PARENT_SCOPE)
SET(ZLIB_FOUND 1)
ELSE (BUILD_THIRDPARTY)
# Try to find lib Z
FIND_PACKAGE(ZLIB)
IF(ZLIB_FOUND)
SET(Z_LIBNAME ${ZLIB_LIBRARIES} PARENT_SCOPE)
SET(Z_INCLUDE_DIRNAME ${ZLIB_INCLUDE_DIRS} PARENT_SCOPE)
message(STATUS "Your system seems to have a Z lib available, we will use it to generate PNG lib")
ELSE (ZLIB_FOUND) # not found
message(STATUS "Z lib not found, activate BUILD_THIRDPARTY if you want build it (necessary to build libPNG)")
ENDIF(ZLIB_FOUND)
ENDIF(BUILD_THIRDPARTY)
ENDIF(ZLIB_FOUND)
#------------
# Try to find lib PNG (which depends to zlib)
IF (ZLIB_FOUND)
FIND_PACKAGE(PNG)
IF(PNG_FOUND)
message(STATUS "Your system seems to have a PNG lib available, we will use it")
SET(HAVE_PNG_H 1 PARENT_SCOPE)
SET(HAVE_LIBPNG 1 PARENT_SCOPE)
SET(PNG_LIBNAME ${PNG_LIBRARIES} PARENT_SCOPE)
SET(PNG_INCLUDE_DIRNAME ${PNG_PNG_INCLUDE_DIR} PARENT_SCOPE)
ELSE(PNG_FOUND) # not found
IF(BUILD_THIRDPARTY)
# Try to build it
message(STATUS "We will build PNG lib from thirdparty")
ADD_SUBDIRECTORY(libpng)
# Try to find lib PNG (which depends on zlib)
IF(BUILD_THIRDPARTY)
# Try to build it
message(STATUS "We will build PNG lib from thirdparty")
ADD_SUBDIRECTORY(libpng)
SET(HAVE_PNG_H 1 PARENT_SCOPE)
SET(HAVE_LIBPNG 1 PARENT_SCOPE)
SET(PNG_LIBNAME png PARENT_SCOPE)
SET(PNG_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/libpng PARENT_SCOPE)
ELSE (BUILD_THIRDPARTY)
IF (ZLIB_FOUND)
FIND_PACKAGE(PNG)
IF(PNG_FOUND)
message(STATUS "Your system seems to have a PNG lib available, we will use it")
SET(HAVE_PNG_H 1 PARENT_SCOPE)
SET(HAVE_LIBPNG 1 PARENT_SCOPE)
SET(PNG_LIBNAME png PARENT_SCOPE)
SET(PNG_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/libpng PARENT_SCOPE)
ELSE (BUILD_THIRDPARTY)
SET(PNG_LIBNAME ${PNG_LIBRARIES} PARENT_SCOPE)
SET(PNG_INCLUDE_DIRNAME ${PNG_PNG_INCLUDE_DIR} PARENT_SCOPE)
ELSE(PNG_FOUND) # not found
SET(HAVE_PNG_H 0 PARENT_SCOPE)
SET(HAVE_LIBPNG 0 PARENT_SCOPE)
message(WARNING "PNG lib not found, activate BUILD_THIRDPARTY if you want build it")
ENDIF(BUILD_THIRDPARTY)
ENDIF(PNG_FOUND)
ENDIF (ZLIB_FOUND)
message(STATUS "PNG lib not found, activate BUILD_THIRDPARTY if you want build it")
ENDIF(PNG_FOUND)
ENDIF (ZLIB_FOUND)
ENDIF(BUILD_THIRDPARTY)
#------------
# Try to find lib TIFF
FIND_PACKAGE(TIFF)
IF(TIFF_FOUND)
message(STATUS "Your system seems to have a TIFF lib available, we will use it")
IF(BUILD_THIRDPARTY)
# Try to build it
message(STATUS "We will build TIFF lib from thirdparty")
ADD_SUBDIRECTORY(libtiff)
SET(TIFF_LIBNAME tiff PARENT_SCOPE)
SET(TIFF_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/libtiff PARENT_SCOPE)
SET(HAVE_TIFF_H 1 PARENT_SCOPE)
SET(HAVE_LIBTIFF 1 PARENT_SCOPE)
SET(TIFF_LIBNAME ${TIFF_LIBRARIES} PARENT_SCOPE)
SET(TIFF_INCLUDE_DIRNAME ${TIFF_INCLUDE_DIR} PARENT_SCOPE)
ELSE (TIFF_FOUND) # not found
IF(BUILD_THIRDPARTY)
# Try to build it
message(STATUS "We will build TIFF lib from thirdparty")
ADD_SUBDIRECTORY(libtiff)
SET(TIFF_LIBNAME tiff PARENT_SCOPE)
SET(TIFF_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/libtiff PARENT_SCOPE)
ELSE (BUILD_THIRDPARTY)
FIND_PACKAGE(TIFF)
IF(TIFF_FOUND)
message(STATUS "Your system seems to have a TIFF lib available, we will use it")
SET(HAVE_TIFF_H 1 PARENT_SCOPE)
SET(HAVE_LIBTIFF 1 PARENT_SCOPE)
ELSE (BUILD_THIRDPARTY)
SET(TIFF_LIBNAME ${TIFF_LIBRARIES} PARENT_SCOPE)
SET(TIFF_INCLUDE_DIRNAME ${TIFF_INCLUDE_DIR} PARENT_SCOPE)
ELSE (TIFF_FOUND) # not found
SET(HAVE_TIFF_H 0 PARENT_SCOPE)
SET(HAVE_LIBTIFF 0 PARENT_SCOPE)
message(WARNING "TIFF lib not found, activate BUILD_THIRDPARTY if you want build it")
ENDIF(BUILD_THIRDPARTY)
ENDIF(TIFF_FOUND)
message(STATUS "TIFF lib not found, activate BUILD_THIRDPARTY if you want build it")
ENDIF(TIFF_FOUND)
ENDIF(BUILD_THIRDPARTY)
#------------
# Try to find lib LCMS2 (or by default LCMS)
FIND_PACKAGE(LCMS2)
SET(HAVE_LCMS_H 0 PARENT_SCOPE)
SET(HAVE_LIBLCMS 0 PARENT_SCOPE)
IF(LCMS2_FOUND)
message(STATUS "Your system seems to have a LCMS2 lib available, we will use it")
IF( BUILD_THIRDPARTY)
# Try to build lcms2
message(STATUS "We will build LCMS2 lib from thirdparty")
ADD_SUBDIRECTORY(liblcms2)
SET(LCMS_LIBNAME lcms2 PARENT_SCOPE)
SET(LCMS_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/liblcms2/include PARENT_SCOPE) #
SET(HAVE_LCMS2_H 1 PARENT_SCOPE)
SET(HAVE_LIBLCMS2 1 PARENT_SCOPE)
SET(LCMS_LIBNAME ${LCMS2_LIBRARIES} PARENT_SCOPE)
SET(LCMS_INCLUDE_DIRNAME ${LCMS2_INCLUDE_DIRS} PARENT_SCOPE)
ELSE (LCMS2_FOUND) # not found lcms2
# try to find LCMS
FIND_PACKAGE(LCMS)
IF(LCMS_FOUND)
message(STATUS "Your system seems to have a LCMS lib available, we will use it")
SET(HAVE_LCMS_H 1 PARENT_SCOPE)
SET(HAVE_LIBLCMS 1 PARENT_SCOPE)
SET(LCMS_LIBNAME ${LCMS_LIBRARIES} PARENT_SCOPE)
SET(LCMS_INCLUDE_DIRNAME ${LCMS_INCLUDE_DIRS} PARENT_SCOPE)
ELSE (LCMS_FOUND) # not found lcms
SET(HAVE_LCMS_H 0 PARENT_SCOPE)
SET(HAVE_LIBLCMS 0 PARENT_SCOPE)
IF( BUILD_THIRDPARTY)
# Try to build lcms2
message(STATUS "We will build LCMS2 lib from thirdparty")
ADD_SUBDIRECTORY(liblcms2)
SET(LCMS_LIBNAME lcms2 PARENT_SCOPE)
SET(LCMS_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/liblcms2/include PARENT_SCOPE) #
SET(HAVE_LCMS2_H 1 PARENT_SCOPE)
SET(HAVE_LIBLCMS2 1 PARENT_SCOPE)
ELSE (BUILD_THIRDPARTY)
SET(HAVE_LCMS2_H 0 PARENT_SCOPE)
SET(HAVE_LIBLCMS2 0 PARENT_SCOPE)
message(WARNING "LCMS2 or LCMS lib not found, activate BUILD_THIRDPARTY if you want build it")
ENDIF(BUILD_THIRDPARTY)
ENDIF (LCMS_FOUND)
ENDIF(LCMS2_FOUND)
#------------
# Try to find lib FCGI
FIND_PACKAGE(FCGI)
IF(FCGI_FOUND)
SET(FCGI_LIBNAME ${FCGI_LIBRARIES} PARENT_SCOPE)
SET(FCGI_INCLUDE_DIRNAME ${FCGI_INCLUDE_DIRS} PARENT_SCOPE)
message(STATUS "Your system seems to have a FCGI lib available, we will use it to build JPIP")
ELSE (FCGI_FOUND) # not found
message(WARNING "FCGI lib not found, JPIP will not be built as it requires FCGI")
ENDIF(FCGI_FOUND)
ELSE (BUILD_THIRDPARTY)
FIND_PACKAGE(LCMS2)
IF(LCMS2_FOUND)
message(STATUS "Your system seems to have a LCMS2 lib available, we will use it")
SET(HAVE_LCMS2_H 1 PARENT_SCOPE)
SET(HAVE_LIBLCMS2 1 PARENT_SCOPE)
SET(LCMS_LIBNAME ${LCMS2_LIBRARIES} PARENT_SCOPE)
SET(LCMS_INCLUDE_DIRNAME ${LCMS2_INCLUDE_DIRS} PARENT_SCOPE)
ELSE (LCMS2_FOUND) # not found lcms2
# try to find LCMS
FIND_PACKAGE(LCMS)
IF(LCMS_FOUND)
message(STATUS "Your system seems to have a LCMS lib available, we will use it")
SET(HAVE_LCMS_H 1 PARENT_SCOPE)
SET(HAVE_LIBLCMS 1 PARENT_SCOPE)
SET(LCMS_LIBNAME ${LCMS_LIBRARIES} PARENT_SCOPE)
SET(LCMS_INCLUDE_DIRNAME ${LCMS_INCLUDE_DIRS} PARENT_SCOPE)
ELSE (LCMS_FOUND) # not found lcms
SET(HAVE_LCMS2_H 0 PARENT_SCOPE)
SET(HAVE_LIBLCMS2 0 PARENT_SCOPE)
message(STATUS "LCMS2 or LCMS lib not found, activate BUILD_THIRDPARTY if you want build it")
ENDIF (LCMS_FOUND)
ENDIF(LCMS2_FOUND)
ENDIF(BUILD_THIRDPARTY)