[1.5] remove pthread dependency in JPIP client and tweak thirdparty stuff
authorAntonin Descampe <antonin@gmail.com>
Wed, 25 Jan 2012 16:30:03 +0000 (16:30 +0000)
committerAntonin Descampe <antonin@gmail.com>
Wed, 25 Jan 2012 16:30:03 +0000 (16:30 +0000)
CMakeLists.txt
applications/codec/CMakeLists.txt
applications/jpip/CMakeLists.txt
applications/jpip/libopenjpip/CMakeLists.txt
applications/jpip/libopenjpip/openjpip.c
applications/jpip/libopenjpip/openjpip.h
applications/jpip/util/CMakeLists.txt
thirdparty/CMakeLists.txt

index 6ce4ee155db84b52ab7509f5fc5bf700522bdcfc..61689ca56897a57c29f4bb428b16b2df79ca51c3 100644 (file)
@@ -184,6 +184,7 @@ ADD_SUBDIRECTORY(libopenjpeg)
 # Build Applications
 OPTION(BUILD_CODEC "Build the CODEC executables" ON)
 OPTION(BUILD_MJ2 "Build the MJ2 executables." OFF)
+OPTION(BUILD_JPWL "Build the JPWL library and executables" OFF)
 OPTION(BUILD_JPIP "Build the JPIP library and executables." OFF)
 IF(BUILD_JPIP)
   OPTION(BUILD_JPIP_SERVER "Build the JPIP server." OFF)
@@ -193,16 +194,13 @@ OPTION(BUILD_JAVA "Build the openjpeg jar (Java)" OFF)
 MARK_AS_ADVANCED(BUILD_VIEWER)
 MARK_AS_ADVANCED(BUILD_JAVA)
 
-# Try to find lib Z
-FIND_PACKAGE(ZLIB)
-
-IF(BUILD_CODEC OR BUILD_MJ2 OR BUILD_JPIP)
+IF(BUILD_CODEC OR BUILD_MJ2)
   # OFF: It will only build 3rd party libs if they are not found on the system
   # ON: 3rd party libs will ALWAYS be build, and used
   OPTION(BUILD_THIRDPARTY "Build the thirdparty executables if it is needed" OFF)
   ADD_SUBDIRECTORY(thirdparty)
   ADD_SUBDIRECTORY(applications)
-ENDIF (BUILD_CODEC OR BUILD_MJ2 OR BUILD_JPIP)
+ENDIF (BUILD_CODEC OR BUILD_MJ2)
 
 #-----------------------------------------------------------------------------
 # opj_config.h generation (2/2)
@@ -211,10 +209,6 @@ CONFIGURE_FILE("${OPENJPEG_SOURCE_DIR}/opj_config.h.cmake.in"
  @ONLY
  )
 
-#-----------------------------------------------------------------------------
-# Build JPWL-flavoured library and executables
-OPTION(BUILD_JPWL "Build the JPWL library and executables" OFF)
-
 #-----------------------------------------------------------------------------
 # Build DOCUMENTATION (not in ALL target and only if Doxygen is found)
 OPTION(BUILD_DOC "Build the HTML documentation (with doxygen if available)." OFF)
index 31009c34b9317eed259cd072d392c68b0951d2ec..2a195155ac2b5645d90a704e4a93b0eb76451e29 100644 (file)
@@ -70,7 +70,14 @@ IF(BUILD_JPWL)
   )
 
   TARGET_LINK_LIBRARIES(JPWL_j2k_to_image ${OPENJPEG_LIBRARY_NAME}_JPWL
-    ${LCMS_LIBNAME} ${Z_LIBNAME} ${PNG_LIBNAME} ${TIFF_LIBNAME})
+    ${LCMS_LIBNAME} ${PNG_LIBNAME} ${TIFF_LIBNAME})
+    
+  # To support universal exe:
+  IF(ZLIB_FOUND AND APPLE)
+    TARGET_LINK_LIBRARIES(JPWL_j2k_to_image z)
+  ELSe(ZLIB_FOUND AND APPLE)
+    TARGET_LINK_LIBRARIES(JPWL_j2k_to_image ${Z_LIBNAME})
+  ENDIF(ZLIB_FOUND AND APPLE)
   
   IF(UNIX)
     TARGET_LINK_LIBRARIES(JPWL_j2k_to_image m)
