]> granicus.if.org Git - openjpeg/commitdiff
COMP: Fixing configuration for static builds. Fixing dependencies that several
authorLuis Ibanez <luis.ibanez@gmail.com>
Wed, 1 Sep 2010 00:52:26 +0000 (00:52 +0000)
committerLuis Ibanez <luis.ibanez@gmail.com>
Wed, 1 Sep 2010 00:52:26 +0000 (00:52 +0000)
executables have on getopt.c, convert.c and index.c.

Some refactoring is going to be required in order to have a cleaner
configuration process and make it easier to maintain.

jp3d/codec/CMakeLists.txt
jpwl/CMakeLists.txt
mj2/CMakeLists.txt

index 5ed13e7012f00ed7f0dfb934b0ba070e0e9f5b45..24595c7a9ceb3b3512d300af0a6c424d30980e00 100644 (file)
@@ -27,9 +27,9 @@ ENDIF(DONT_HAVE_GETOPT)
 
 # Do the proper thing when building static...if only there was configured
 # headers or def files instead
-#IF(NOT BUILD_SHARED_LIBS)
-#  ADD_DEFINITIONS(-DOPJ_STATIC)
-#ENDIF(NOT BUILD_SHARED_LIBS)
+IF(NOT BUILD_SHARED_LIBS)
+  ADD_DEFINITIONS(-DOPJ_STATIC)
+ENDIF(NOT BUILD_SHARED_LIBS)
 
 #FIND_PACKAGE(TIFF REQUIRED)
 
index 591c95f5229fb64b544bde6cb722bdad98c43a2a..a24210f0449affb85f74ddd323e7cdc72cb0a14c 100755 (executable)
@@ -24,31 +24,59 @@ SET(OPJ_SRCS
 )
 SET(JPWL_SRCS crc.c jpwl.c jpwl_lib.c rs.c)
 
+# Then check if getopt is present:
+INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
+SET(DONT_HAVE_GETOPT 1)
+IF(UNIX) #I am pretty sure only *nix sys have this anyway
+  CHECK_INCLUDE_FILE("getopt.h" CMAKE_HAVE_GETOPT_H)
+  # Seems like we need the contrary:
+  IF(CMAKE_HAVE_GETOPT_H)
+    SET(DONT_HAVE_GETOPT 0)
+  ENDIF(CMAKE_HAVE_GETOPT_H)
+ENDIF(UNIX)
+
+# If not getopt was found then add it to the lib:
+IF(DONT_HAVE_GETOPT)
+  ADD_DEFINITIONS(-DDONT_HAVE_GETOPT)
+  SET(OPJ_SRCS
+    ${OPJ_SRCS}
+    ../codec/compat/getopt.c
+  )
+ENDIF(DONT_HAVE_GETOPT)
+
 ADD_LIBRARY(openjpeg_JPWL ${JPWL_SRCS} ${OPJ_SRCS})
 
 # Do the proper thing when building static...if only there was configured
 # headers or def files instead
-#IF(NOT BUILD_SHARED_LIBS)
-#  ADD_DEFINITIONS(-DOPJ_STATIC)
-#ENDIF(NOT BUILD_SHARED_LIBS)
+IF(NOT BUILD_SHARED_LIBS)
+  ADD_DEFINITIONS(-DOPJ_STATIC)
+ENDIF(NOT BUILD_SHARED_LIBS)
 
 INCLUDE_DIRECTORIES(
   ${OPENJPEG_SOURCE_DIR}/libopenjpeg
   )
 
 FIND_PACKAGE(TIFF REQUIRED)
+FIND_PACKAGE(PNG REQUIRED)
+INCLUDE_DIRECTORIES( ${PNG_INCLUDE_DIR} )
+INCLUDE_DIRECTORIES( ${TIFF_INCLUDE_DIR} )
 
 ADD_EXECUTABLE(JPWL_j2k_to_image
-../codec/convert.c ../codec/j2k_to_image.c
+../codec/convert.c 
+../codec/index.c 
+../codec/j2k_to_image.c
 )
-TARGET_LINK_LIBRARIES(JPWL_j2k_to_image openjpeg_JPWL ${TIFF_LIBRARIES})
+TARGET_LINK_LIBRARIES(JPWL_j2k_to_image ${OPJ_PREFIX}openjpeg_JPWL ${TIFF_LIBRARIES})
 IF(UNIX)
   TARGET_LINK_LIBRARIES(JPWL_j2k_to_image m)
 ENDIF(UNIX)
 
 ADD_EXECUTABLE(JPWL_image_to_j2k
-../codec/convert.c ../codec/image_to_j2k.c)
-TARGET_LINK_LIBRARIES(JPWL_image_to_j2k openjpeg_JPWL ${TIFF_LIBRARIES})
+../codec/convert.c
+../codec/index.c
+../codec/image_to_j2k.c
+)
+TARGET_LINK_LIBRARIES(JPWL_image_to_j2k ${OPJ_PREFIX}openjpeg_JPWL ${TIFF_LIBRARIES})
 IF(UNIX)
   TARGET_LINK_LIBRARIES(JPWL_image_to_j2k m)
 ENDIF(UNIX)
index 1e884b8221f95d29b3cf8267ad7a90f416eed996..c1fa4bf31457438493c11f3e5107f7d26b40ea00 100644 (file)
@@ -5,6 +5,12 @@ INCLUDE_DIRECTORIES(
   ${OPENJPEG_SOURCE_DIR}/libopenjpeg
   )
 
+# Do the proper thing when building static...if only there was configured
+# headers or def files instead
+IF(NOT BUILD_SHARED_LIBS)
+  ADD_DEFINITIONS(-DOPJ_STATIC)
+ENDIF(NOT BUILD_SHARED_LIBS)
+
 ADD_EXECUTABLE(frames_to_mj2
   frames_to_mj2.c
   compat/getopt.c