Refactor code to split jpip client code from server side.

This commit is contained in:
Mathieu Malaterre 2012-01-25 09:42:00 +00:00
parent ba01e855a3
commit 2b746a71cb
6 changed files with 36 additions and 44 deletions

View File

@ -185,22 +185,14 @@ ADD_SUBDIRECTORY(libopenjpeg)
OPTION(BUILD_CODEC "Build the CODEC executables" ON)
OPTION(BUILD_MJ2 "Build the MJ2 executables." OFF)
OPTION(BUILD_JPIP "Build the JPIP library and executables." OFF)
IF(BUILD_JPIP)
OPTION(BUILD_JPIP_SERVER "Build the JPIP server." OFF)
ENDIF(BUILD_JPIP)
OPTION(BUILD_VIEWER "Build the OPJViewer executable (C++)" OFF)
OPTION(BUILD_JAVA "Build the openjpeg jar (Java)" OFF)
MARK_AS_ADVANCED(BUILD_VIEWER)
MARK_AS_ADVANCED(BUILD_JAVA)
IF(BUILD_JPIP)
FIND_PACKAGE(CURL)
ENDIF (BUILD_JPIP)
IF(NOT CURL_FOUND)
IF(BUILD_JPIP)
message(WARNING "You must have libcurl installed to use JPIP")
ENDIF (BUILD_JPIP)
SET(BUILD_JPIP OFF)
ENDIF (NOT CURL_FOUND)
# Try to find lib Z
FIND_PACKAGE(ZLIB)

View File

@ -8,6 +8,7 @@ IF(BUILD_MJ2)
ADD_SUBDIRECTORY(mj2)
ENDIF(BUILD_MJ2)
# Client & Server:
IF(BUILD_JPIP)
ADD_SUBDIRECTORY(jpip)
ENDIF(BUILD_JPIP)

View File

@ -1,3 +1,13 @@
# required dep for server:
IF(BUILD_JPIP_SERVER)
FIND_PACKAGE(CURL REQUIRED)
FIND_PACKAGE(FCGI REQUIRED)
ENDIF(BUILD_JPIP_SERVER)
# JPIP client & server:
ADD_SUBDIRECTORY(libopenjpip)
ADD_SUBDIRECTORY(util)
# jpip server:
IF(BUILD_JPIP_SERVER)
ADD_SUBDIRECTORY(util)
ENDIF(BUILD_JPIP_SERVER)

View File

@ -2,7 +2,7 @@ INCLUDE_REGULAR_EXPRESSION("^.*$")
INCLUDE_DIRECTORIES(
${OPENJPEG_SOURCE_DIR}/libopenjpeg
${FCGI_INCLUDE_DIRNAME}
${FCGI_INCLUDE_DIRS}
${CURL_INCLUDE_DIRS}
)
@ -47,18 +47,19 @@ SET(LOCAL_SRCS
ADD_LIBRARY(openjpip_local STATIC ${OPENJPIP_SRCS} ${LOCAL_SRCS})
TARGET_LINK_LIBRARIES(openjpip_local ${OPENJPEG_LIBRARY_NAME} ${CURL_LIBRARIES})
ADD_LIBRARY(openjpip_server STATIC ${OPENJPIP_SRCS})
TARGET_LINK_LIBRARIES(openjpip_server ${FCGI_LIBNAME} ${CURL_LIBRARIES})
SET_TARGET_PROPERTIES(openjpip_server
PROPERTIES COMPILE_FLAGS "-DSERVER")
# Install library
INSTALL(TARGETS openjpip_local
EXPORT OpenJPEGTargets
DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
)
INSTALL(TARGETS openjpip_server
IF(BUILD_JPIP_SERVER)
ADD_LIBRARY(openjpip_server STATIC ${OPENJPIP_SRCS})
TARGET_LINK_LIBRARIES(openjpip_server ${FCGI_LIBRARIES} ${CURL_LIBRARIES})
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

@ -1,7 +1,7 @@
# Headers file are located here:
INCLUDE_DIRECTORIES(
${OPENJPEG_SOURCE_DIR}/applications/jpip/libopenjpip
${FCGI_INCLUDE_DIRNAME}
${FCGI_INCLUDE_DIRS}
)
SET(OPJ_SERVER_SRCS
@ -10,7 +10,7 @@ SET(OPJ_SERVER_SRCS
# Build executable
ADD_EXECUTABLE(opj_server ${OPJ_SERVER_SRCS})
TARGET_LINK_LIBRARIES(opj_server openjpip_server ${FCGI_LIBNAME})
TARGET_LINK_LIBRARIES(opj_server openjpip_server ${FCGI_LIBRARIES})
SET_PROPERTY(
TARGET opj_server
APPEND PROPERTY

View File

@ -108,15 +108,3 @@ ELSE (BUILD_THIRDPARTY)
ENDIF (LCMS_FOUND)
ENDIF(LCMS2_FOUND)
ENDIF(BUILD_THIRDPARTY)
#------------
# 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(STATUS "FCGI lib not found, JPIP will not be built as it requires FCGI")
ENDIF(FCGI_FOUND)