@@ -87,7 +94,14 @@ IF(BUILD_JPWL)
   )
 
   TARGET_LINK_LIBRARIES(JPWL_image_to_j2k ${OPENJPEG_LIBRARY_NAME}_JPWL 
-       ${LCMS_LIBNAME} ${Z_LIBNAME} ${PNG_LIBNAME} ${TIFF_LIBNAME})
+       ${LCMS_LIBNAME} ${PNG_LIBNAME} ${TIFF_LIBNAME})
+       
+  # To support universal exe:
+  IF(ZLIB_FOUND AND APPLE)
+    TARGET_LINK_LIBRARIES(JPWL_image_to_j2k z)
+  ELSe(ZLIB_FOUND AND APPLE)
+    TARGET_LINK_LIBRARIES(JPWL_image_to_j2k ${Z_LIBNAME})
+  ENDIF(ZLIB_FOUND AND APPLE)
 
   IF(UNIX)
     TARGET_LINK_LIBRARIES(JPWL_image_to_j2k m)
index d4a140a5fa2cd48f5d0c483295c387f86d74c2de..77485a3d2c89591b78b887a9c39b6a139c83b772 100644 (file)
@@ -4,10 +4,9 @@ IF(BUILD_JPIP_SERVER)
   FIND_PACKAGE(FCGI REQUIRED)
 ENDIF(BUILD_JPIP_SERVER)
 
-# JPIP client & server:
+# JPIP library:
 ADD_SUBDIRECTORY(libopenjpip)
 
-# jpip server:
-IF(BUILD_JPIP_SERVER)
-  ADD_SUBDIRECTORY(util)
-ENDIF(BUILD_JPIP_SERVER)
+# JPIP binaries:
+ADD_SUBDIRECTORY(util)
+
index b177fb7efe29c6230925ab5a36d3ac314d2ad4c2..befc6390ec28993655c22cfcb9ede1a33bbb357d 100644 (file)
@@ -45,7 +45,7 @@ SET(LOCAL_SRCS
 
 # Build the library
 ADD_LIBRARY(openjpip_local STATIC ${OPENJPIP_SRCS} ${LOCAL_SRCS})
-TARGET_LINK_LIBRARIES(openjpip_local ${OPENJPEG_LIBRARY_NAME} ${CURL_LIBRARIES})
+TARGET_LINK_LIBRARIES(openjpip_local ${OPENJPEG_LIBRARY_NAME})
 
 # Install library
 INSTALL(TARGETS openjpip_local
index f19d7aea9021ea5e6d850e25b376126bf47d4d9c..fa4d8cf9911493b6bce174dc3da4a2d61938f371 100644 (file)
@@ -46,6 +46,8 @@
 #include <unistd.h>
 #include "jp2k_encoder.h"
 
+#ifdef SERVER
+
 server_record_t * init_JPIPserver( int tcp_auxport, int udp_auxport)
 {
   server_record_t *record = (server_record_t *)malloc( sizeof(server_record_t));
@@ -176,6 +178,7 @@ void end_QRprocess( server_record_t *rec, QR_t **qr)
   free( *qr);
 }
 
+
 void local_log( bool query, bool messages, bool sessions, bool targets, QR_t *qr, server_record_t *rec)
 {
   if( query)
@@ -191,6 +194,8 @@ void local_log( bool query, bool messages, bool sessions, bool targets, QR_t *qr
     print_alltarget( rec->targetlist);
 }
 
+#endif //SERVER
+
 #ifndef SERVER
 
 dec_server_record_t * init_dec_server( int port)
index 4f7941fed75aae77d03bccb928b9c92b98309dbd..82529362884426d869d666a918fadda5c8eeaaf7 100644 (file)
@@ -65,6 +65,8 @@
  * JPIP server API
  *==========================================================
  */
+ #ifdef SERVER
 
 //! Server static records
 typedef struct server_record{
@@ -129,8 +131,6 @@ void send_responsedata( server_record_t *rec, QR_t *qr);
  */
 void end_QRprocess( server_record_t *rec, QR_t **qr);
 
-#ifndef SERVER
-
 /**
  * Option for local tests; print out parameter values to logstream (stderr)
  *
index caa3774d68ff2e8ec02913d0d1de949ad350c267..1eff334637903e2c631dd0d562e751a11799b759 100644 (file)
@@ -4,30 +4,33 @@ INCLUDE_DIRECTORIES(
   ${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_LIBRARIES})
-SET_PROPERTY(
-  TARGET opj_server
-  APPEND PROPERTY
-  COMPILE_DEFINITIONS SERVER QUIT_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
index 78abffbef5a0f7c7ba4a3f5819098d988051404b..7ab24ba3ec10ce293daacfe4fa51c67f778588be 100644 (file)
@@ -1,5 +1,7 @@
 # 3rd party libs  
 
+#------------
+# Try to find lib Z
 IF(BUILD_THIRDPARTY)
   # Try to build it
   message(STATUS "We will build Z lib from thirdparty")
@@ -8,6 +10,8 @@ IF(BUILD_THIRDPARTY)
   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) 
@@ -19,7 +23,7 @@ ENDIF(BUILD_THIRDPARTY)
     
 
 #------------
-# Try to find lib PNG (which depends to zlib)
+# 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")